Behind the complaint “ping works but the application doesn’t connect” there’s often a default gateway placed in the wrong spot. Segments separated by VLANs need a layer 3 device to talk to each other; whether this device is a router, an L3 switch or a firewall determines performance, scale and where security policy is applied. Below we compare three approaches, give Cisco IOS configuration examples, and show how to catch gateway redundancy and asymmetric routing traps in the field.
Inter-VLAN routing options
Each VLAN is a separate IP subnet; an end device turns to its default gateway to reach another subnet. The real design question is where this gateway will sit:
| Approach | Routing | Strength | Limit |
|---|---|---|---|
| Router-on-a-stick | Router subinterfaces | Simple, an L2 switch is enough | Single trunk and router capacity |
| L3 switch SVI | In hardware, at line rate | High performance, scale | Limited policy beyond ACLs |
| Firewall | Firewall interfaces | Stateful policy, logging | Capacity and cost |
| Mixed model | SVI + firewall transit | Balance of performance and policy | Requires design discipline |
How segments are separated is a separate topic, explained in the VLAN design in enterprise networks guide; here we assume the segments are already defined.
Router-on-a-stick: when is it enough?
In this method there’s a single 802.1Q trunk between the router and the switch. The router’s physical interface is split into a subinterface for each VLAN:
interface GigabitEthernet0/0/1
no ip address
!
interface GigabitEthernet0/0/1.10
description USERS
encapsulation dot1Q 10
ip address 10.10.10.1 255.255.255.0
ip helper-address 10.10.50.10
!
interface GigabitEthernet0/0/1.20
description VOICE
encapsulation dot1Q 20
ip address 10.10.20.1 255.255.255.0
!
interface GigabitEthernet0/0/1.999
encapsulation dot1Q 999 native
The limitation comes from the architecture itself: a packet going from VLAN 10 to VLAN 20 goes out the trunk to the router and comes back from the router over the same trunk. The trunk carries the same traffic twice, and all traffic between VLANs is limited by the router’s forwarding capacity. Worked example: on a 1 Gbps full-duplex trunk, if a client in VLAN 10 copies from a file server in VLAN 20 at 700 Mbps, this flow uses the trunk twice: 700 Mbps from the switch to the router (with the VLAN 20 tag), and again 700 Mbps from the router to the switch (with the VLAN 10 tag). Because downloads from the internet also use the same router-to-switch direction, about 300 Mbps is left for all users in that direction while the copy is running.
A single file copy slows down the whole branch.
Still, in small branches with a few VLANs, where traffic between VLANs is very low and most traffic goes to the WAN, it’s a sufficient and economical solution.
Routing configuration with L3 switch SVIs
An L3 switch routes packets between VLANs in hardware, on the ASIC. An SVI (Switch Virtual Interface) is defined for each VLAN; the SVI is that VLAN’s default gateway. The basic configuration during core or distribution switch installation is:
ip routing
!
vlan 10
name USERS
vlan 20
name VOICE
!
interface Vlan10
description USERS-GW
ip address 10.10.10.1 255.255.255.0
ip helper-address 10.10.50.10
no shutdown
!
interface Vlan20
description VOICE-GW
ip address 10.10.20.1 255.255.255.0
ip helper-address 10.10.50.10
no shutdown
!
! L3 link to the firewall: routed port
interface TenGigabitEthernet1/1/8
description TRANSIT-FW
no switchport
ip address 10.255.0.2 255.255.255.252
!
ip route 0.0.0.0 0.0.0.0 10.255.0.1
Points to watch:
ip routinggets forgotten. On some platforms it’s off by default; while it’s off, the switch doesn’t route between SVIs, and VLANs can’t reach each other even if the SVIs show up.- SVI autostate: For an SVI to be up, the VLAN must exist and at least one port in the VLAN must be up/forwarding.
- Preferring a routed port: For the link to a firewall or another L3 device, using a routed port with
no switchportinstead of a transit VLAN + SVI keeps STP out of this link and detects failures faster. ip helper-address: Besides DHCP, it also forwards some other UDP services by default (such as DNS, TFTP, NetBIOS name/datagram). If they aren’t needed, disable the relevant ports withno ip forward-protocol udp. The details of relay behavior are in the DHCP relay and DHCP snooping article.
What an L3 switch can’t do is stateful security policy. You can restrict access between VLANs with ACLs; but ACLs don’t track session state, don’t see the application layer and don’t produce detailed logs. Before making access decisions between segments, clarify the security boundary through the difference between VLANs and network security.
Routing and the policy point on the firewall
Giving the gateway of all VLANs to the firewall means every flow between segments passes through a policy rule. The gain is clear: session-based control, application recognition, user-based rules, central logging. The price is capacity. East-west traffic within the campus (file sharing, backup, virtualization) strains the firewall’s processing capacity and session table.
In practice, the most commonly applied model is mixed:
- User, voice and printer VLANs at the same trust level are routed on the core L3 switch; if needed, restricted with ACLs.
- The gateway for segments at different trust levels, such as servers, management, guest and OT, is on the firewall.
- There’s a transit link between the core and the firewall; the route from the core to the networks behind the firewall points to the firewall.
Designing the rule set between segments is security policy work and is covered in the microsegmentation policy guide.
Default gateway redundancy: HSRP and VRRP
If there are two distribution or core switches, no VLAN’s gateway should depend on a single device. HSRP (Cisco-specific, version 1 documented in RFC 2281) and VRRP (version 3, RFC 5798) let two devices share a common virtual IP and virtual MAC address. The end device knows only the virtual IP as its gateway.
| Feature | HSRP | VRRP |
|---|---|---|
| Standard | Cisco-specific | IETF (RFC 5798) |
| Default priority | 100 | 100 |
| Preempt default | Off | On |
| Virtual IP | A separate address | A separate address or the device’s own address |
| Default timers | Hello 3 s, hold 10 s | Advertisement 1 s |
! DIST-SW1 - active for VLAN 10
track 1 interface TenGigabitEthernet1/1/8 line-protocol
!
interface Vlan10
ip address 10.10.10.2 255.255.255.0
standby version 2
standby 10 ip 10.10.10.1
standby 10 priority 110
standby 10 preempt
standby 10 track 1 decrement 20
!
! DIST-SW2 - standby for VLAN 10
interface Vlan10
ip address 10.10.10.3 255.255.255.0
standby version 2
standby 10 ip 10.10.10.1
standby 10 priority 100
standby 10 preempt
In HSRP, preempt is off by default; if it isn’t explicitly configured, a device returning from a failure doesn’t take back the active role. With track, the priority of a device that loses its uplink is lowered and the active role moves to the other device. The active gateway and the STP root of the relevant VLAN should be on the same device; otherwise traffic needlessly loops between the two distribution switches. VRRP configuration syntax varies across IOS and IOS XE versions; go by the guide for the version you use. If you use a stack or virtual stack, these protocols aren’t needed because it’s a single logical device; details are in the stack, MLAG and vPC comparison.
Asymmetric routing and stateful devices
Asymmetric routing is when outbound and return packets take different paths. For routers and L3 switches it’s mostly not a problem; for a firewall that tracks session state, it means the connection drops outright. If a firewall sees only the return packet of a session (a SYN-ACK arrives without having seen the TCP SYN), it drops the packet.
The scenario we come across most often in enterprise campus networks is this: the server VLAN’s gateway is on the firewall, but an SVI with an IP address for the same VLAN has also been left on the core switch for management purposes. A packet from a user VLAN to the server reaches the server without passing through the firewall because the core finds a directly connected route. The server’s reply, however, goes to the firewall, its default gateway; the firewall doesn’t recognize the session and drops the reply. The symptom is typical: ping works, the application doesn’t connect.
A single forgotten SVI is enough.
- A VLAN’s gateway is in one place: either on the core or on the firewall.
- Don’t leave an SVI with an IP address on the core for VLANs behind the firewall; provide management access from a separate management VLAN.
- If there are two firewalls or two internet exits, ensure through route design that the return path comes to the same device, and verify it by testing.
Selection table and verification commands
A short decision framework:
- If there are few VLANs, traffic between VLANs is low and there’s no L3 switch: router-on-a-stick.
- If there’s campus scale and heavy east-west traffic: SVIs at the core/distribution, and HSRP/VRRP or a stack if there are two devices.
- If there are segments at different trust levels: the gateway for those segments on the firewall, the rest on SVIs.
- If there are many L3 devices and multiple buildings: OSPF design in a campus network should be considered for dynamic distribution of routes.
show ip interface brief | include Vlan
show interfaces Vlan10
show ip route
show ip route 10.10.50.0
show standby brief
show ip arp vlan 10
traceroute 10.10.50.20 source Vlan10
In the show standby brief output, check on which device each group is Active and whether it’s consistent with STP root placement. The most practical way to catch asymmetric routing is to run traceroute from both directions: the outbound path from here, the return path from the other side. If the two outputs pass through different devices, that’s most likely the problem you’re looking for. To review or redesign your inter-VLAN routing architecture, see our VLAN, routing and network segmentation service page.
Frequently asked questions
I created an SVI but its status shows down; why?
On Cisco switches, for an SVI to be up, the relevant VLAN must exist in the VLAN database and at least one port in that VLAN must be up and forwarding. Also check that no shutdown was entered on the interface.
Should I use HSRP or VRRP?
If all gateway devices are Cisco, HSRP works without problems. If devices from different vendors will share the same virtual gateway, the standard VRRP is required. Both solve the same problem; the difference is mostly in default behaviors and timers.
Isn’t routing all VLANs through the firewall better for security?
It’s the strictest method in terms of policy, but the firewall needs the capacity to carry east-west traffic too. In practice, a mixed model where user VLANs that trust each other are routed at the core and server and sensitive segments behind the firewall gives a more balanced result.
Is router-on-a-stick still used?
It’s sufficient in small branches, environments built with switches without L3 features and setups where traffic between VLANs is low. At campus scale, the single trunk link and the router’s processing capacity become a bottleneck.