How to Configure Layer 3 Switch Routing for Inter-VLAN Traffic

How to Configure Layer 3 Switch Routing for Inter-VLAN Traffic

Last Updated: November 15, 2026

Quick Summary

Layer 3 switch routing moves packets between VLANs inside the switch itself, with no external router involved. Each VLAN gets a switched virtual interface (SVI) with an IP address that acts as the default gateway for its subnet, and the switch forwards traffic between them using its routing table. Enable IP routing and add a default route toward the upstream router to complete the setup.

  • A Layer 3 switch only routes subnets that are present in its routing table.
  • SVIs route in hardware, so they beat router-on-a-stick on throughput.
  • Create each VLAN first, then attach it to a bridge or interface.
  • Verify with three checks: SVIs up, routing table complete, then ping between VLANs.
  • A single hop that dies at the gateway points to a missing SVI.
Ready to route between VLANs?We supply Layer 3 switches, routers, and design support for routed networks.
Configure Your Layer 3 Switch

Table of Contents

What Layer 3 Switch Routing Actually Does

Layer 3 switch routing is the process of moving packets between VLANs inside the switch itself, without sending that traffic to an external router. The switch holds a routing table, and each VLAN gets its own virtual interface with an IP address. That interface becomes the default gateway for every device in the VLAN.

Here is the part most guides skip: a Layer 3 switch only routes what it knows about. If the destination subnet is missing from the routing table, the packet dies at the switch. A missing SVI or a wrong port assignment is a common cause of this failure. Below, we walk through a complete configuration from VLAN creation to verification, so you can build it once and trust it.

Layer 3 Switch Inter-VLAN Routing: How Packets Move Between VLANs

Inter-VLAN routing works like this: a host in VLAN 10 sends a packet to a host in VLAN 20. The host checks its own subnet mask, sees the destination is off-subnet, and forwards the frame to its default gateway. That gateway is the SVI for VLAN 10 sitting on the switch.

The switch receives the frame, strips the Layer 2 header, looks up the destination IP in its routing table, and rewrites the frame with the VLAN 20 gateway's MAC address. One hop. No external router involved.

SVIs vs. Physical Router Interfaces

A switched virtual interface (SVI) is a logical Layer 3 interface tied to a VLAN, and it is the standard way to route between VLANs on a multilayer switch. The alternative is router-on-a-stick: one physical router port carrying tagged subinterfaces over a trunk.

SVIs win on throughput because routing happens in hardware. Router-on-a-stick wins when you have a small network and no Layer 3 switch. If you are weighing the router-on-a-stick path, a unit like the RB5009UG+S+IN can serve that role while you plan the switch upgrade.

RB5009UG+S+IN
RB5009UG+S+IN

Layer 3 Switch Configuration Example: A Complete Addressing Plan

Every working configuration starts with an addressing plan on paper. Ours uses one Layer 3 switch, three VLANs, and an uplink to an upstream router.

A white networking router or switch with four Ethernet ports and a power jack, photographed at an angle on a transparent background.
A white networking router or switch with four Ethernet ports and a power jack, photographed at an angle on a transparent background.

VLAN and Subnet Plan

VLAN Name Subnet SVI Address Purpose
10 Users 192.168.10.0/24 192.168.10.1 Workstations
20 Voice 192.168.20.0/24 192.168.20.1 Phones
99 Management 192.168.99.0/24 192.168.99.1 Switch access
Transit Uplink 10.0.0.0/30 10.0.0.1 To upstream router

The transit subnet is the link between your switch and the router that reaches the internet. Keep it separate from user VLANs so a broadcast storm in VLAN 10 never touches your uplink.

Layer 3 switch routing commands: VLANs, Ports, and SVIs

The commands below use RouterOS syntax, which is what runs on the MikroTik switches we distribute. Other platforms use different words for the same steps, so we note the concept beside each command. The vendor's own documentation is the reference you want open while typing: MikroTik RouterOS documentation. You can also reach the MikroTik product line through our catalog for software and model details.

Creating VLANs and Assigning Ports

Create each VLAN first, then attach it to a bridge or interface.

/interface bridge add name=br0
/interface vlan add name=vlan10 vlan-id=10 interface=br0
/interface vlan add name=vlan20 vlan-id=20 interface=br0
/interface vlan add name=vlan99 vlan-id=99 interface=br0
Next, assign access ports. Each access port carries one VLAN and connects to end devices.

```routeros
/interface bridge port add bridge=br0 interface=ether2 pvid=10
/interface bridge port add bridge=br0 interface=ether3 pvid=20
A trunk port carries several VLANs to another switch or router. Tag the VLANs on that port and leave the PVID alone unless native traffic is intended.

```routeros
/interface bridge port add bridge=br0 interface=sfp-sfpplus1
/interface bridge vlan add bridge=br0 vlan-ids=10,20,99 tagged=sfp-sfpplus1
On other platforms, this is the same idea: create the VLAN, set the port mode to access or trunk, then tag the trunk.

### Building the SVI and Enabling IP Routing

Now give each VLAN an IP address. That address is the SVI, and it becomes the gateway for the subnet.

```routeros
/interface vlan set vlan10 address=192.168.10.1/24
/interface vlan set vlan20 address=192.168.20.1/24
/interface vlan set vlan99 address=192.168.99.1/24
/ip address add address=10.0.0.1/30 interface=sfp-sfpplus1
Enable routing, then add a default route toward the upstream router.

```routeros
/ip route add dst-address=0.0.0.0/0 gateway=10.0.0.2
If clients get addresses from a DHCP server elsewhere, point them at it with a DHCP relay on each SVI rather than running a second server.

## How to Verify Layer 3 Switch Routing Is Working

Verification is three checks, in order. First, confirm the SVIs are up and addressed. Second, confirm the routing table holds every subnet. Third, test with ping from a host in one VLAN to a host in another.

```routeros
/ip address print
/ip route print
/ping 192.168.20.10 src-address=192.168.10.1
If the ping fails, run a traceroute from the source host. A single hop that dies at the gateway points to a missing SVI. A reply that never leaves the host points to a wrong subnet mask or default gateway on the client.

## Troubleshooting Common Inter-VLAN Routing Failures

Most inter-VLAN routing failures come down to four mistakes. Work through them in this order and you will find the cause fast.

- **Wrong port PVID:** the access port sits in the wrong VLAN, so the host reaches the wrong gateway.
- **Missing SVI:** the VLAN exists but has no IP address, so nothing answers for that subnet.
- **IP routing disabled:** the switch forwards within VLANs but drops traffic between them.
- **No return route:** the upstream router does not know your internal subnets, so replies never come back.

Watch out: a host with the right gateway but the wrong subnet mask will try to reach a remote subnet directly, and the packet never reaches the switch.

## Choosing a Layer 3 Switch for Your Deployment

Pick the switch by port count, uplink speed, and whether you need PoE. That is the whole decision, and everything else is detail.

For a 24-port access layer with 10G uplinks, the [CRS326-24G-2S+RM](/products/crs326-24g-2s-rm) gives you 24 Gigabit ports and two SFP+ cages in a 1U rackmount case, with dual boot between RouterOS and SwOS. If your access points need power from the switch, the [CRS328-24P-4S+RM](/products/crs328-24p-4s-rm) adds 24 PoE ports with 802.3af/at auto-sensing alongside four SFP+ ports. For a fiber aggregation layer, the [CRS317-1G-16S+RM](/products/crs317-1g-16s-rm) offers 16 SFP+ cages and a dedicated management port.

A common mistake is buying the aggregation switch first. Size the access layer to your port count, then pick the uplink.

---

Routing between VLANs is where most networks quietly break, and it usually fails on a single missing SVI or a mislabeled port. BI-DISTRIBUTION supplies the switches that make this configuration straightforward, backed by network design and deployment support from a team with over 10 years of experience as a master distributor of MikroTik. Our MikroTik Wholesale lineup offers MikroTik networking equipment for these deployments. Get started with BI-DISTRIBUTION and build a routed network you can verify line by line.


<section style="margin:3rem 0 2rem 0;" itemscope itemtype="https://schema.org/FAQPage"><h2 style="font-weight:700; margin:0 0 4px 0;">Frequently Asked Questions</h2><div style="padding:20px 0; border-bottom:1px solid #e5e7eb;" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question"><h3 style="font-weight:600; margin:0 0 8px 0;" itemprop="name">Can a Layer 3 switch route between VLANs without an external router?</h3><div style="line-height:1.7;" itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer"><p itemprop="text" style="margin:0;">Yes. A Layer 3 switch creates a switched virtual interface (SVI) for each VLAN, assigns it an IP address and subnet mask, and uses those interfaces as the default gateway for hosts in that VLAN. With IP routing enabled, the switch forwards packets directly between VLANs at wire speed. You only need an external router when traffic must leave the local network toward the internet or a WAN, and even then a default route on the switch pointing to the router handles it.</p></div></div><div style="padding:20px 0; border-bottom:1px solid #e5e7eb;" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question"><h3 style="font-weight:600; margin:0 0 8px 0;" itemprop="name">What is the difference between a Layer 2 and Layer 3 switch for inter-VLAN routing?</h3><div style="line-height:1.7;" itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer"><p itemprop="text" style="margin:0;">A Layer 2 switch forwards frames within a single VLAN and cannot move traffic between subnets on its own. A Layer 3 switch, sometimes called a multilayer switch, adds a routing engine and routing table so it can forward packets between VLANs using SVIs. In practice, a Layer 2 switch needs a one-armed router or a firewall to route between VLANs, while a Layer 3 switch does the job internally with lower latency and no uplink bottleneck.</p></div></div><div style="padding:20px 0; border-bottom:1px solid #e5e7eb;" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question"><h3 style="font-weight:600; margin:0 0 8px 0;" itemprop="name">How do I configure a default route on a Layer 3 switch?</h3><div style="line-height:1.7;" itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer"><p itemprop="text" style="margin:0;">Add a static default route that points to the next-hop address of your upstream router, for example ip route 0.0.0.0/0 10.0.0.1 on RouterOS-based equipment or ip route 0.0.0.0 0.0.0.0 10.0.0.1 on Cisco-style CLI. The next hop must sit on a subnet the switch can reach, usually a transit link or the management VLAN. After adding it, run a traceroute to an external address to confirm the switch is forwarding traffic off-network.</p></div></div><div style="padding:20px 0; border-bottom:1px solid #e5e7eb;" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question"><h3 style="font-weight:600; margin:0 0 8px 0;" itemprop="name">How do I verify Layer 3 switch routing is actually working?</h3><div style="line-height:1.7;" itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer"><p itemprop="text" style="margin:0;">Check the routing table first to confirm connected routes for each SVI and the default route are present. Then ping from a host in one VLAN to the SVI address of another VLAN, and ping between hosts in different VLANs. Use traceroute to confirm the switch is the first hop, and check interface counters for drops. If pings fail but the routing table looks correct, the usual culprits are a missing trunk port, an access port assigned to the wrong VLAN, or a host with the wrong default gateway.</p></div></div></section>