我一直被这个问题困住了几天。 我在PowerKVM主机上运行一个Ubuntu 14.04 guest(PowerKVM是IBM Power Systems上的KVM,所以基本上只是KVM)。 我无法使桥接networking正常工作。 我甚至不能ping通默认网关。 我的猜测是在XMLconfiguration文件中有错误。
这里是文件。
KVM主机
localhost:/root # ifconfig -a brenP3p5s0f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.16.229.200 netmask 255.255.255.192 broadcast 172.16.229.255 inet6 fe80::42f2:e9ff:fe5d:61bb prefixlen 64 scopeid 0x20<link> ether 40:f2:e9:5d:61:bb txqueuelen 0 (Ethernet) RX packets 40709 bytes 3013319 (2.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 38 bytes 6015 (5.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 enP3p5s0f0: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether 40:f2:e9:5d:61:b8 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 252 enP3p5s0f1: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether 40:f2:e9:5d:61:b9 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 253 enP3p5s0f2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.16.229.199 netmask 255.255.255.192 broadcast 172.16.229.255 inet6 fe80::42f2:e9ff:fe5d:61ba prefixlen 64 scopeid 0x20<link> ether 40:f2:e9:5d:61:ba txqueuelen 1000 (Ethernet) RX packets 36345 bytes 4200608 (4.0 MiB) RX errors 0 dropped 2 overruns 0 frame 0 TX packets 23689 bytes 12817261 (12.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 252 enP3p5s0f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::42f2:e9ff:fe5d:61bb prefixlen 64 scopeid 0x20<link> ether 40:f2:e9:5d:61:bb txqueuelen 1000 (Ethernet) RX packets 32473 bytes 2927091 (2.7 MiB) RX errors 0 dropped 3080 overruns 0 frame 0 TX packets 364 bytes 78478 (76.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 253 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 108802 bytes 28022560 (26.7 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 108802 bytes 28022560 (26.7 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:7b:a3:23 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.121.1 netmask 255.255.255.0 broadcast 192.168.121.255 ether 52:54:00:1e:11:18 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether 52:54:00:7b:a3:23 txqueuelen 500 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr1-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether 52:54:00:1e:11:18 txqueuelen 500 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
主机的路由表
Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.16.229.193 0.0.0.0 UG 0 0 0 enP3p5s0f2 169.254.0.0 0.0.0.0 255.255.0.0 U 1004 0 0 enP3p5s0f2 169.254.0.0 0.0.0.0 255.255.0.0 U 1039 0 0 brenP3p5s0f3 172.16.229.192 0.0.0.0 255.255.255.192 U 0 0 0 enP3p5s0f2 172.16.229.192 0.0.0.0 255.255.255.192 U 0 0 0 brenP3p5s0f3 192.168.121.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr1 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
来宾的XML文件(接口部分)保存在主机中。
localhost:/root # virsh edit ubuntu01 <interface type='bridge'> <mac address='52:54:00:b8:bd:eb'/> <source bridge='brenP3p5s0f3'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
保存在主机中的桥接networkingXML文件:
localhost:/root # cat /etc/libvirt/qemu/networks/bridged.xml <network> <name>bridged</name> <uuid>01ebaa45-0034-4a3f-8d57-fe67e03130b6</uuid> <forward mode='bridge'/> <bridge name='brenP3p5s0f3'/> </network>
客人
我不能复制/粘贴,因为我不能ssh(鉴于它无法访问)和virsh上的控制台不知何故无法正常工作。 但是,当我启动虚拟机,我看到没有定义的IP地址。 那么我做的是以下几点:
ifconfig eth0 172.16.229.201 netmask 255.255.255.192 up ip route add default via 172.16.229.193
默认的gw也是一样的主机。 我使用的networking掩码既是来宾又是主机。
问题:当我ping默认网关时,出现“Destination Host Unreachable”错误。 当我平了自己172.16.229.201,我可以成功地ping。
一个更新:尝试tcpdump的默认gw的IP地址时发生一个有趣的行为:我得到sometihng像:
ARP, Request who-has 10.10.10.6 tell 10.10.10.105, length 46 ARP, Request who-has 10.10.10.6 tell 10.10.10.102, length 46 ARP, Request who-has 10.10.10.252 tell 10.10.10.253, length 46 IP 10.10.10.2.1985 > 224.0.0.102.1985: HSRPv1
像这样的多行。 我不知道从哪里得到这些IP地址。 “有趣”的事情是,我通过tcpdump在主机上的桥接口得到相同的输出! 所以它看起来像tcpdump访问networking不知何故从客人! 否则我不能解释为什么这些线是相同的。 我想强调的是,以10开头的私有IP地址不会分配到我的子网中的任何地方。
任何想法?
提前致谢!