Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On most managed switches you can enable Layer 2 Port Isolation. The implementation and terminology is different from vendor to vendor but generally speaking you keep one or more ports in the default Promiscuous (Cisco) or Uplink (HP) state and configure other ports as Isolated (Cisco) or Private (HP). Afterwards, isolated ports can only talk to promiscuous ones but not to each other.

Is there any way to implement this with Linux bridges to eg. isolate VMs from each other? Maybe via ebtables?

share|improve this question
I just learned that this is also called a Private VLAN and defined in RFC 5517. – mss May 12 '12 at 19:55
up vote 2 down vote accepted

you can try using ebtables and create own rules involving input/output bridge port.

i dont have server with bridge at hand but i'd do something like this:

ebtables -P FORWARD DROP
ebtables -F FORWARD
ebtables -A FORWARD -i $uplinkPort -j ACCEPT # let the traffic flow from uplink to any ports
ebtables -A FORWARD -o $uplinkPort -j ACCEPT # let the traffic flow from any ports to uplink
share|improve this answer
That's what I thought (cf. last sentence of my question) but I have no clue how to do this... well, that's a lie, I googled a bit since I asked that question and might have found a solution but haven't tried it yet. Anybody posting working ebtables rules is welcome :) – mss May 12 '12 at 22:44
i've added something that maybepossibly should work. feedback is welcome. – pQd May 13 '12 at 4:29
You pointed me to the right direction. For the (common) simple case where you've got a virtual bridge like vmbr0 and want to isolate all VMs from each other, a simple ebtables -A FORWARD --logical-in vmbr0 -j DROP on the host is enough. If you want to define other VMs as uplinks as well, you should instead jump to an extra chain with the policy DROP. There you can add rules eg. based on the interfaces (remember to add both -i and -o rules though). – mss May 13 '12 at 15:49
@mss could you post your whole config - either at or here as separate answer. thx. – pQd May 13 '12 at 16:42

As requested by @pQd here's a working example for port isolation with VMs (here: based on Proxmox VE) when the host is the uplink and all VMs should be isolated from each other. I use this for an internal service network (DNS, Updates, etc). The bridge is vmbr1, the virtual Ethernet devices are vethNNN.1 (where NNN is the VID). If you only want isolation, this should be enough:

ebtables --append FORWARD --logical-in vmbr1 --jump DROP

If multiple bridges are to be configured and other VMs should be Uplinks as well (here: veth100.1 and veth102.1), something like this is more appropriate (untested):

for br in $(seq 0 1); do
    ebtables --new-chain $br
    ebtables --policy $br DROP
    ebtables --append FORWARD --logical-in $br --jump $br
for if in 100.1 102.1; do
    br=vmbr$(echo $if | cut -d. -f2)
    ebtables --append $br --in-if $if
    ebtables --append $br --out-if $if

If the host shouldn't be an uplink, this should work (I didn't try it as well though):

ebtables --append INPUT --logical-in vmbr1 --jump vmbr1
ebtables --append OUTPUT --logical-out vmbr1 --jump vmbr1
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.