我有一个 Ubuntu 服务器,充当 KVM 主机,以及一些暴露在网络下运行的虚拟机。
VM 有自己的 iptables 规则,它们通过主机上的直接网桥 br0 联网。
我的问题是,我应该如何处理主机上 iptables 中的这个网桥。我是否将其视为自己的设备并像对待任何接口一样保护它?有什么我应该知道的,如果我在主机上阻止它,可能会阻止访客的流量?或者也许将我的规则写入原始接口 eno1?
我的当前设置如下所示:(virbr0 未被任何 VM 使用,vmnet0 是正在运行的来宾网络)
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet xxx.HOSTIP.xxx netmask 255.255.255.0 broadcast 62.210.172.255
inet6 fe80::d6ae:52ff:fece:993a prefixlen 64 scopeid 0x20<link>
inet6 xxx:HOSTIPv6::xxx prefixlen xx scopeid 0x0<global>
ether d4:ae:52:ce:99:3a txqueuelen 1000 (Ethernet)
RX packets 753413 bytes 59239171 (59.2 MB)
RX errors 0 dropped 51 overruns 0 frame 0
TX packets 115967 bytes 17911763 (17.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether d4:ae:52:ce:99:3a txqueuelen 1000 (Ethernet)
RX packets 993041 bytes 303457181 (303.4 MB)
RX errors 0 dropped 599 overruns 0 frame 0
TX packets 151299 bytes 22226710 (22.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 182799 bytes 19199389 (19.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 182799 bytes 19199389 (19.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:3c:92:cf txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc54:ff:fe00:825e prefixlen 64 scopeid 0x20<link>
ether fe:54:00:00:82:5e txqueuelen 1000 (Ethernet)
RX packets 25390 bytes 2725539 (2.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 683484 bytes 266619773 (266.6 MB)
TX errors 0 dropped 16075 overruns 0 carrier 0 collisions 0
这主要是您对客户系统的信任程度的问题。只要您不弄乱 FORWARD 表超出您正在执行的任何路由的基础知识,您就应该可以在常规界面上合理地做任何事情。在大多数情况下,最好像锁定其他界面一样锁定界面,然后根据需要添加异常(最好记录每个异常),但如果您绝对信任您的客户系统,则不锁定它并没有固有的危害下。