Showing results for 
Search instead for 
Did you mean: 

static routing through vlan


Hi all 

I have question related to static routing on l3 switches


in this photo, static routing is configured through VLAN ...

i know that we can configure static routing through next-hop IP or exit interface but if we use VLAN how will the traffic leave the switch


I mean from which interface will the traffic leave to the next hop


22 Replies 22

In my original reply, I mentioned "I.e. logically, SVI will be used for L3 egress, but L2 port, for that SVI, will depend on typical VLAN port selection."  That's being said, again, by Rick.

Further understand, what both Rick and I are telling you, actual packet could flow out any one of the VLAN's port, which could also mean flowing across one or more L2 transit ports, until it reaches the VLAN's final physical egress port, which could be on, for example, another switch hosting that VLAN's ports.  Further, there's a corner case where the packet might be sent out ALL of the VLAN's egress ports (see "unicast flooding").

Yes, exactly! That's what I'm trying to understand


Hello there,

Your question is ".........but if we use VLAN how will the traffic leave the switch." Here comes my answer and solution to your problem. 

According to your L3 (Multilayer) Switch configurations, VLANs data paket send and recive via interface G1/0/22 Switchport (in your terms "traffic leave the switch") to destination address and from originated address. Why I say that you have configured G1/0/22 as "Switchport trunk  native vlan 249", "Switchport trunk encapsulation dot1q" and "Switchport mode trunk". You don't want have static route to communicate neighboring VLANS. L3 switches have inbuild ip routing protocol.

When you assigned Switchport trunk as a "native" then data Frame encapsulate with native VLAN tag before it leave from the port. In your case VLAN249. If you connect this G1/0/22 interface to other switch interface You have to configure that switchport also same name of VLAN like VLAN249 as a native. You cannot assign any other VLAN name as native.

Default native VLAN is VLAN1. If you not assigned any VLAN number to interface as a "native VLAN" it will choose default VLAN1 as a native.

Trunk Native VLANTrunk Native VLAN

In your case in the moment working only VLAN1 and VLAN249 because other VLANs (33, 61, 400 and 564) you have not assigned to any port in your L3 switch. Therefore Vlan33, 61, 400 and 564 status and protocol shows "down/down" states. Due to this reason default VLAN1 take over the ownership of unassignsports as VLAN1. see below sh-vlan.png file. (You dont have to worry about G1/1/1-4 ports it might differ from your switch)

SH-VlanSH-Vlan Ip Interface Brief VlanIp Interface Brief Vlan

L3 switches having inbuilt IP routing mechanism. You have to activate ip routing by issuing "ip routing" in configuration/previlage mode. as L3_SW(config)# ip routing. Then it will do the rest.

I added extra configuration setup to your L3 switch as below.

L3-SW#config t
L3-SW(config)#ip dhcp pool Net249
L3-SW(dhcp-config)# network
L3-SW(dhcp-config)# default-router
L3-SW(dhcp-config)#ip dhcp pool Net1
L3-SW(dhcp-config)# network
L3-SW(dhcp-config)# default-router
L3-SW(dhcp-config)#ip routing

The interface G1/0/22 should connect to Router/Switch for data traffic flow. You can see the network design I drawn according to your L3 swith configuration. I have added R1 router G0/0 interface to connect L3-SW G1/0/22 interface for data traffic flow.

L3-Switch VLANs trafficL3-Switch VLANs traffic

You have to do some extra work to configure R1 router now. Here belows I did it for you.

R1-AP-OT(config)#interface GigabitEthernet0/0
R1-AP-OT(config-if)# no ip address
R1-AP-OT(config-if)# duplex auto
R1-AP-OT(config-if)# speed auto
R1-AP-OT(config)#interface GigabitEthernet0/0.1
R1-AP-OT(config-subif)# encapsulation dot1Q 1
R1-AP-OT(config-subif)# ip address
R1-AP-OT(config)#interface GigabitEthernet0/0.249
R1-AP-OT(config-subif)# encapsulation dot1Q 249 native
R1-AP-OT(config-subif)# ip address
R1-AP-OT(config)#interface GigabitEthernet0/0.33
R1-AP-OT(config-subif)# encapsulation dot1Q 33
R1-AP-OT(config-subif)# ip address
R1-AP-OT(config)#interface GigabitEthernet0/0.61
R1-AP-OT(config-subif)# encapsulation dot1Q 61
R1-AP-OT(config-subif)# ip address
R1-AP-OT(config)#interface GigabitEthernet0/0.400
R1-AP-OT(config-subif)# encapsulation dot1Q 400
R1-AP-OT(config-subif)# ip address
R1-AP-OT(config)#interface GigabitEthernet0/0.564
R1-AP-OT(config-subif)# encapsulation dot1Q 564
R1-AP-OT(config-subif)# ip address

After configuration done, You can manage to ping diffirent VLAN ip address from the router and also you can do it visa versa.

R1 ping VLAN1R1 ping VLAN1R1 ping VLAN249R1 ping VLAN249

I hope that you enjoy this positive solution for your problem. Give me a thumbs up as a solution is "Helpful". It will help for the others to slove their problem.


ip route x.x.x.x x.x.x.x VLAN 
it seem same BUT NOW 
How the static route remove from the RIB ?
if the egress interface is Down or Optional track is down 
we talk about egress interface L2 not L3 ? so L2 can not be config for static route, so how we solve this ?
we solve this with config static route with VLAN, 
BUT VLAN how it related ?
the related is VLAN is DOWN when there is no L2 port UP assign for that VLAN 
here I want to mention and if you return to my example I use VLAN 10 which only use for transit and in each SW there is only ONE L2 port assign to this VLAN (L2 port interconnect both SW).
so when this L2 port down the VLAN is down and static route remove.


Okay, I think I get you now



@MHM Cisco World 

@Richard Burts 

@Joseph W. Doherty 



I'd want to express my heartfelt gratitude to everyone

I appreciate your efforts and am delighted to have had this discussion with you all.


Thank you one again.

And you are so so welcome 

Hi Bolybay,

Thanks to you also posting here that you have had in your mind. It is very good to have profession discussion and gained more knowledge and extra information.

Best regards,


Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers