centos7.3 kvm Bridge虚拟机无法上网
宿主机:Red Hat Enterprise Linux Server release 7.3
kvm 虚拟机使用桥接网络
宿主机网络配置:
cat ifcfg-ens192
BOOTPROTO=none
DEVICE=ens192
NM_CONTROLLED=no
ONBOOT=yes
BRIDGE=br0
-----------------------------------------------------------------------------------------------
cat ifcfg-br0
BOOTPROTO=static
DEVICE=br0
TYPE=Bridge
NM_CONTROLLED=no
IPADDR=192.168.1.214
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
ONBOOT=yes
-----------------------------------------------------------------------------------------------
虚拟机网络配置
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.1.215
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
-----------------------------------------------------------------------------------------------
brctl show
bridge name bridge id STP enabled interfaces
br0 8000.0050568cdf22 no ens192
vnet0
-----------------------------------------------------------------------------------------------
virsh list
Id Name State
----------------------------------------------------
1 centos6.6 running
-----------------------------------------------------------------------------------------------
virsh edit centos6.6
<interface type='bridge'>
<mac address='52:54:00:d6:7e:cc'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
-----------------------------------------------------------------------------------------------
cat /proc/sys/net/ipv4/ip_forward
1
-----------------------------------------------------------------------------------------------
物理机route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 0 0 0 br0
link-local 0.0.0.0 255.255.0.0 U 1003 0 0 br0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
-----------------------------------------------------------------------------------------------
虚拟机route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
-----------------------------------------------------------------------------------------------
问题现象描述:
宿主机IP 192.168.1.214
虚拟机IP 192.168.1.215 手动设置
宿主机可以ping通网关可以通外网可ping通虚拟机
虚拟机可以ping通宿主机无法ping通网关及外网