How to Setup and Secure UniFi VLAN

When you have a UniFi Security Gateway or UniFi Dream Machine (UDM, UDM Pro) you can create different VLANs on your network. Virtual LANs (VLANs), allow you to divide your physical network into virtual networks, offering isolation, security, and scalability.

Now you might think, do I really need VLANs? But when guests are connecting to your home network, you probably don’t want them to have access to all your network devices. And if you have a smart home, then creating a separate VLAN might be a good idea. Because the security of IoT devices is not always as it should be.

In this article

So in this article, I will explain how to set up and secure VLANs in the UniFi Network Console.

Note This article is updated in dec 2023, using the latest UniFi Network version (8.0.x). It explains how to configure VLANs using VLAN Magic , Traffic Rules and/or Firewall Rules

Setup UniFi VLANs

Creating VLANs in UniFi exists out of a couple of steps because we not only have to create the different networks, but we also need to secure the VLANs. The “problem” with UniFi is that inter-VLAN traffic is allowed by default. So without any firewall rules, traffic from for example the guest VLAN can just access the main VLAN.

In this example, we will be creating 3 VLAN networks for:

  • Guests – VLAN 20
  • Cameras – VLAN 30
  • IoT devices – VLAN 40

The guest VLAN is a bit different from the other VLANs because UniFi will automatically create the necessary firewall rules for the guest network. All you have to do is Isolate the network in the network settings.

So in the steps below, we will create the guest network, with the correct settings, but further on I will use the IoT VLAN as an example.

Step 1 – Create the UniFi VLAN Networks

The first step is to create the different networks for the VLANs. I have used custom VLAN IDs in the steps below, but you can also leave Auto Scale Network on. This way UniFi will automatically create the IP Range and VLAN ID.

Open your UniFi network console and navigate to:

  • Settings > Networks
  • Click on New Virtual Network

unifi dynamic vlan assignment

We are first going to create the guest network:

  • Enter Guests at the Network Name
  • Deselect Auto-Scale Network
  • Set the host address to 192.168.20.1
  • Change Advanced Configuration to Manual
  • Change the VLAN ID to 20 so it matches the IP range
  • Enable Isolation by checking Network
  • Change the Content Filtering to Family (optional)
  • Click Apply Changes

unifi dynamic vlan assignment

Next, we need to create the network for the Cameras and IoT devices. Click again on New Virtual network , and repeat the steps below for both Cameras and IoT , using VLAN 30 for cameras and 40 for IoT:

  • Network Name: IoT
  • Disable Auto Scale Network
  • Host Address: 192.168.40.1
  • Advanced Configuration: Manual
  • VLAN ID: 40
  • Isolation: Off
  • Click Apply Changes (and repeat for cameras)

Create UniFi VLAN

Using VLAN Magic

If you are running UniFi Network 8.0.24 or higher, then you can also use the new VLAN Magic feature to create virtual networks. It allows you to create a new virtual network from the device overview, and simply assign devices to the VLAN by selecting them.

UniFi Network will then use the virtual network override feature to move the device to the assigned VLAN. The advantage of this method is that you don’t need to create wireless networks for your VLANs, but when applying this on a wired device, you will need to make sure that your ports are configured correctly (I will explain that later in the article).

UniFi VLAN Magic

To create a new VLAN with VLAN Magic:

  • Open the Topology view
  • Click on the plus icon the create a new VLAN
  • Select the devices in the overview to assign them
  • Click on Apply Changes

Step 2 – Block traffic between VLANs

With the networks and VLANs created, we need to block the traffic between them. By default, devices in, for example, the IoT VLAN, can access the device in your main VLAN. Guests however are already isolated by the automatically generated firewall rules by the Isolated Network option.

There are two options to block inter-VLAN traffic, we can create custom firewall rules, or use a Traffic Rule. The latter is a lot quicker to create, but I will explain both methods.

Note During my tests, it took a couple of minutes until a traffic rule was effective. So after creating a rule, give it a couple of minutes before you test it out.

Using Traffic Rules

Ubiquiti is really promoting the use of Traffic Rules to block or allow traffic on your network. It’s indeed a bit easier, but unfortunately, we can see the firewall rules that are created in the background.

However, after some testing, we only need one Traffic Rule to block all Inter-VLAN traffic, which is a lot quicker than using firewall rules. Open Traffic Rules and click on Create Entry :

  • Action: Block
  • Category: Local Network
  • Local Network: All Local Networks
  • Traffic Direction: Traffic from all local networks
  • Device/Network: All Devices
  • Schedule: Always
  • Description: Block Inter-VLAN

unifi dynamic vlan assignment

You probably want to access your IoT device, for example, from your main (default) VLAN. To do this we can create another Traffic Rule to allow traffic from the Default network to the IoT network. Now this is where Traffic Rules become a bit confusing for most, let’s first create the rule and I will then explain it a bit:

In the Traffic Rules click on Create Entry :

  • Action: Allow
  • Local Network: IoT
  • Traffic Direction: Traffic to all local networks
  • Device/Network: Default
  • Description: Allow Default to Access IoT Devices

unifi dynamic vlan assignment

So what we have done here, is Allow all traffic from the Default network (Device/Network) to all local networks. And the local networks in this case are the select Local Network IoT.

I have only selected IoT here as local network, but you can also select the other VLANs you want to have access to from your default network.

Using Firewall Rules

We can also block the inter-VLAN traffic with custom firewall rules. This is however a bit more work compared to the Traffic Rules.

Before we can block the inter-VLAN traffic, we first need to create 3 other rules:

  • Allow established and related connections
  • Drop invalid state connections
  • Allow the main VLAN to access all VLANs

Firewall rules are located in the settings under Firewall & Security:

  • Click on Create New Rule

Create new firewall rule

We are first going to create the rule that allows all established and related sessions.

  • Type: LAN in
  • Description : Allow established and related sessions
  • Action: Accept
  • Source Type: Port/IP Group
  • IPv4 Address Group: Any
  • Port Group: Any
  • Destination Type: Port/IP Group
  • Under Advanced: select Match State Established and Match State Related
  • Apply Changes

Allow established firewall rule

The second rule that we are going to create is to drop all invalid states:

  • Description : Drop invalid state
  • Action: Drop
  • Under Advanced: select Match State Invalid

Drop invalid state

And the third rule that we need to add is to allow traffic from our main VLAN to the other VLAN. This way we will be able to manage all the devices even if they are in IoT VLAN for example.

To create this rule we will first need to define an IP Group. Port/Ip Groups allow you to easily apply a rule to multiple port numbers or IP ranges. In this case, we want to match the IP ranges of all VLANs.

  • In the settings menu, click on Profiles
  • Scroll down and click Create New under IP Groups
  • Profile name: All Private IPs
  • Type: IPv4 Address/Subnet
  • Address: 192.168.0.0/16 (this will match all addresses that start with 192.168.x.x)

Private IP Group

With the IP group created, go back to Firewall & Security and create the following rule:

  • Description : Allow main VLAN access to all VLAN
  • Source Type: Network
  • Network: Default
  • Network Type: IPv4 Subnet
  • IPv4 Address Group: All Private IPs (the IP Group that we just created

Allow main to access all VLANS

We can now create the rule that will block traffic between the VLANs. The rules that we just created will ensure that we can still access the devices in the other VLANs from the main VLAN. For this rule, we are also going to use the IP Group that we created earlier.

Click on Create New Rule in Firewall & Security and add the following rule:

  • Description : Block VLAN to VLAN
  • IPv4 Address Group: All Private IPs

Block VLAN to VLAN Unifi

We now have separated the VLANs in our UniFi network, preventing unwanted inter-VLAN traffic.

Step 3 – Block Access to Unifi Network Console from VLANs

Devices in your VLAN will need to have access to your network console (UDM Pro for example). But what we don’t want is that users (guests or IoT devices) are able to access the interface of our UniFi network console.

What we also want to prevent is that devices from IoT can access the gateway of the main VLAN.

Now this is something that should be possible with a Traffic Rule in my opinion, but honestly, I can’t get it to work. I am still waiting for an answer about this from Ubiquiti. I created the following rule, if anybody knows why this isn’t working, please drop a comment below:

  • Category: IP Address
  • 192.168.1.1 – Port 22,80,443
  • 192.168.20.1 – Port 22,80,443
  • 192.168.30.1 – Port 22,80,443
  • 192.168.40.1 – Port 22,80,443
  • Device/Network: IoT, Cameras, Guests
  • Description: Block VLANs to Gateway except Default

unifi dynamic vlan assignment

So for now, we will create a firewall rule for this. First, we need to create a couple of Port and IP Groups. Open the Profiles in the settings menu and click on Create New Group under Port and IP Groups . Create the following IP Groups:

The last Port Group that we need to create is to block only HTTP, HTTPS, and SSH access to the UniFi Network Console. The device will need to be able to access the gateway, but as mentioned, we don’t want to expose the console self.

  • Profile Name: http,https,ssh
  • Type: Port Group
  • Port: 80, 443, 22

create port group

Next, we are going to add the firewall rules. This time we will be using the type LAN Local

  • Type: LAN local
  • Description : Block IoT to Gateways
  • Network: IoT
  • IPv4 Address Group: Block IoT to Gateways

Block Gateway Access

And the rule to block access to the UDM Console. Note that we will be using the Port Group http,https,ssh here that we created earlier!

  • Description : Block IoT to UDM Interface
  • IPv4 Address Group: Block IoT Gateway Interface
  • Port Group: http,https,ssh

Block interface acces rule

Repeat the steps above but this time for the Cameras VLAN.

Assign devices to VLANs in UniFi Network

We have created all necessary rules to block inter-VLAN traffic, so all we need to do now is assign our devices to the correct VLAN in UniFi Network. For wired devices, we can assign a network to the port on the switch. And for the wireless devices, we will need to create a separate SSID.

Assign VLAN to Switch Port

By default, each switch port allows all tagged VLAN traffic. This means that if the connected device has the correct VLAN ID configured, it can access that VLAN. Which for most situations. It also allows access points or switches to pass through traffic from all VLANs if needed.

But when we have a network camera or smart home device connected to a switch, then we want to only allow access to the corresponding VLAN. The device should not be able to access any other VLAN (by changing its VLAN ID for example).

To do this, we will need to configure the Native VLAN on the port and block all tagged VLAN traffic.

In the UniFi Network console , open the new Port Manager and select your Switch . We are going to use the new Ports Manager because this will give you a create overview of all your switch ports and VLANs.

Tip By default, you can select and change multiple ports by just selecting them one after another. Mind this when you want to change another port.
  • Open the Port Manager
  • Select the Switch
  • Select a port of a camera or smart home device
  • Change the Native VLAN to the correct Network (VLAN)
  • Change Tagged VLAN Management to Block All
  • Reboot your Camera by Power Cycle the port

Assign VLAN to switch port

Change the other ports as well, assign them to the main VLAN by selecting the Port Profile LAN or another appropriate Port Profile.

Make sure that you Allow All Tagged VLAN traffic on the Uplink port (recognized by the up arrow ^) and the access points port

Assign VLAN to Wireless Devices

If you have a UniFi doorbell, for example, you might also want to assign this device to the camera’s VLAN. The problem is that we can’t set a VLAN on the doorbell itself. The same problem occurs with a lot of IoT devices, on most, you can’t configure a VLAN ID.

So the only option is to create a separate SSID (wireless network) for each VLAN and assign the wireless network to the correct VLAN.

Note We can also use Private Pre-Shared keys for this. This way you only have one SSID, but depening on the used password, a device is assigned to a different virtual network (VLAN). But I have noticed, that not all devices seem to work well with this yet, so make sure you test it out properly.
  • Open Settings and select WiFi
  • Click on Create New WiFi network
  • Enter a name and password for the wireless network
  • Change network to the correct VLAN (IoT for example)
  • Click Add WiFi network

Assign VLAN to UniFi WiFi network

You can change the WiFi connection of your UniFi Doorbell in the Protect Console > Devices > Settings > WiFi Connection.

Creating Firewall Exceptions

Sometimes you need to allow access between specific devices in different VLANs. In these cases, there are again two options to allow this. We can create a Traffic Rule or add a Firewall rule.

Using a Traffic Rule

Traffic Rules are the most convenient to use for this. We can simply create a new rule where we can select the device that we want to give access to the specified VLAN. For example, to give the LAB01 notebook access to the Default VLAN, we can create the following traffic rule:

  • Local Network: Default
  • Device/Network: <select-device>

unifi dynamic vlan assignment

Using a Firewall Rule

When using a Firewall rule, we need to create an allow rule and place the rule above the Block VLAN to VLAN rule. Let’s take the following example, allowing IoT devices to access a Raspberry PI in the main VLAN.

When you create an allow rule, try to be as specific as possible. If it’s only between two devices, then use the IP Address of both devices. If you know the protocol, then specify the port number as well.

Create a new firewall rule:

  • Type: LAN In
  • Description : IoT to Raspberry Pi
  • Destination Type: IP Address
  • IPv4 Address: 192.168.1.x

Allow access rule

Next, we will need to move the rule above the Block VLAN to VLAN rule that we have created in the beginning. You can drag and drop rules using the 6 dots at the beginning of the rule:

  • In the Firewall Rules select LAN
  • Drag the new rule above the Block VLAN to VLAN (Rule index 2003)

Drag Rules

Wrapping Up

VLANs allow you to secure your local network by making sure that devices from one VLAN can’t access the other. Because inter-VLAN access is by default allowed in UniFi, we will need to create quite an amount of rules before we can safely use it.

I hope this article helped you to set up UniFi Vlans. If you have any questions, just drop a comment below.

Rudy Mens

Hey! I'm Ruud. I work as an IT Consultant in the Netherlands and love to write about IT, Microsoft 365, PowerShell and Smart Home stuff.

You may also like the following articles

UniFi G5 Turret Ultra

UniFi G5 Turret Ultra Review

unifi dynamic vlan assignment

UniFi Protect 3.0.x Update

unifi dynamic dns

How to setup UniFi Dynamic DNS (DDNS)

174 thoughts on “how to setup and secure unifi vlan”.

Hi. Great Article, thanks.

Followed you Article on an Installation with Unifi Cameras. Created the VLANs and Rules exactly like in your Article. But as soon as I change the Native VLAN from the Default to my Camera VLAN DHCP stops working on that Port. Also my Camera VLAN WLAN cant give out DHCP Addresses. Any Idea why that happens?

Have you enabled DHCP for the Camera network?

Good afternoon Rudy ,

In your section Assign VLAN to Wireless Devices, you are explaining that If you have a UniFi doorbell, for example, you might also want to assign this device to the camera’s VLAN. The problem is that we can’t set a VLAN on the doorbell itself. The same problem occurs with a lot of IoT devices, on most, you can’t configure a VLAN ID.

My question was why not just assign these devices to the IOT network ? That way the device would connect to the right VLAN no? For example if i set my doorbel to the Camera IP of 192.168.30.1, It would pulled an IP address from that therefore be assigned to VLAN 30. At least i think it would.

If you go to device in your UniFi network console, you can select the device > settings and then under IP Settings use the virtual network override option. This way you can assign a device to a specific virtual network.

First off, I just want to show my appreciation and thank you for such a well written and comprehensive how-to article. I was confused about VLANs and using this article I was able to get everything setup. I followed ALL instructions and created the necessary VLAN and WiFi networks, and Traffice Rules when possible over Firewall rules. I did everything except for Step 3 “Block Access to Unifi Network Console from VLANs”. Has this issue with the traffic rule been resolved? If not, as with other commenters, I’m still confused why this is an issue. If an IoT device manages to get access to the default network gateway address of 192.168.1.1, I have a VERY strong password setup (24 characters long) and have 2FA setup, so rally what is the danger? My apologies but I’m still confused about this. Thanks !

There is indeed not a real danger from a IoT device. But in larger environments with guest networks for example, you just want to compeletly shield of the gateway. Security is all about adding layers, a strong password is one, seperating networks is another, and restricting access to a device is another.

Compare with securing an warehouse. You have a good lock on the door, so they won’t be able to enter the warehouse. But by placing a fence around the warehouse, they won’t even be able to access that door, so they can’t even try to open the lock.

Great article, thank you!

I had a comment/question about the “Assign VLAN to Wireless Devices” section.

You state: “So the only option is to create a separate SSID (wireless network) for each VLAN and assign the wireless network to the correct VLAN.”

It looks like if you go to Clients > > Settings there is an option for “Virtual Network Override” which seems to allow you to assign a VLAN to the client. Would this not be a valid alternative to having to create a separate SSID for each VLAN?

Yes, virtual network override can be used as well. Is has only be available since the last couple of months, and it’s not working with every device or console.

I’ve used this article recently to configure a small office, and it’s great. Thanks for the writeup! I have everything working smoothly, but one thing is still nagging me.

Your first step is to create a Traffic Rule to prevent Cross-VLAN traffic, which I did, and it works perfectly.

I have three VLAN’s – one secure, one for less-secure devices, and one Guest all on 3 different Networks, and 3 SSIDs. If I checked “network isolation” on Less-Secure and Guest hotspot, do I even need that traffic rule? Or would the secure VLAN still have cross traffic because you can’t check network isolation on your Default network?

And then to add onto that, should I even bother checking Network Isolation on those two? Does that rule take care of that?

Network isolation isolates the clients from each other on the same network. So yes, you should enable it on the guest network atleast. Guest isolation alone should work as well, but with VLANs you can also set differenent access restrictions on the network, like bandwidth limiting.

I think it’s “Device Isolation” that isolates clients from each other on the same network, “Network Isolation” is for cross VLAN traffic:

From Unifi: “Device Isolation blocks traffic between devices on the same Virtual Network (VLAN) whereas Network Isolation blocks IPv4 traffic between VLANs.”

So i’m assuming your Traffic Rule (block cross VLAN traffic) makes checking Network Isolation redundant? Your rule works great, so i’m assuming it’s not necessary. But Unifi does recommend using Network Isolation (vs Traffic/Firewall) if you are also using a Unifi Switch in conjunction with a Gateway.

No, in case of a guest network, you often want to isolate the guest devices from each other as well.

Never Mind, I got it to working with my allow airplay rule, and correct port numbers. it sometimes takes some minutes for unifi to understand new firewall rules.

Hello great instructions, but airplay is not working if I have my airplay devices on IOT network, is there any way to fix this, i also have mDNS on

Excellent article, many thanks. See, I was afraid of locking myself out of my router but you explained it nicely and showed how to prevent that from the very first rules.

I have a question around how to prevent anyone or anything self-assigning an IP in the default network. As the UDM resides on 192.168.1.1 I have vacated this subnet as much as possible but also run pi-hole and couple other components. I have turned off DHCP and limited the subnet to a /28 but I have a few gaps in that range. How do I block those IP’s from being used, say if I manually set my IP on a laptop – how to stop it from communicating on the network? There is no MAC address filtering on a network, that only exists in WiFi. Would I need to implement 802.1x, use traffic or firewall rules to effectively null the IP’s in 192.168.1.0/24?

I hope I am explaining this correctly.

Thank you for your time. Bruce

That is quite difficult to accomplish. I would create some Traffic rules for does specific IP addresses if it are a few.

Hi Rudy! Great guide. It brings a lot of new insights 🙂 One thing though: I’m confused as to why (part of) step 3 is necessary. When you already block VLAN to VLAN communication, doesn’t that include the .1 addresses of the other VLANs? (The block access to the console is clear to me). If that’s true, you’d only need to block HTTP(S) and SSL access to the gateway of its own VLAN.

Am I missing something here? Your solution seems (too) redundant.

Because the other subnets are also available on the same interface on the gateway. So we will need to block all IP addresses.

Great post, helped me a lote with my UDR. Any luck blocking Teleport VPN traffic from accesing the console admin or the main VLAN?

That is not possible at the moment. Is a known issue unfortunately.

Thanks for the very detailed HowTo’s, it helped me a lot improving overall security of my home network.

May I ask you your help (more an explanation actually…) on how I can achieve the following:

I kind of have the network layout setup according to you layout.

My default network is 192.168.2.0/24 and on the UDM-pro there are some more VLAN’s which are not relevant for my issue. I’ve setup a L2TP siste-to-site VPN server (192.168.60.0/24) to let some remote Synology NAS systems “call home”.

The clients are able to connect but it basically stops there. The remote clients are able to ping to the UDM-pro. The UDM-pro is also able to ping to the remote client and I can SSH into them, that part is fine.

However, when I try to ping from my default network (a W11 client in the 192.168.2.0/24 network) to the remote client (192.168.60.x) the requests will time out, the same happens in the other direction.

Can you point me in the right direction on how to resolve this?

Thanks in advance!

Most likely you drop all traffic coming from 192.168.60.x. Make sure that established connections are allowed.

Meanwhile I discovered that L2TP has it’s limitions on pushing routes. To make life easier I switched to the built-in OpenVPN server which pushes most part of the routes to the clients. To add missing routes you need to make some changes in the .ovpn file you can download and add them in the client config file.

Works like a charm now 🙂

To use the downloaded client configs where a Synology NAS is the client you have to remove these 3 lines:

# Downgrade privileges after initialization (non-Windows only) user nobody group nogroup

For a little more safety, change this line:

cipher AES-256-CBC

cipher AES-256-GCM

If you want a full tunnel add this in the client before the certificate part starts:

redirect-gateway def1

If you want split-tunneling don’t add that line.

If you need additional routes which aren’t pushed by the OpenVPN server running on the UDM add one or more of these lines (adapt to your needs):

route 192.168.x.0 255.255.255.0

Hi Rudy, Thanks for writing the article it’s helped a lot, but….. I don’t have a UDM, my system is based on a USG 3P and a UCK G2 Plus with a few Unifi switches and AP’s. I’m trying to connect my neighbor to my Broadband connection (he hasn’t any) using a couple of Loco M5’s in Station/AP bridge modes – that was the easy part to set up….. If I just connect the Station M5 it to my network LAN, he can see all my devices and I can see his – not a good idea!

So I’m trying to implement a separate VLAN to connect the M5 bridge to.

I’ve followed your steps and have succeeded up to a point.

If I isolate (tick the Isolation box) for his VLAN10 (192.168.10.xx) all works fine, except he can ping the USG at 192.168.10.1 – but can’t login as he hasn’t the password. So that’s OK, but as I’m on the default VLAN1 (192.168.1.xx) I can’t access the M5’s to change any settings.

So I need to implement your Step 3 – Block Access to Unifi Network Console from VLANs etc…..

But you’ve lost me I’m afraid.

Originally my Network OS was v7.xx but have upgraded to UniFi OS Version 3.2.10 which included Network OS v8.0.28. – quite an upgrade… I eventually found Traffic Rules in Security>Firewall Rules>Create Entry. but it’s not available, using the link just gives ‘UniFi is having trouble with this direction’

So I need more help with doing it using Firewall Rules please.

Thanks, Colin

Traffic rules are not supported on the USG. You will need a next-generation firewall.

Brilliant articles on UDM. It’s beneficial and up-to-date!

Thanks so much. The Traffic Rule block bug still exists for Gateways 🙂

What would i need to block if i just want to block wifi on a different vlan from accessing the main network and access to the dream machine? Thx

You would need to create a separate network for that. You can’t just block all clients connected through the WiFi.

Traffic Rules are created in the LAN-IN chain and take precedence over the LAN-IN Firewall Rules. Blocking to the Gateway IP’s requires LAN-Local rules.

I suspect this is done to prevent people locking themselves out of their controllers.

Very help-full article, thanks a lot!

How to block communication between clients in a specific VLAN?

Between all clients or between specific clients? For the first you could use network isolation and for the second you will need to make sure that the clients have a fixed IP Address. Then you can make a traffic rule for it.

I do not have access from my main vlan to devices in other vlans. I paused all rules.

Does anybody know why that is so?

Did you create the traffic rule to allow access from your main VLAN? (Allow Default to Access IoT Devices)

I am having a similar problem – I have paused the firewall rules and have created the traffic rule to allow access as stated above. Any ideas?

Thank you for this tutorial and relatively up to date screenshots (Unifi keeps tweaking) to help me with my UDR.

I followed everything you did and it works beautifully! Now when I went to allow my IoT network to my Plex sever hosted on Default I ran into issues.

I tried the Firewall Rules and placed it at the top. Tried a few different iterations of this but none of them would work. I finally tried your Traffic Rules method pointed to an IP address of my server with the port and it finally worked.

Action: Allow Category: IP Address IP Address: Device/Network: IoT Schedule: Always

I used Traffic Rules to create the blocking of VLAN traffic. So I can only think that the Traffic Rules were not playing well with the Firewall Rules for allowing certain traffic through. Thought on what I did (outlined above) and thoughts of why it may not have worked with Firewall Rules?

We can see the firewall rules created by the traffic rules, so you can’t place your firewall rule above the rule created by the traffic rule. That’s why it’s probably not working.

Your traffic rule looks fine.

Thanks for the input! It’s chugging along and got my toes submerged into it.

Hello, I used your settings for VLAN blocking. However, I need advice on one thing. I have 2 houses (different VLANs) with cameras in both. Let’s say house 1, where the NVR is located, has the IP 10.30.0.1, and house 2, where the other cameras are (connected wirelessly via AP), has the IP 10.40.0.1. In house 2, VLAN 10.30.0.1 is set on the port for cameras, but the NVR in house 1 cannot see the cameras. I’m interested in how to set up a rule or firewall so that the NVR can see those cameras.

Create a seperate VLAN for the cameras and NVR, and use that in both houses. Or alternatively, create a separate VLAN for the cameras in house 2, and use a traffic rule to allow access to and from that network to the NVR

Great article! I am new to UniFi equipment and have a question about your article. Is there a way to setup a secure/isolated network for port forwarding for hosting a game server? It looks like the guest network setup may work, but I want to make sure I have any additional steps needed. Thans for any help! Happy New Year and Best Regards, Tony

Guest network could be an option, but you can also create a new VLAN for it while making sure that you created the inter-VLAN blocking rules.

Will the traffic rules allow me to access my printer on IoT network? Right now I’m not able to an upon searching lots of people have the same issue with HP printers.

If you create the allow rule for the printer, then yes it should work.

Can I ask a vlan question regarding guest networks?

Using the 8.0 unifi console I had originally created a vlan with the “isolation” option checked and then a wifi SSID as “open” with the “hotspot” option checked. This worked but required my “guests” to login to the hotspot portal to access the network. I decided I preferred an easier approach so that guests could scan a QR code to connect to the guest network.

I left the vlan with the isolation option set but change the SSID to wpa2/wpa3 and unchecked the “hotspot” option. I then created a QR code for the SSID and all works fine. But, guests then had access to my main vlan.

Lastly, I create a couple of firewall rules. 1 to drop traffic from guest->main and 1 to drop traffic from guest->iot. This seems to work in my testing but wanted to see if I am missing anything that would cause a security leak.

Any thoughts?

You will indeed need to use firewall rules or traffic rule to block inter-VLAN traffic. I just updated the article with the required Traffic Rules for this.

Thank you for the write up. It is really helpful. Unifi now tells me to user Traffic Rules instead of the firewall rules. They seem to be easy to setup. Do you think they are better and easier than the firewall setup?

Traffic rules can problably also used, but it is basically another way to great the same rules.

Hi, Rudy. On the part “Step 3 – Block Access to Unifi Network Console from VLANs”. Are there any easier ways of doing this with 10+ VLANs? I mean … Instead of two rules for each VLAN, could it be done with a more generic rule that allowed VLAN 1 to access the UDM, but everything else for everyone else is closed? Of course they would need DHCP-respons and stuff, but DNS shouldn’t be needed (I use Quad9 and so on), and definetily not https/http/ssh from any other VLAN than default. I am going to build a dormitory network with a UAP-AC-IW in each room, with it’s own VLAN on the WLAN and outgoing ports. Each room should only need itself and Internet. No need to reach anything else. It would be quite time consuming and possible forgotten if I need to rules for each VLAN created.

I haven’t found a solution yet. I though Traffic Rules would be a solution for this, but that doesn’t seem to work when it comes to blocking http(s) and ssh access to the gateway.

Thanks for the detailed write up.

I was able to get the “block UDM gateway” as a Traffic Rule by specifying the IPs using CIDR notation like this:

192.168.1.1/32:22,80,443 192.168.20.1/32:22,80,443 192.168.30.1/32:22,80,443 192.168.40.1/32:22,80,443

I think this is a good case to change the default port for access to the gateway when an http(s) ui is enabled. It would seem to me that if you block traffic on common ports per IP (80,443) you may also block services running across that port, not just access to the console itself.

In step: Assign Port Profiles to Switch Ports, it seems the Unifi menu options have changed. The Port Insights page has changed. Should we be changing the Ports Page’s Native VLAN/Network to “Cameras”per your example and have Tagged VLAN Management set as Allow All?

I have updated the article

Just wanted to share my thanks for this write-up, was easy to follow and helped me clean up a few of my newbie-mistakes in my home setup.

I cant get Printer access to work. I have my Printer on VLAN 20 my IOT VLAN I set my IP to 10.0.20.80. Im not able to ping this IP from default. I used your rule IOT to Raspberry changing it to default to 10.0.20.80. I still can not ping my HP Printer. Any help is greatly appreciated. Ive noticed a lot of people have issue with printers.

Hi, as far as I know I followed the tutorial to the letter. I have an issue with DHCP. For example my IOT network is defined to be in the range 192.168.40.6 – 254 by the DHCP settings for that network. However, when I connecf a client (like a windows pc f.i.) it does NOT get an IP address assigned. My DHCP settings are :

DHCP mode: DHCP Server DHCP Range: 192.168.40.6 – 192.168.40.254 DHCP default gateway : tries both 192.168.40.1 as well as Auto

What could possibly be wrong and what should I verify ?

Big thanks !!!!

is the PC connected to an access port on a switch set to that same vlan? are the vlans from the unifi console trunked to the switch you are connecting it to?

Hi this realy helped me. Thank you for your hard work.

Great guide, thank you !

Question … When a IOT device sits in a specific Wifi network, assigned a VLAN ID … I see it connects to the network without issues, however the IP address of that device does not show in the Unifi Client list interface ?

Great guide , much appreciated .

Can you pls expand your guide with the steps required to route VLAN traffic through the new UniFi magic VPN. I’ve 2 sites connected via Magic VPN with Cameras on each site but one NVR in a single site only. I want to use one VLAN for all the cameras and their NVR so would this be possible with the new UniFi magic VPN as it’s very easy to setup?

I would imagine that would be policy routing approach and work around for traffic in 2 layers 2 and 3 (based on my limited understanding) , will this be possible? What are the steps to implement it?

thanks for this nice guide. Finally a guide which describes all settings on the new unifi ui.

Why is it necessary to add the Rule “Block IoT to Gateways”? Why should the IOT devices be blocked from reaching its DHCP or DNS Server?

When I add the rule I’m not able to add new tuya devices.

It should be able to access the DNS and DHCP at it’s own gateway address 192.168.40.1. We only block http, https and ssh there.

Ruud, thank you, this is an excellent article!

I don’t quiet understand two things, only concerning the “Block traffic between VLANS”: – Allow established and related connections – Drop invalid state connections – Allow the main VLAN to access all VLANs – Block VLAN to VLAN

1. For the first two rules you use as source “Any” and destination “Any”. For the fourth rule you use as source “All Private IPs” and destination “All Private IPs”. I get the logic for the fourth rule but don’t understand why the first two rules are “Any”. Wouldn’t it be enough to just use “All Private IPs” as well?

2. I do technically understand what the second rule does “Drop invalid state connections” but I don’t understand why it’s used here? Is that just a best practice thing to do?

The first question is for understanding but the second one is if particular interest to me as I see some traffic being dropped and not sure this is right, e.g. I have Apple devices in my network and they seem to want to contact Couldflare (1.1.1.1 and 1.0.0.1) and those connections are being dropped now as invalid.

Appreciate any comments. Cheers!

1. These rules also apply to connection to the internet 2. The firewall not only blocks strange or messed-up packets but also rejects any packets that don’t belong to an ongoing conversation. Think of it like this: if you were getting a file, and the transfer finished, the connection would close. So, if the server sends more data after that, the firewall sees it as odd because there’s no active talk going on. To be safe, it’s smart to have these rules to stop any weird attempts from a compromised device.

Perfect and simple example of vlan’s setting up. I doubt about iot and video restriction access to router, this case you can’t control smart homing and NVR remotely, but it can be tuned individually. What you can advice for such trlcky task: secondary wan link (ethernet) present near usw24 (not L2) switch, connection to UDM Pro via optic. There are free ethernet ports at usw24 and at udm-pro. Is it possible to build isolated trunk between ethernet ports to path trough this wan link to udm?

hello, what about trunking? what would be the configuration for having all created vlans including the management vlan trunked out of the UDM on a single port, down range to other switches trunk ports to expand my network?

You can use the port profile all for that.

After setting up VLANs and triple checking firewall rules, I have a couple of devices in my IoT network that can only be accessed remotely or from the IoT local wifi network. Shouldn’t I be able to access them from the default local wifi network, too? Feels like I missed something.

Thanks for a great article…very helpful.

First, thank you so much for the guide.

I was wondering if you could explain a bit more on why you have LAN In for some, and LAN Local for others?

LAN In rules applies to traffic the enters the LAN from the internet. LAN Local applies to traffic that comes from within your local network.

`LAN In` is from internet? Wouldn’t that be `WAN In`? Cause all the rules in this article are `LAN …` for blocking inter VLAN traffic — nothing about internet. I’m a bit confused?

The labels are indeed confusing: LAN-IN = traffic entering the LAN interface (usually sourced from clients on the LAN, but VPN traffic is also filtered here). Also traffic from the WAN interface to the LAN interface can be filtered here. LAN-OUT = traffic leaving the LAN interface (destined for the LAN clients) WAN-IN= traffic entering the WAN interface (usually sourced from anything on the internet) WAN-OUT= traffic leaving the WAN interface

I researched some more and I think I figured it out.

Conceptually, `LAN Local` is the same as `LAN In` where `destination` is the UDM itself.

But, if traffic comes in where `destination` is the UDM itself, the UDM does not trigger `LAN In` rules. Hence why those rules need `LAN Local`.

Now I get it. Thank you!

First, thanks for the article, it’s been very helpful!

Correct me if I’m wrong, but I believe the “Block VLAN to VLAN” rule you created at or near the beginning makes blocking access to the group of gateway IP’s that are in your other VLAN’s unnecessary, as they should already be blocked, right? Thus, I think the only rule needed would be the one to block http,https,ssh to the gateway interface for said VLAN.

That is what I thought too but Unifi does not trigger the `LAN In` rules for traffic destined to the router itself. Thats why you need the other `LAN Local` rules.

Hello, I wanted to ask. If port 443 and HTTP, and HTTPS are blocked, how do you connect to the unify web interface control window? Do I need to connect directly through the computer after downloading the unifi program?

Have you installed the controller on a Windows computer? Port forwarding or a firewall execption is the best option

I am a mac os user. I haven’t installed anything on my computer yet. That’s all it takes to install the controller on the computer and I’ll be able to connect? maybe you have written somewhere in your blog about creating firewall execption rules to connect to UDM?

443 is only blocked from IoT. So devices on your main/default can still access the Unifi web interface control from your LAN.

I am thinking of upgrading the home network to something more serious. I am choosing between meraki and unifi. Do you think unifi has a good enough firewall like cisco? and I wonder if cloud key2 can be connected to cisco meraki router.? if I would like to add wifi cameras.

Thank you for you opinion

I prefer UniFi. It’s easier to set up and you don’t need monthly licenses to run and configure your hardware. The firewall of UniFi is good enough for a home or small business network. You can place the cloud key behind the Meraki router.

Thank you for your reply. I’m thinking about UDM/SE, although at the moment the internet provider only offers 1GB internet speed. Maybe in a few years there will be a higher speed. Investment in the future. I’m also thinking about acces point pro, it should probably be enough for an 88 sq m apartment.

Hey Ruud, I wanted first to say that your article was very helpful and thank you! With that, I’ve found two oddities that perhaps you could provide insight into. First, when I run an external scan of my domain (strictly housed behind the UDMP running Network 7.4.150), I find that I have a ton of ports open. I’ve confirmed that I have UPnP off, so no ports are being opened for arbitrary services. I can’t figure out why they are open.

The second is regarding securing IPv6. I’d like the same VLan structure in place, along with the firewall rules to match that coincide with the IPv4 rules and VLan’s. I currently have about 40-50 devices of various types and am trying to slowly transition to IPv6. Do you have any ideas on how to approach this, or any good references that could point me in the right direction?

And you have threat management running? I don’t have any experience with IPv6 and vLANs yet.

Oh wow, perfect article to guide a beginner like me. Many, many thanks. After setting up the groups to block port 22,80,443, I can no longer SSH to a machine on the blocked network. For now, I have excluded port 22 but would rather add a rule to allow SSH from the blocked VLAN to a specific machine on my main network. Any examples?

Thank you for year great tutorial! I have tried to implement a similar setup using USG-PRO4 and UniFi Console 7.4.150, but did find that Switch port profile configuration under which you referred to as “new Ports Insights feature” was not available. There are some other differences as well. Do you know if I should be able to set up a similar solution without a UDM? If not would you be able able to point out what I need to configure different? Thank you in advance

Great article Rudy – thankyou. I guess like many who found this article I was perplexed by the “problem” that inter-VLAN traffic is allowed by default, having set up VLANs which did “nothing”. This article has saved me hours. The rules Unifi creates with the same description are indeed “Internet In”, “Internet Local”, or “…v6…” rules and cannot be edited and the detail cannot be viewed, but I could take a reasonable guess at what they do. I read a post from Unifi that suggests they cannot be edited/viewed to “…enable the best user experience” – saving us from ourselves perhaps. UDM 7.3.83, U6-LR, u6-Lite, USW-Lite-8-poe.

I followed this tutorial and everything seems to have worked – perhaps too well. I cannot access my HDHomerun Flex 4K tuners from a different VLAN. Everything I’ve read online seems to suggest a tricky situation working with HDHR devices and VLANs. Wondering if there’s a simple way for a non-IT weekend warrior like myself.

What I hope to accomplish is to regain access from my Pixel 6 (VLAN 20) to several HDHR devices (VLAN 1). Is there a firewall rule to use? I’ve tinkered without success so far. Alternately, should I consider moving the HDHR devices to a separate VLAN? Might that clear things up? I have an unused MEDIA VLAN in my network list; no devices are assigned to it yet.

Ideally, I’d like all mobile devices on VLAN 20 to have access, so if this involves a new profile/group then I’d like help with that as well.

Thanks, Robert

Would any of these rules stop internet in traffic? I set up the vlan for having a game server separated from the rest of my network but the port forwarding is still blocked after creating a rule. I can get OUT from the vlan but I can’t get in.

When configured wrong it can stop internet traffic indeed.

First off, I love this site as well as the simplicity of the information you presented on this topic. I was able to follow along on this tutorial and get firewall rules set up properly. Now my IOT network is isolated from all others on my UniFi Dream Machine Pro. Thank you! This tutorial was much easier to follow than the dozens of YouTube videos out there claiming to “make it easy”. I’m not an IT professional so all of this is sort of “weekend warrior IT” for me.

A question I have on the HTTP, HTTPS and SSH group profile. I use ports 80 and 443 to renew SSL certificates every 90 days. I have port forwarding for 80 & 443 disabled until I need to use them. Should I expect that group profile to interfere with those certificate renewals? Is disabling the profile sufficient while renewing, or can I remove ports 80 and 443 from the profile?

Thanks again! Robert

Disabling the profile (or switching the port to another profile) might be the easiest option.

I think I got the tutorial right, but from the beginning my vlan doesn’t seem to assign an ip. I have just one pc plugged into a port on the switch that is set to use this vlan (called “gaming” in my case) but it gets no ip when then pc is plugged in.

Is DHCP enabled in the vlan? If you go to network > select your gaming network, scroll down to advanced > DHCP

Thanks, got it figured out, it was my own stupidity 🙂

Hi all, thanks for useful post and comments! I have from Ubiquiti only a USW PRO 48 POE switch and the CloudKeyGen2Console. I have set the vlans (100,200,300) across the router and switch (only 1 router only 1 switch), but trying to get the printer on vlan 100 to be accessible from 200 and 300. how do I do that? tried different option but not successful so far and see in this post some functionalities are not available to me… thanks for any suggestion/feedback!

The cloudkey alone isn’t sufficient for this. You will need a router or this as well.

Can you set the printer so it’s not on a vlan and allow traffic from all three vlans to access the port the printer is on?

Thanks for the guide, I’ve gotten to blocking the UDM interface and I don’t have the option in the red box. Am I missing something or did they update the interface?

Are you sure that you have selected Destination Type : Port/Ip Group?

Ok, I followed this to the letter and verified 3 times that I made no mistakes but I can’t get any trafic between VLAN’s. I have a camera server on 192.168.1.1 (Default network) that can’t a ping a Camera that had it’s ip set via DHCP on VLAN id 30 192.168.30.217. I brought back this cam on Default LAN and I had no issue to ping it. Is there an easy way to see what firewall rules block this traffic ? (running 2.4.27)

No, unfortunately, we can’t see the firewall logs easily.

Drat, new UDM Pro, updated to version 2.4.27, a lot of this stuff looks different. I am at the step: “Next, we are going to add the firewall rules. This time we will be using the type LAN Local”, however, LAN Local is no longer an option.

The Firewall & Security Type pulldown has: Internet In, Internet Out, Internet Local, and LAN in.

Any idea which of those updated pulldown choices are equivalent to “LAN Local”?

You can scroll through the dropdown (it isn’t very clear sometimes that you can scroll)

Ok im back and have sorted out my cable issue. I thought this was resolved because I could print from my phone. I was thinking ok things are talking. I have now realized that my phone was the only device that could print. I have the firewall rule established and related but that doesnt seem to work. I also can not ping the printer. I have it wired to a static IP.

Hello Rudy, Thanks for the step by step tutorial on setting up the UDM PRO it is invaluable in understanding VLANs. It was hard finding information on how to setup VLANs on the UDM PRO until I came accross your article. However I have a consistent problem between three of these Dream Machines (UDM PRO). I followed your tutorial almost to a T on a out of the box new UDM PRO. When done with the configurations, I am not able to set the LAN ports on the UDM PRO to a specific defined network. The only option is “ALL” or “Disable” with “Default” and “Networks” grayed out under a port profile. There must be something basic in the setup that I am missing. Can you help?

Just to be sure, you can normally scroll down. Default and Networks are “headers” in the dropdown list (and indeed greyed out). So under Default, you will see All and Disable. And under Networks, you will find the network profiles that you have created (after you scrolled down).

Hello Rudy,

I spent hours trying to setup VLANs with multiple Dream machines, unlike other pull downs in the dream machine settings the one for configuring switch ports on a specific VLAN this pull down has a hard to see side scroll. Not too straight forward in my opinion. Thanks for your help

Would it be possible to achieve the same setup using the Traffic Management option (local network category)?

Good morning Ruud, Do I really need a UniFi Security Gateway or UniFi Dream Machine (UDM, UDM Pro) for creating different VLANs on my network? I hava a nighthawk R7000 router to which I attached a 16PoE lite and I have a 8 PoE lite connected to the 16 PoE switch. To the 16 Poe I connected 2 Unifi AP’s, Hue bridge and solar pannels. Doorbell, chromecast and google home mini are connected via wifi. To the 8PoE switch I connected 1 unifi AP and a desktop. Kind regards

Well, it makes it a lot easier. You can also create the VLANs on your router, and then create the appropriate wireless networks in the UniFi Controller. That should also work.

hello rudy thanks so much for this tutorial, finally beginning to understand things a little bit. followed everything step by step including firewall rules and so on everything works perfectly as far as i can see from within the wired network. the main vlan has access to all other vlans and all other vlans cannot reach the main lan and each other. so far so good. however only from the wifi assigned to the main lan i cannot access the other vlans , which should be possible ( allow main network to all vlans — source main network destination all local ip adresses ) deleted the wifi networks reinstalled them , checked the groups on faults etc etc . this drives me a little bit crazy it is probably something small but i have no idea whatsoever may be you or somebody out there can give me a hint in the correct direction thanks dank je wel paul

Do you have any write ups on creating a mgmt VLAN for access points? I don’t want my APs to use the default VLAN since we already have an AP mgmt VLAN in place. Applies to the unifi controller software on a server.

Hi, thanks for this great tutorial !

Just one thing .. when creating the networks, I have the option to select the “Network Group” … (assigned to a specific port on f.i. my USG) .. I select LAN2 Here ? (This is the 3rd port besides WAN and LAN1)

Thank You !!!!

Yes that should work

Hi, Excellent write up. Thanks. I’ve got just one question. In my main vlan (default) i have a machine which runs an application (on for example port 4333). How can i configure devices from the IoT vlan to connect the machine in the main vlan (default) by only this port?

I red you’re exceptions and tried a port group with port 4333 to the particular machine’s IP). But wasn’t succesful.

Exceptions can sometimes be a bit of a trial and error. Make sure that you order the rules correctly. And you can try to allow access first based on IP and if that works narrow it down to specific port only.

i have an UDM and have aproblem with wifi and wlan. i created a network (IOT-Devices) and enabled DHCP servicer in this network. as well i assigned a new SSID in wifi and added this to the network. I can connect with a client to this network but i won’t get an DHCP Ip address to my device. is there an additional setting to get DHCP to work

this is exactly my problem

I also have this problem. No matter if I create a Guest network or a IoT network i cant get a ip from the dhcp in that network. Have anyone found a solution for this?

Same here…. looking in other forums to see if I can find the issue.

Same here. Any solutions anywhere?

Seeing this also. Any luck? Rudy?

Just did a quick test here, and seems to work fine. But I see that I haven’t mentioned the DHCP server settings in the article. Can you please check the following:

– Open Settings > Networks – Select the IoT network – Scroll down to Advanced Configuration – Check if DHCP mode is set to DHCP Server – And the DHCP Rnage is in the same subnet as the IoT network is 192.168.40.x – 192.168.40.200 for example.

Confirmed that DHCP Server is there along with the subnet range it needs to be in.

To me it almost seems like firewall is blocking it. Do we need to let the DHCP server traffic through on UDP ports 67, 68? I would think that each network would handle its own DHCP but that doesn’t seem to be the case.

Getting no router IP and 169 address when connecting (hangs trying to connect on devices essentially)

No that should not be necessary. How is the client connected? Directly to the UDM Pro?

So it’s a UDM connected to a switch and then I have a few devices connected to that including a couple UI wifi 6 aps.

I think my issue might be the switch actually and it not handling vlan traffic. It’s a Ruckus switch and therefore I don’t think it understands the vlan traffic tagged.

That could indeed be a problem. Also, make sure that you have set the port profile to all for the connection from the UDM to the switch.

Just a heads up that swapping out the ruckus switch for a UniFi switch did the trick.

Hello, great tutorial however, when I enable Block Vlan to Vlan it cuts off all network traffic. I can’t find what I’m doing wrong? All network traffic being my AP and direct wire.

I have 5 VLANS,

(Default), Main, IOT, NOT, HA. In the Default/untagged, i have the UDR, USW, and want to set the G4 Doorbell in. (so only unifi devices) Is it a good idea to put the Doorbell into the Default LAN? And block the access of the camera to the other VLANS?

How do I allow my cameras access to the internet for remote viewing?

Do you want to allow the RTSP stream? Because you should be able to watch the camera’s through the Unifi Protect app.

I have Ring.com cameras that are blocked from accessing the internet if I use those rules. I’m not an expert but I believe it needs guest type access without the login screen

Duidelijk! nee, dat heeft de fritz.box niet. Wel een handig gast-netwerk. Dat werkt goed. Maar ik wil ook een game-pc op een aparte VLAN zetten. Dus moet ik wat gaan aanpassen.

Andere vraag: ik heb een fritz!box met 4 LAN-poorten. 1 LAN-poort is verbonden aan de Unifi Switch. Kan ik alleen VLAN’s inregelen voor apparaten achter de switch of ook voor de switch? Ik wil voor het hele huis een aantal VLAN’s inregelen. Maar ik denk dat ik dan de Switch direct achter de fritz!box moeten plaatsen en vandaar uit VLAN’s creëren?

Klopt, of je moet ook VLAN’s kunnen instellen op de Fritzbox, maar dat betwijfel ik.

hoi, ik loop vast in dit scherm met IP Group aanmaken. Als ik in type bij adress: IPv4 Adresses/Subnet krijg ik een foutmelding. Vraagt om een geldig IP of Subnet adress. Wat doe ik verkeerd?

Welke ip range heb je daar ingevuld? Meestal moet dat zijn 192.168.0.0/16

geen idee, maar nu lukte de ip range wel! Dank!

Quick question. Would i follow the same setup thru the network console if i am using the Edgerouter X SFP?

No, you will need to set up the VLANs in the EdgeRouter as well.

Thanks for the answer. Do you plan on doing a tutorial for setting up Vlan in Edgerouter X SFP?

I don’t have an edge router anymore at the moment, so probably not for now.

Excellent tutorial Ruud. I’ve followed the steps and everything is working great. I need to create a new firewall and I could use your help. I use a Synology NAS with two NIC’s. Each Synology LAN has a static ip address with one on the main LAN and the other on the IoT LAN. Unfortunately 3 VLAN’s don’t go into the two Synology LAN’s so my camera network can’t access Surveillance Station on the NAS.

Can you tell me how to create a new firewall rule in UniFi that will allow the camera VLAN 30 to access the Synology NAS using the IoT VLAN of 40? The NAS ip address on the IoT VLAN is 192.168.40.127.

Create a new firewall rule like described in Step 3, only allow instead of block.And set the appropriate network type etc

How does this still stands when enabling IPv6, and all devices get a public and local IPv6?

Also using Port 433 in firewall rules is no more allowed as of the latest beta Netwerk Application version.

Thanks Rudi for this useful guide. My current setup is ERX with Unifi AP’s – partially setup with help from your previous articles. I am using VLANS for guests, iot and ’trusted devices’ similar to your descriptions here.

I now plan to change my ERX to the Unify Dream Machine and one Unify switch. Before I do that, I just wanted to double check if can assign the Port Profiles on ports on the Dream Machine as well? Or can this only be done with ports on the switch?

I am asking because the Dream Machine is a router rather than a switch. Or is it both?

It’s both, and yes you can assign port profiles on the switch.

First I want to thank you for the excellent explanation!

But I still have a question. I don’t understand why it’s necessary to do “Step 3 – Block Access to Unifi Network Console from VLANs” when we already have blocked the access from VLAN to VLAN with a firewall rule. Can you explain it a bit more to me please?

And what is the order in which the firewall rules must be put? Is it like this: 1 Allow established/related sessions 2 Allow main VLAN access to all VLAN 3 Drop invalid state (what does it do?) 4 Block VLAN to VLAN 5 Block IoT to Gateways (why are you not making such a profile for the Guest VLAN?) 6 Block IoT Gateway Interface (why are you not making such a profile for the Guest VLAN?) 7 Block Cameras to Gateways 8 Block Cameras Gateway Interface

Last question, why do you use drop and not reject?

Thanks a lot! Tom

I agree. An excellent explanation. Good for people new to Ubiquiti and firewall rules. And I have the same question: if we have already blocked VLAN to VLAN access, why do we block access to the Unifi console from VLANs? And also, if we have already blocked VLAN to VLAN access, why block access to other VLAN gateways?

Cancel my second question as I see that we are blocking those ports for the VLAN’s own gateway. But I still have the same question as Tom regarding blocking access to other gateways when we have already blocked VLAN to VLAN access.

amazing step-by-step tutorial. thank you for taking the time to document and share it. I can’t wait to use it to setup my new unifi network

Nice article, thanks. I ran into an issue where my G3 Flex camera was shown as offline as soon as I set the relevant port on my switch to the newly created Cameras profile. This reverted after setting it to ‘All’ again. Any thoughts on this? This switch is connected to another switch first before being connected to a router, could that influence things?

Have you restarted the camera (Power cycle the port). My G3 Flex took almost 15 minutes to come back online in the right VLAN, so you might need to give it some time.

Yes I tried this, waited for 30 minutes but to no avail. I am using a CloudKey Gen2 by the way, and not the UDM (Pro). Could it possiblity be related to that?

Ah yes, you will need a USG, Dream Machine, or Dream Router.

I just updated my network to Unifi. I followed all of your instructions on this post. I can no longer control my IoT devices using the Google home app. Are these firewall rules restricting that?

They should be able to access the internet. Double check step 3

Excellent write up! Kindly thank you for your time to put this article together!

Sorry I used wrong cable. It pings on both.

I just noticed that when I ply into my main VLan I’m not longer able to ping the printer on IOT.

Im trying to set up a HP printer on my IoT network. None of my devices seem to be able to see it. Is there something special you would recommend for set up. my rules pretty much mirror yours in this article.

First, check if the printer is genuinely in the IoT network. You can do this by checking the IP Address of the printer (most printers can print out the configuration by using the buttons if you don’t have a display on the printer)

Then can you ping or access the printer from a device in the IoT network?

Yes it’s on my IOT network I verified thru UniFi interface an on printer. I can ping from my main network. I’ve read HP is tricky when put on a different VLan

Hi Rudy How to block single VLAN from Internet access, lets say NoT (IoT vlan for smart plugs/switches)?

Use the method from Step 3 but instead Type LAN local use internet out. That should block all the traffic from the selected port group to the internet. (Haven’t tested it)

Hello, I used the following rule to block vlan to other lan’s:

Drop All IoT from Local > After and Drop > Network > IoT

> Port group > All Local IP (here all my local IP addresses including all VLANS and the Untagged LAN.

Is this also correct?

Than I changed your rule “Block IoT to Gateways” to at once block all VLAN Gateways (i have 5) to http(s) and ssh:

Block All VLANs to Base Console > After – Drop > Group > All VLANs

> Group > Gateways > Ports > http(s), ssh.

To be able to connect to the main gateway i used the following:

Allow Trusted VLANs to Base Console > Accept – Before > All Trusted VLANs (main and untagged)

> Group > Gateway console (192.168.1.1) > Ports > http(s), ssh.

Does this the same but in 2 rules for all vlans instead of 1 for every vlan?

Regards, Rick

If I want to use a separate management VLAN (will be the default VLAN 1) then, when creating the firewall rules, do I have to use the managment VLAN to allow traffic to other VLAN’s? All other devices will be other VLAN’s.

Yip, thanks did indeed forget to change the new rule into “LAN in”.

Is it not sufficient to only block the Gateway ports of the subnet because there is already a rule “Block VLAN to VLAN” in place to prevents access to other VLAN’s (including their Gateway I hope)?

The block inter-VLAN rules are also to prevent broadcast requests between the VLANs for example. These can also happen on the switch level, without routing to the gateway first.

I just have my UDM and to be honest I am just a NOOB/Novice. So your article is very helpful. I noticed that some of the Firewall rules are now already predefined (version Network 7.1.66). Is there still a reason to add them anyway (like because predefined firewalls are not brows able so you can not see the exact settings?)

If the exact rule already exists then there is no need to add them again. But make sure that you check if they are also located under LAN In, for example.

Leave a Comment Cancel reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

So, about that AdBlocker... Will you consider disabling it?

Yes, ads can be annoying. But they allow me to keep writing content like this. You can also support me by Buying Me a Coffee ☕ or visit the shop to get some Tech-Inspired merchandise | Read more about disabling AdBlockers

  • Ubiquiti Networks Support
  • Grandstream Support
  • Synology Support
  • On-Demand Training

Willie Howe Technology

UniFi Radius Controlled VLANs

People always ask me about Radius Controlled VLANs. Well, let’s set them up! Having a single SSID that assigns users to a certain VLAN is easy! Follow along with the gear below!

Affiliate Links: UniFi Cloud Key Gen2 (UCK-G2): https://amzn.to/2HfK3SH UniFi Security Gateway (USG): https://amzn.to/2KGvREt UniFi Switch 8 60W (US-8-60W): https://amzn.to/2Z44Nrr UniFi Mesh Access Point (AC-M-US): https://amzn.to/2HeB2cM

Consulting/Contact/Newsletter: https://ift.tt/2yNykXn My Amazon Link: https://ift.tt/2iikL9G Add me on Fitbit: [email protected] Podcast: https://ift.tt/2P5eyRx Patreon: https://ift.tt/2NDV4me IP Video Talk 10% off: https://ift.tt/2MCmesa Private Internet Access: https://ift.tt/2jODKsT Netool: https://netool.io use code WILLIEHOWE to save at least 10%! Digital Ocean Referral Link: https://ift.tt/2kGHJYM

Contact us for network consulting and best practices deployment today! We support all Grandstream, Obihai, Polycom, Plantronics, Ubiquiti Networks, MikroTik, Extreme, Palo Alto, and more!

Come back for the next video! Twitter – @WillieHowe Instagram – @howex5

SUBSCRIBE! THUMBS-UP! Comment and Share! https://youtu.be/AJcKsGtyfHo

Willie Howe Technology

IMAGES

  1. configuration_guide_for_802_1x_vlan_assignment_and_mab

    unifi dynamic vlan assignment

  2. Segmenting Your Network with Dynamic VLAN Assignment

    unifi dynamic vlan assignment

  3. Dynamic VLAN Assignment: Wireless

    unifi dynamic vlan assignment

  4. Dynamic VLANs

    unifi dynamic vlan assignment

  5. How to Setup and Secure UniFi VLAN

    unifi dynamic vlan assignment

  6. Configuration Guide on Dynamic VLAN with the VLAN Assignment function

    unifi dynamic vlan assignment

VIDEO

  1. Subnet Based VLANs

  2. How to remove VLAN assignment

  3. Meet UniFi

  4. Part 3 of 4

  5. OpenWiFi Dynamic VLAN assignment with Radius Server

  6. How to create a VLAN in Unifi

COMMENTS

  1. Ubiquiti Unifi Dynamic Wireless VLAN Assignment - YouTube

    If you have a USG, or USG-Pro, it is possible to use the built-in RADIUS server to dynamically assign a VLAN to wireless (or wired) clients based on the MAC ...

  2. UniFi Gateway - Configuring a RADIUS Server – Ubiquiti Help ...

    Enable RADIUS Assigned VLAN Support for the types of networks desired. Assign your Users to specific VLANs. For dynamic VLAN users, set the tunnel-type to (13) and the tunnel-medium-type to (6). Note: If the user profile does not include a VLAN, the client will fall back to the untagged VLAN.

  3. Radius Dynamically Assigned VLANs Default : r/Ubiquiti - Reddit

    The lack of a default option has slowed me down in getting all of my home devices on RADIUS-assigned VLANs. Ubiquiti has done jack shit with the RADIUS server since initially adding it to UniFi. If you run FreeRADIUS, Windows NPS, or pretty much any other RADIUS server on your own, making a default option or even pattern matching based on MAC ...

  4. UniFi Network - Creating Virtual Networks (VLANs) – Ubiquiti ...

    Determine what network (VLAN) you would like to assign as the device's Management Network. Ensure that the desired VLAN is tagged on all relevant switch ports between the UniFi device and your network’s gateway. Note: Do not assign this VLAN as the Native VLAN for the switch port the UniFi device is directly connected to. This will break ...

  5. Unifi RADIUS with Dynamic VLAN using Windows NPS -- IP ...

    Hi, I’m having major issues getting IP assignment to pass over from my DHCP controller to clients that authorise and get assigned a VLAN from my NPS. I’ve researched for the past few days before posting here, both throughout the Unifi Beta Firmware post, Unifi Forums, here in SpiceWorks and in general and across the internet on Dynamic VLAN assignment setup, but there is seldom a mention ...

  6. Ubiquiti Unifi Define Default VLAN for Dynamic ... - YouTube

    This video is a follow on to a previous guide around using RADIUS to enable dynamic VLAN assignment to a Unifi wireless network (https://youtu.be/wJvv7qw0HAQ...

  7. How to Setup and Secure UniFi VLAN — LazyAdmin

    In this article. Setup UniFi VLANs. Step 1 – Create the UniFi VLAN Networks. Step 2 – Block traffic between VLANs. Step 3 – Block Access to Unifi Network Console from VLANs. Assign devices to VLANs in UniFi Network. Assign VLAN to Switch Port. Assign VLAN to Wireless Devices. Creating Firewall Exceptions.

  8. UniFi - Virtual Network (VLAN) Troubleshooting – Ubiquiti ...

    The VLAN Viewer, found in the Ports tab of UniFi Network, can help to give you a bird’s eye view of your VLAN tags. Additionally, it is helpful for finding incorrect port tagging that may disrupt connectivity in your network. Determine the VLAN having problems. Follow the path of switch ports from the problematic region back to your network ...

  9. Setup freeRADIUS + mySQL + daloRADIUS for dynamic VLAN ...

    Using the text based user files in our other freeRADIUS + Unifi = Dynamic VLAN Assignment guide works great for small installations, but in a larger or more ...

  10. UniFi Radius Controlled VLANs - Willie Howe Technology

    UniFi Radius Controlled VLANs. People always ask me about Radius Controlled VLANs. Well, let’s set them up! Having a single SSID that assigns users to a certain VLAN is easy! Follow along with the gear below! Netool: https://netool.io use code WILLIEHOWE to save at least 10%! Contact us for network consulting and best practices deployment today!