我对 iptables/bridging 的知识还不够了解,但我还是遵循了https://help.ubuntu.com/community/NetworkConnectionBridge并根据我的情况进行定制。
这是我的配置(删除了一些项目:
#auto eth0
iface eth0 inet static
address 10.216.1.247
netmask 255.255.248.0
gateway 10.216.1.254
#auto eth1
iface eth1 inet static
address 10.1.1.254
netmask 255.255.0.0
auto br0
iface br0 inet static
address 10.216.1.247
netmask 255.255.248.0
gateway 10.216.1.254
bridge_ports eth0 eth1
并且 ifconfig ~$ ifconfig
br0 Link encap:Ethernet HWaddr 00:15:5d:41:53:0e
inet addr:10.216.1.247 Bcast:10.216.7.255 Mask:255.255.248.0
inet6 addr: fe80::215:5dff:fe41:530e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:994262 errors:0 dropped:0 overruns:0 frame:0
TX packets:579 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65360679 (65.3 MB) TX bytes:56582 (56.5 KB)
eth0 Link encap:Ethernet HWaddr 00:15:5d:41:53:0e
inet6 addr: fe80::215:5dff:fe41:530e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26145 errors:0 dropped:0 overruns:0 frame:0
TX packets:28727 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3331228 (3.3 MB) TX bytes:3336348 (3.3 MB)
eth1 Link encap:Ethernet HWaddr 00:15:5d:41:53:0f
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:968896 errors:0 dropped:0 overruns:0 frame:0
TX packets:25616 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:76009978 (76.0 MB) TX bytes:3245351 (3.2 MB)
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:181 errors:0 dropped:0 overruns:0 frame:0
TX packets:181 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:14024 (14.0 KB) TX bytes:14024 (14.0 KB)
我正在尝试 ping 我的系统(windows)
IPv4 Address. . . . . . . . . . . : 10.216.1.23(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.248.0
IPv4 Address. . . . . . . . . . . : 10.1.1.254(Duplicate)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.216.1.254
当我 ping 一个已知的可 ping 地址 (10.1.1.160) 时,我得到了所有超时。当桥被禁用时,我可以从桥接机器 ping 两端。