这是我的情况。 我有一个2个网卡的服务器。 我已经安装了虚拟盒子,并且已经创build了几个客户操作系统。 我希望这些虚拟机使用一个网桥.NIC2将被用来设置这个网桥,而NIC1将被连接到企业networking。我不清楚我该怎么去做这件事。 /etc/network/interfaces是我正在修改的文件等。我的方法如下
1)定义一个configuration文件/ etc / network / interfaces
2)创buildIPTABLES作为NIC1如何将数据包转发到NIC2上的网桥
现在出现这个问题,我不明白什么是在configuration文件中的以下行的含义
auto lo iface lo inet loopback # The primary network interface auto eth2 iface eth2 inet manual auto br0 iface br0 inet static address 192.168.1.14 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.10 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.13.2 dns-search myserver.net bridge_ports eth2 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
因此,任何指向/ etc / network / interfaces文件的条目应该是什么。 所以,我明白哪个参数将被用于何时何地将帮助我。
bridge_ports eth2
这是关键线,你应该添加你的接口,虚拟和其他,你想成为桥梁的成员。
bridge_ports eth0 eth2
其余的只是描述了桥梁的选项。 为了进一步阅读, brctl会给你选项的描述。
另外,为了dynamic添加端口并将其移除到桥上,只需使用brctl即可。
brctl addif br0 eth3 brctl delif br0 eth3
获取已经在桥上的端口列表
brctl br0 show