Juniper Filter-based VLANs

So during my efforts to study for the Juniper JNCIP-Ent ( Enterprise Routing & Switching ) exam, I happened to come across a Juniper switching feature called Filter-based VLANs.

In normal VLAN-based switching, a device’s assigned VLAN is configured on it’s access port and can’t be changed no matter what is connected to that port.

Filter-based VLANs work a bit differently – they allow the engineer to map the VLAN based on packet properties.
With this you could conceivably do something like the following diagram shows:

Here we have a Juniper EX-series switch connected to an un-managed hub or switch. We want to map the PC into one VLAN and the VOIP phone into another. The EX switch then trunks the 2 VLANs up to a core switch. We do this with Filter-based VLANs.

Firstly, create the 2 VLANs:

And now create a firewall policy to assign the device MAC addresses into each VLAN:

And now in the interface configuration, apply the firewall filter to the physical interface:

Filter-based VLANs can also match frames on other criteria, such as the IP address – although be aware that this might not work as you expect. ARP packets for instance won’t get properly mapped, so I think that for most practical purposes mapping by MAC address is probably the most useful option. You can also map by MAC prefixes such as the device vendor OUI, for example the above policy rules could have been written as:

which makes things a bit more flexible if the same rule is going to be applied to many interfaces, or across multiple switches.

I admit, there aren’t a lot of circumstances where Filter-based VLANs would be useful (maybe in service provider edge aggregation?). Most enterprises will be using managed switches everywhere – but then again, it’s a handy feature to know about.

Permanent link to this article: https://www.crypt.gen.nz/2017/06/27/juniper-filter-based-vlans/