Router Charts

Click for Router Charts

Router Ranker

Click for Router Ranker

NAS Charts

Click for NAS Charts

NAS Ranker

Click for NAS Ranker

More Tools

Click for More Tools

LAN & WAN How To

Layer 3 Switching

Introduction

As your network grows, you may have decided to use VLANs to improve network performance and/or network security. VLANs are a Layer 2 technology and are supported on many Layer 2 switches, such as the TPLINK TL-SG2216, TRENDnet TEG-160WS, and the NETGEAR GS108T.

A best practice with VLANs is to use different network addresses for devices in each VLAN. For example, you might use IP address ranges, also known as subnets, such as 192.168.1.0 for devices in VLAN 1 and 192.168.2.0 for devices in VLAN 2, and so on. One of the challenges with using a Layer 2 switch and VLANs with different subnets is your router needs multiple LAN interfaces or has to support VLAN tagging and trunking so you can route between VLANs.

This is where a Layer 3 switch comes in handy. A Layer 3 switch can perform IP routing tasks as well as Layer 2 tasks such as VLANs. Moreover, a Layer 3 switch can typically route faster than a router, improving network performance. Futher, since the Layer 3 switch can route between VLANs, you can use a basic router that doesn't support VLANs.

The OSI Model

The OSI model is a conceptual model that groups communication system functions into layers of abstraction. The Layer 3 that we refer to in this article is sometimes called the "Routing" layer.

OSI Model
  Data unit Layer Function
Host
layers
Data 7. Application Network process to application
6. Presentation Data representation, encryption and decryption, convert machine dependent data to machine independent data
5. Session Interhost communication, managing sessions between applications
Segments 4. Transport End-to-end connections, reliability and flow control
Media
layers
Packet/Datagram 3. Network Path determination and logical addressing
Frame 2. Data link Physical addressing
Bit 1. Physical Media, signal and binary transmission

In this article, I'm going to walk you through setting up a network with three VLANs, each using different subnets, and configuring a Layer 3 switch to route between those subnets. I'm going to use a basic small network router that doesn't support VLANs, the Linksys WRT310N, and the recently reviewed NETGEAR M4100-D12G Layer 3 switch.

Before I do my configurations, I find it best to plan what I'm going to do. Write down how many VLANs you're going to use, the numbers for each VLAN, and the IP address range (subnet) you're going to use for each VLAN. Within each subnet, identify the addresses that will be used for the default gateway and DNS server(s). Also, determine if you're going to use DHCP or static addressing in each VLAN.

Below is a chart with the details of my plan. I've set up three VLANs, identified my VLAN IDs, subnets, default gateway IPs, and DNS IPs. I choose these subnets and VLAN IDs as my network is already using the 192.168.199.0 subnet on VLAN 1. The IP address of 192.168.199.254 was not used, so I'm going to use that as a VLAN interface address on the Layer 3 switch. VLAN 7 and 8, along with the 192.168.7.0 and 192.168.8.0 subnets were also not in use on my network, thus they are available for me to use for this test. With this chart, I can now configure the network.

VLAN ID Subnet Default Gateway/VLAN Interface IP DNS
1 192.168.199.0/24 192.168.199.254 192.168.199.1
7 192.168.7.0/24 192.168.7.254 192.168.199.1
8 192.168.8.0/24 192.168.8.254 192.168.199.1
Planning Table

Step 1

Before you configure the Layer 3 switch, create static routes in the gateway router to each of the new subnets. In this example, my gateway router uses a LAN subnet of 192.168.199.0, so I need to create static routes on the router to the 192.168.7.0 and 192.168.8.0 subnets.

Static Routes on a Router

Static Routes on a Router

Note, some Layer 3 switches may support using routing protocols such as RIP or OSPF. If that's the case, you might be able to enable the routing protocol on both the router and switch, and the routes will automatically be discovered. The M4100 does not support routing protocols, so I manually entered static routes.

Step 2

Log into your Layer 3 swtich management interface. The first step on the Layer 3 switch is to enable IP routing. On the M4100, IP routing is disabled by default. Enabling it is just a click as shown below.

Enable IP Routing

Enable IP Routing

Step 3

Create the VLANs on the Layer 3 switch and assign ports to each VLAN. As you can see below, I've added VLANs 7 and 8.

Create VLANs

Create VLANs

I've also assigned ports to each VLAN...

VLAN Ports

VLAN Ports

... and set the PVID on the ports to match their VLAN ID.

VLAN PVIDs

VLAN PVIDs

Note, I set the switch ports as untagged members of each VLAN as I'm not connecting to another VLAN aware device, thus I don't need to use VLAN tagging.

Untagged VLAN

Untagged VLAN

More LAN & WAN

Wi-Fi System Tools
Check out the new Wi-Fi System Charts, Ranker and Finder!

Featured Sponsors


Win This!

TRENDnet TPL-430APK WiFi Everywhere Powerline 1200 AV2 Wireless Kit

You could win a TRENDnet TPL-430APK WiFi Everywhere Powerline 1200 AV2 Wireless Kit

Learn How!

Support Us!

If you like what we do and want to thank us, just buy something on Amazon. We'll get a small commission on anything you buy. Thanks!

Over In The Forums

ASUS ROG RAPTURE GT-AC5300 vs NETGEAR R7800 Nighthawk X4S: #1 vs #2 on the router ranking. Which one would you buy?
For starters, I am completely new to this. However I can follow instructions, or guides without hand holding =)My overall objective is to replace Cent...
Hi,I've flashed 4 TM-AC1900 (t-mobile version) to RT-AC68U. It shows the router as a ASUS RT-AC68U at the top left header using both the ASUS and Merl...
I decided to log into my router admin page to see if there were any updates. I then checked my clients and noticed that there was an ip / MAC address ...
I'm running Asuswrt-merlin 382.1_2 (though I've noticed the issue over pretty much all versions I've run). Even with Set AP Isolated disabled, I'm hav...

Don't Miss These

  • 1
  • 2
  • 3
Get Backblaze Now!