如何在两台计算机之间建立桥接

如何在两台计算机之间建立桥接

我有 3 台机器,设置如下:Computer1----装有 Ubuntu 12.04 的计算机-----Computer2 Computer1 的 IP 为 192.168.10.1,Computer2 的 IP 为 192.168.10.10。装有 Ubuntu 的计算机有 2 个以太网接口。我想在 Ubuntu 中创建一个网桥,以便 Computer1 和 Computer2 可以互相通信。

我在 Ubuntu 中创建了一座桥

sudo ifconfig eth0 0.0.0.0 down
sudo ifconfig eth1 0.0.0.0 down
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 eth1
sudo ifconfig br0 up
sudo ifconfig eth0 promisc up
sudo ifconfig eth1 promisc up

命令“brctl showstp br0”显示 eth0 和 eth1 的状态为转发。然后我在网桥中启动 tshark

sudo tshark -i br0

如果我尝试在 Computer2 中 ping Computer1,则会得到

ARP 60 Who has 192.168.10.1? Tell 192.168.10.10

在网桥中,我收到了来自 Computer2 的 ARP 请求,但没有看到来自 Computer1 的 ARP 回复

当我在 Computer1 上运行 tshark 时,得到这个

ARP 60 Who has 192.168.10.1? Tell 192.168.10.10
ARP 42 192.168.10.1 is at XX:XX:XX:XX:XX:XX (mac hidden)

通过这个,我看到 ARP 通过桥接器,Computer1 接收 ARP 并发送答复,但该答复没有通过桥接器。

有任何想法吗???

谢谢

答案1

在你的 ubuntu 系统中,为 br0 提供一个与计算机 A 和计算机 B 处于同一网络范围内的 IP 地址,比如说:

sudo ifconfig br0 192.168.10.5/24

下面的文章对于进一步的调试更有帮助: https://help.ubuntu.com/community/NetworkConnectionBridge

希望这有帮助。干杯

相关内容