大网数据广告活动
服务器运维问答

How to protect a bridge br0 interface?

· 52CE 我爱测

I have an Ubuntu server, acting as KVM host, and some virtual machines exposed to the net running under it. The VMs have their own iptables rules, and they are networked via a direct bridge on the host, br0. My question, is how s…

问题原文

原帖链接 · Waleed Hamra · CC BY-SA 3.0

I have an Ubuntu server, acting as KVM host, and some virtual machines exposed to the net running under it.

The VMs have their own iptables rules, and they are networked via a direct bridge on the host, br0.

My question, is how should I deal with this bridge in iptables on the host. Do I consider it its own device and protect it as I would any interface? Is there something I should know, that might block traffic to the guests if I block it on the host? Or maybe write my rules to the original interface eno1?

My curent setup looks like this: (virbr0 is not used by any VM, vmnet0 is a running guest's network)

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

已采纳解答

原帖链接 · Austin Hemmelgarn · CC BY-SA 3.0

This mostly is a question of how much you trust your guest systems. As long as you don't mess with the FORWARD table beyond the basics for whatever routing you're doing, you should be fine doing just about anything you reasonably would on a regular interface. In most cases, it's generally a better idea to just lock down the interface like you would any other, then add exceptions as-needed (ideally documenting each), but if you absolutely trust your guest systems, there's no inherent harm in not locking it down.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。