EdgeRouter - Configure an EdgeRouter as a Layer 2 Switch
Overview
Readers will learn how to configure an EdgeRouter with a switch-port module as a (VLAN Aware) Layer 2 switch.
Table of Contents
- Using the Wizard to Automatically Configure the Switch
- Manually Configuring the Switch Functionality
- Related Articles
Using the Wizard to Automatically Configure the Switch
The latest EdgeOS firmware includes a built-in wizard to easily configure the EdgeRouter as a Layer 2 switch and includes a VLAN Aware option.
1. Connect an Ethernet cable from a computer to the eth0 interface on the EdgeRouter.
2. Configure a static IP address on your computer in the 192.168.1.0/24 range (for example 192.168.1.11).
3. Open a Web Browser and enter https://192.168.1.1 in the address bar.
4. Log into the router using the default credentials.
Username: ubnt
Password: ubnt
5. Configure the switch0 interface and provide it with an IP address.
6. Navigate to the Wizards tab and run the switch wizard.
Wizards > Switch
7. Define the management access settings for the router. The available options are:
-
Management VLAN
Optionally set the VLAN ID which is used for the management traffic. -
DHCP
Use this option to receive an address via DHCP. -
Static
Use this option to configure a static IP address. -
Username
Set to ubnt by default. We strongly recommend that you configure your own user account with a strong password.
8. Configure the EdgeRouter as a VLAN Aware switch. The available options are:
-
pvid
Untags a certain VLAN on a switch-port. Supports only a single value per interface. -
vid
Tags a VLAN or multiple VLANs on a switch-port. Supports multiple values per interface.
9. Apply the changes and reboot the router when prompted.
The example below enables the VLAN Aware feature and defines the following VLAN switch port settings:
-
eth0
Untagged for VLAN10. -
eth1
Untagged for VLAN20. -
eth2
Untagged for VLAN30. -
eth3
Untagged for VLAN40. -
eth4
Tagged for VLAN20,30,40 with untagged (native) VLAN10. -
eth5
Tagged for VLAN20,30,40 with untagged (native) VLAN10.
VLAN Aware: Enabled
eth0: pvid 10
eth1: pvid 20
eth2: pvid 30
eth3: pvid 40
eth4: pvid 10
vid 20,30,40
eth5: pvid 10
vid 20,30,40
Manually Configuring the Switch Functionality
1. Connect an Ethernet cable from a computer to the eth0 interface on the EdgeRouter.
2. Configure a static IP address on your computer in the 192.168.1.0/24 range (for example 192.168.1.11).
3. Open a Web Browser and enter https://192.168.1.1 in the address bar.
4. Log into the router using the default credentials.
Username: ubnt
Password: ubnt
5. Configure the switch0 interface and provide it with an IP address.
Dashboard > switch0 > Actions > Config
Address: Manually define IP address
IP: 10.0.0.1/24
6. Associate the switch0 interface with the relevant switch-ports, excluding the eth0 interface.
Dashboard > switch0 > Actions > VLAN
VLAN Aware: Unchecked
eth0: Unchecked
eth1: Checked
eth2: Checked
eth3: Checked
eth4: Checked
eth5: Checked
7. Replug the computer from the eth0 interface to one of the other switch-port interfaces.
8. Change the static IP on your computer to an address in the 10.0.0.0/24 range (for example 10.0.0.11).
9. Open a Web Browser and enter https://10.0.0.1 in the address bar.
10. Remove the IP address from the eth0 interface.
Dashboard > eth0 > Actions > Config
Address: No address
11. Associate the switch0 interface with the eth0 interface.
Dashboard > switch0 > Actions > VLAN
eth0: Checked
Related Articles
EdgeRouter - Beginners Guide to EdgeRouter
EdgeRouter - VLAN-Aware Switch
EdgeRouter - Create Virtual Interfaces with VLAN IDs
Intro to Networking - How to Establish a Connection Using SSH