我目前有一个 Proxmox(debian)KVM 主机,运行多个 OpenVZ 容器以供一般使用,我正在考虑创建一个 KVM VM,但是我无法让网络为 CentOS KVM Guest 工作。
请从主机查找网络配置:
# ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet6 addr: fe80::22cf:30ff:fe19:7b67/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41861518 errors:0 dropped:0 overruns:0 frame:0
TX packets:23326041 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16692957938 (xx.x GiB) TX bytes:16624094064 (xx.x GiB)
Interrupt:47 Memory:fbfe0000-fc000000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1805386 errors:0 dropped:0 overruns:0 frame:0
TX packets:1805386 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:532155476 (507.5 MiB) TX bytes:532155476 (507.5 MiB)
vmbr0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:88.xxx.xxx.229 Bcast:88.xxx.xxx.xxx Mask:255.255.252.0
inet6 addr: fe80::22cf:30ff:fe19:7b67/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:38116128 errors:0 dropped:0 overruns:0 frame:0
TX packets:21500108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15771625496 (xx.x GiB) TX bytes:16504698806 (xx.x GiB)
以及来自主机的路由:
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
88.xxx.xxx.109 0.0.0.0 255.xxx.xxx.xxx UH 0 0 0 venet0
88.xxx.xxx.0 0.0.0.0 255.xxx.xxx.xxx U 0 0 0 vmbr0
0.0.0.0 88.xxx.xxx.1 0.0.0.0 UG 0 0 0 vmbr0
从来宾 CentOS KVM VM:
#ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:88.xxx.xxx.252 Bcast:88.xxx.xxx.255 Mask:255.255.252.0
inet6 addr: fe80::22cf:30ff:fe19:7b67/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:38116128 errors:0 dropped:0 overruns:0 frame:0
TX packets:21500108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15771625496 (xx.x GiB) TX bytes:16504698806 (xx.x GiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1805386 errors:0 dropped:0 overruns:0 frame:0
TX packets:1805386 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:532155476 (507.5 MiB) TX bytes:532155476 (507.5 MiB)
客人的路线:
#route -n
Kernel IP routing table
Destination Gateway Genmask Flags Matric Ref Use Iface
88.xxx.xxx.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 88.xxx.xxx.1 0.0.0.0 UG 0 0 0 eth0
主机向客户机执行 ping 操作后返回以下信息:
# ping 88.xxx.xxx.252
PING 88.xxx.xxx.xxx (88.xxx.xxx.252) 56(84) bytes of data.
From 88.xxx.xxx.229 icmp_seq=1 Destination Host Unreachable
From 88.xxx.xxx.229 icmp_seq=2 Destination Host Unreachable
From 88.xxx.xxx.229 icmp_seq=3 Destination Host Unreachable
--- 88.208.236.252 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3016ms
如能得到任何帮助我将非常感激!
编辑 抱歉,忘记包含 brctl 输出
# brctl show
bridge name bridge id STP enabled interfaces
vmbr0 8000.20cf30197b67 no eth0
答案1
我对 KVM 不是很了解,但根据我对 Xen 的了解,您的桥接器上似乎缺少一个接口 - 您那里只有物理主机接口,但它还应该列出您的客户机在主机上使用的任何网络设备。我看到主机的路由表上提到了 venet0 接口,您能否将 ifconfig 替换为 ifconfig -a?
如果 venet0 原来是客户机的接口,您可能应该使用 将其添加到网桥brctl addif vmbr0 venet0
。但请记住,路由表显示主机认为链接“另一侧”的 IP 是 .109,因此如果原来是正确的接口,则您可能存在配置问题。但如果路由属于网桥,则删除通过 venet0 的路由应该就足够了。