Overview
This article explains how to enable the L3 Routing feature on supported UniFi Switches.
- This article applies exclusively to UniFi Switches that support the Layer 3 Routing feature.
- The product specifics on the UI Store will indicate whether a UniFi switch model supports the feature.
- Examples of UniFi switches that support L3 Routing are the USW-Pro-24-PoE and USW-Aggregation-Pro.
- This article applies to UniFi Network application v5.13.9 and above.
- The instructions below are geared toward networks where the gateway router is a UniFi OS Console or UniFi Security Gateway (USG). It is also possible to use a third party gateway router, but note that our Support team cannot fully troubleshoot issues involving third party devices.
Table of Contents
Introduction
The Layer 3 Routing feature improves routing performance on large networks, offloading the inter-VLAN routing effort from the gateway resulting in a higher speed and lower network latency. In the topology example below, Layer 3 Routing is enabled on the USW-Pro-24-PoE allowing the VLAN110 and VLAN120 clients to directly communicate through the switch. For the LAN and VLAN100 clients that connect to the Layer 2 USW-24-PoE switch, the traffic is routed through the UniFi OS Console instead.
Network Diagram
How to Enable the L3 Routing Feature
The L3 Routing feature is enabled by configuring a network with the UniFi switch set as the gateway router. Following the topology example, the VLAN110 and VLAN120 networks will use the USW-Pro-24-PoE as the gateway router, whereas the LAN and VLAN100 networks will use the UniFi OS Console.
Follow the steps below to create a new network:
1. Open the UniFi Network application and navigate to the Settings > Networks section.
2. Create a new network by selecting the Add New Network option.
3. Provide a name for the network
4. Select the appropriate UniFi Switch in the Router field.
5. Expand the Advanced options and specify the VLAN ID.
6. If needed, customize the DHCP settings and specify an IP range by unchecking the Auto Scale Network option.
Once the network with a UniFi switch set as the gateway router is created, an additional network is created automatically with the Inter-VLAN routing name. This network is used to route the traffic between the UniFi OS Console and UniFi switch with L3 Routing enabled. The network is assigned the 10.255.253.0/24 IP range and uses VLAN4040. The UniFi OS Console and UniFi switch will automatically create the necessary routes reach the networks present on the switch (including the default gateway route).
When all the networks from the topology example are added, the following networks will be listed in the Settings > Networks section. Note that the Layer 2 networks use the UniFi OS Console as the gateway router (Router column) and the Layer 3 networks use the USW-Pro-24-PoE.
Using a third party gateway router
- Configure a VLAN Virtual Interface (VIF) and tag VLAN4040.
- Assign the 10.255.253.1/24 IP address to the interface.
- Create static routes for the networks that are present on the L3 UniFi switch and set 10.255.253.2 as the next-hop. Note that this is the IP address assigned to the USW and that it will change when multiple L3 switches are used.
- In this example, static routes for 192.168.110.0/24 and 192.168.120.0/24 to 10.255.253.2 are needed.
When using an EdgeRouter instead of a UniFi gateway and following the topology example, the below configuration is needed:
configure
set interfaces ethernet eth1 vif 4040 address 10.255.253.1/24
set protocols static route 192.168.110.0/24 next-hop 10.255.253.2
set protocols static route 192.168.120.0/24 next-hop 10.255.253.2
commit ; save
The eth1 interface is the one connected to the L3 UniFi switch and can differ depending on the network setup. Refer to the EdgeRouter - Create Virtual Interfaces with VLAN IDs and EdgeRouter - How to Add a Static Route articles for more information.
Related Articles
UniFi - Using VLANs with UniFi Wireless, Routing & Switching Hardware