Networking

Xen:無法從 domU ping 到 dom0

  • September 5, 2016

我有 2 臺本地連接的 PC。我在 PC1 上創建了 2 個虛擬機,並使用 dom0 中的 eth0 介面通過橋接添加了連接。

From dom0: 

#brctl addbr xenbr0
#brctl addif xenbr0 eth0
#ifconfig xenbr0 10.0.2.4
#xl create /etc/xen/dom1.cfg
#xl create /etc/xen/dom2.cfg

#ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:22:01
         inet addr:10.0.2.1  Bcast:10.255.255.255  Mask:255.0.0.0
         inet6 addr: fe80::20a:35ff:fe00:2201/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:228 errors:0 dropped:0 overruns:0 frame:0
         TX packets:1228 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:36193 (35.3 KiB)  TX bytes:407300 (397.7 KiB)
         Interrupt:25

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:65536  Metric:1
         RX packets:5 errors:0 dropped:0 overruns:0 frame:0
         TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

vif2.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
         inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:10 errors:0 dropped:0 overruns:0 frame:0
         TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:32
         RX bytes:2524 (2.4 KiB)  TX bytes:2558 (2.4 KiB)

vif3.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
         inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:6 errors:0 dropped:0 overruns:0 frame:0
         TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:32
         RX bytes:1212 (1.1 KiB)  TX bytes:1165 (1.1 KiB)

xenbr0    Link encap:Ethernet  HWaddr 00:0A:35:00:22:01
         inet addr:10.0.2.3  Bcast:10.255.255.255  Mask:255.0.0.0
         inet6 addr: fe80::20a:35ff:fe00:2201/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:20 errors:0 dropped:0 overruns:0 frame:0
         TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:4224 (4.1 KiB)  TX bytes:648 (648.0 B)

在 Xen cfg 文件中,我有這一行“vif =

$$ ‘script=vif-bridge, bridge=xenbr0’ $$" 來自 domU

#ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:3E:60:FC:91
         inet addr:10.0.2.6  Bcast:10.255.255.255  Mask:255.0.0.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:94 errors:0 dropped:0 overruns:0 frame:0
         TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:23886 (23.3 KiB)  TX bytes:22500 (21.9 KiB)

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:65536  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

引導到訪客虛擬機後,我有以下 ping 狀態:

  • domU 之間 ping 正常。
  • domUs 和 PC2 之間 Ping 正常。
  • 從 domU ping 到 dom0(PC1) 不正常!

感謝您的時間和幫助!

eth0 和 xenbr0 都有一個 IP(甚至是同一個 IP)。去掉 eth0 上的 IP。網橋是第 2 層抽象,因此您不能在連接到它的介面上使用第 3 層定址。將 IP 保留在網橋介面上,因為那是您放置第 3 層定址的那個。任何連接到橋樑的東西都是如此,包括債券。第 2 層堆棧的末尾獲得第 3 層地址。

引用自:https://serverfault.com/questions/800701