Since this question was asked (in 2012), a newer method became available (in 2018) with Linux kernel >= 4.18 and related recent enough iproute2 tools: bridge port isolation.
It's described in KernelNewbies for Linux 4.18:
- bridge: add support for port isolation. Isolated ports cannot communicate between each other, but they can still communicate with non-isolated ports commit
If an interface, (typically named tapX for a VM or vethX for a container) has been set as bridge port of a bridge named bridge0 like this:
# ip link set dev tap0 master bridge0
one can set it isolated with the bridge
command like this:
# bridge link set dev tap0 isolated on
this won't have any visible effect until at least a second port of the same bridge is also isolated:
# bridge link set dev tap1 isolated on
Now the bridge ports tap0 and tap1 won't be able to send or receive any packet to or from the other port, but will still communicate normally with any other port of the bridge. You can choose to isolate all ports except one, used in the role of default promiscuous/uplink port.
Notes:
- as described in the commit, it's per port. If there are multiple VLANs on an isolated bridge port, all are affected,
- it's not clear if the bridge's self interface (bridge0 here) can be isolated itself (even with the correct syntax: appending the
self
keyword when the device is the bridge name itself),
- All newer advanced features available through (rt)netlink with the
ip link
and bridge
commands have no equivalent through the older ioctl API, so brctl
can't be used for this.