无法从桥接接口 ping 通

无法从桥接接口 ping 通

我正在尝试在虚拟机中桥接eth2Ubuntu br0 11.04。有网络桥接来托管物理机。

桥接后,从客户操作系统可以 ping 通,br0 但从 不能ping 通eth2。为什么?

ping -I eth2 bbc.co.uk

PING bbc.co.uk (212.58.241.131) from 172.16.4.186 eth2: 56(84) bytes of data.
From VirtualBox.local (172.16.4.103) icmp_seq=2 Destination Host Unreachable
From VirtualBox.local (172.16.4.103) icmp_seq=3 Destination Host Unreachable

ping -I br0 bbc.co.uk

PING bbc.co.uk (212.58.241.131) from 172.16.4.186 br0: 56(84) bytes of data.
64 bytes from virtual-vip.thdo.bbc.co.uk (212.58.241.131): icmp_req=1 ttl=239 time=31.2 ms

我的 /etc/网络/接口如下

auto lo
iface lo inet loopback

auto eth2
iface eth2 inet manual

auto br0
iface br0 inet static
        address 172.16.4.186
        network 172.16.4.255
        netmask 255.255.255.0
        broadcast 172.16.4.255
        gateway 172.16.4.1
        bridge_ports eth2
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0

网关是

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.4.1      0.0.0.0         UG    100    0        0 br0
172.16.4.0      0.0.0.0         255.255.255.0   U     0      0        0 br0
172.16.4.0      0.0.0.0         255.255.255.0   U     1      0        0 eth3

ifconfig

br0       Link encap:Ethernet  HWaddr 08:00:27:4a:08:57  
          inet addr:172.16.4.186  Bcast:172.16.4.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe4a:857/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2969 errors:0 dropped:0 overruns:0 frame:0
          TX packets:267 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:200777 (200.7 KB)  TX bytes:28141 (28.1 KB)

eth0      Link encap:Ethernet  HWaddr 08:00:27:df:f5:a7  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:392 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3904 (3.9 KB)  TX bytes:55700 (55.7 KB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:4a:08:57  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19849 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1206 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1631595 (1.6 MB)  TX bytes:114927 (114.9 KB)

eth3      Link encap:Ethernet  HWaddr 08:00:27:50:00:2d  
          inet addr:172.16.4.103  Bcast:172.16.4.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe50:2d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19515 errors:0 dropped:0 overruns:0 frame:0
          TX packets:145 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1625905 (1.6 MB)  TX bytes:17450 (17.4 KB)

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:113 errors:0 dropped:0 overruns:0 frame:0
          TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12544 (12.5 KB)  TX bytes:12544 (12.5 KB)

答案1

这是预期的行为。如果您将 eth2 连接到网桥,则 eth2 将无法使用(即使有 IP 地址)。您在软件端使用 br0,eth0 是物理使用的。

一般来说,当谈论桥梁时,给出以下输出是有意义的brctl show

答案2

接口上没有 IP 地址eth2

这也是问题所在。

答案3

事实确实如此。Ping 是第 3 层的事情。桥接接口是纯粹的第 2 层的事情。出于同样的原因,您也无法通过以太网电缆进行 ping。就像纯交换机不知道什么是 ping 一样,纯交换接口也不知道什么是 ping。

相关内容