EdgeRouter - Configure an EdgeRouter as a Layer 2 Switch


Overview


In this article the reader will learn the steps needed to configure an EdgeRouter X, X-SFP, or EdgePoint R6 as a Layer 2 switch with the option for the switch ports to be VLAN aware. 

NOTES & REQUIREMENTS:
This article is applicable to the latest EdgeOS firmware and the following models: EdgeRouter X, EdgeRouter X-SFP, and EdgePoint R6.

 

The latest EdgeOS firmware includes a built-in Wizard labeled "Switch" to easily configure the EdgeRouter as a Layer 2 switch including the option to make the switch ports VLAN aware. We have included the manual method for those users running an older EdgeOS version. We recommend always updating to the newest firmware available.


Table of Contents


  1. Switch Wizard Configuration (recommended)
  2. Manual Configuration
  3. Related Articles

Switch Wizard Configuration (recommended)


Back to Top

GUI: Access the EdgeRouter Management Interface, and go to Wizards > Switch. Fill in the configuration as instructed below.

1. Management Access: By default the management IP will be obtained from DHCP, you may optionally set this to a static IP.

Management VLAN: unchecked
Management IP: DHCP


2. VLAN Aware 

Enabled: checked

3. Switch Ports: The example settings below will enable the switch to be VLAN aware. In this example:

eth0: Devices will get an ip from VLAN 10 and have access to VLAN 20.

eth1: Devices will get an ip from VLAN 10 and have access to VLAN 20 and 30.

eth2: Devices will get an ip from VLAN 20 and have access to VLAN 10 and 30.

eth3-4: Devices will get an ip from VLAN 20 and have access to VLAN 10.

eth5: Uplink EdgeRouter gets an IP from VLAN 1 upstream and passes VLANs 10, 20, and 30.

switchvlan.png

NOTE:
The PVID (Port VLAN-id) and VID (VLAN-id) settings define whether a port is untagged (pvid) or tagged (vid) for a specific VLAN. Only a single value can be entered under PVID, whereas VID supports multiple values. A tagged port can also be configured with a value under PVID (using a different value than the one under VID). In this case the VLAN configured under PVID will become the native VLAN. In the example above, eth5 may be the uplink to a router where the EdgeRouter gets an IP from VLAN 1 and passes all traffic from VLANs 10, 20, and 30.

4. User Setup: It is important to update the default user password or create a new user with a unique password to protect your device.

Use Default User:
Create New Admin User:
Keep Existing Users:


Manual Configuration (older EdgeOS versions)


Back to Top

ATTENTION:
It is recommend to use the instructions outlined in the Switch Wizard Configuration section above to configure an EdgeRouter as a Layer 2 Switch. Below you will find the manual instructions to accomplish this on early firmware versions before the switch wizard was added. Click the title below to expand the full article.
Click here to expand full article about how to manually configure an EdgeRouter as a Layer 2 Switch for older EdgeOS versions.

Table of Contents


Step 1: Connect to Device

Step 2: Add Address and Ports to switch0

Step 3: Connect to switch0

Step 4: Remove address from eth0

Step 5: Add eth0 to switch0 

How to Configure the EdgeRouter as a Layer 2 Switch via CLI Commands

User Notes and Tips

 

Step 1: Connect to Device


1.1 With the device in factory default state, connect your computer to eth0. Make sure that your system has an IP in the 192.168.1.x subnet. (e.g. 192.168.1.11).

1.2 Enter https://192.168.1.1 in your web browser and log into the device using the default ubnt/ubnt username and password. (It is always good practice to change the default username and password to one of your choosing.)

 

Step 2: Add Address and Ports to switch0


2.1 Click on Actions > Configure for the switch0 interface on the Dashboard of the device.

2.2 Change Address to Manually define IP address.

2.3 Enter 192.168.2.1/24 (or similar) in the address field.

2.4 Check all of the ports with the exception of eth0.

Note: Finish the remaining steps to add eth0 to switch0.

 

 

Step 3: Connect to switch0


3.1 Plug your computer into eth1, or any port which has been assigned to switch0 in Step 2.

3.2 Enter https://192.168.2.1 in your web browser and log into the device using your username and password. You will need to change your computer IP address to something in the same subnet such as 192.168.2.11.

Note: If you choose to assign switch0 a different address than this example you would enter that address to access the device.

 

Step 4: Remove address from eth0


4.1 Click on Actions > Configure for eth0.

4.2 Change address to No address.

4.3 Click Save.

 

Step 5: Add eth0 to switch0


5.1 Click Actions > Configure for switch0.

5.2 Check eth0 under Switch Ports.

5.3 Click Save.

This completes the steps to allow these devices to act as a layer 2 switch on all ports.

 

 How to Configure the EdgeRouter as a Layer 2 Switch using CLI Commands


The following steps can be followed to configure the EdgeRouter as a Layer 2 Switch using the CLI Commands.

1. Connect to the router CLI.

2. Configure switch0 and add ports.

configure
set interfaces switch switch0 switch-port interface eth1
set interfaces switch switch0 switch-port interface eth2
set interfaces switch switch0 switch-port interface eth3
set interfaces switch switch0 switch-port interface eth4
set interfaces switch switch0 address 192.168.2.1/24
commit
save
exit

3. Plug your computer into eth1 or any port which has been assigned to switch0.

4. Reconnect to the CLI for the device at 192.168.2.1.

5. Remove address from eth0 and assign eth0 to switch0.

configure
delete interfaces ethernet eth0 address
set interfaces switch switch0 switch-port interface eth0
commit
save
exit

 

User Notes & Tips


These notes have been added thanks to user collaboration. Have anything to contribute? Click on the Give Feedback button below!

  • QoS will only work in Router Mode. 

 


Related Articles


Back to Top

EdgeRouter - Beginners Guide to EdgeRouter