I have a router with multiple L3 sub-interfaces. On the other side I have a L3 switch (Nexus 9K) that I'd like to have multiple hosts that are on the switch route their traffic to one of the router sub-intf's. Questions:

  1. Will this work if I create a corresponding sub-intf on the Nexus switch, put the hosts in the same vlan and use the switch sub-intf ip as the hosts default gateway? I'm thinking not.

  2. If not, will creating a vlan/svi on the switch accomplish this?

  • Has any answer solved your question? Then please accept it or your question will keep popping up here forever. Please also consider voting for useful answers.
    – Zac67
    Commented Mar 10 at 20:06

1 Answer 1


802.1q subinterfaces form a VLAN trunk on the physical interfaces - frames are tagged as specified on the subinterface. Subinterfaces are generally layer 3, ie. they would require you to set up IP addresses and route between them.

On the Nexus you'd

  1. create the according VLANs
  2. configure the port towards the router as trunk (switchport mode trunk)
  3. permit the VLANs on the trunk (switchport trunk allowed vlans [vlan-ids])
  4. configure the ports towards the server as access ports (switchport mode acess, switch port access vlan [vlan-id])

SVIs are virtual L3 interface instances attached to a VLAN, instead of a physical port. The are used with switched VLANs but are only required if you need to forward/route between VLANs on the switch (or require an interface for management).

A physical port configured as L3 (routed) interface terminates the VLAN and you cannot put the hosts in the same vlan any more on that device.

  • The 802.1q sub-interfaces on the router and switch are already set up as layer 3 (/30) so I can't switch to trunking on the Nexus. I need the hosts to be able to use the switch as their default gateway so I was thinking of creating a new dot1q sub-interface on the router and switch then put the hosts connected to the switch on the same vlan. Commented Oct 12, 2023 at 12:11
  • Then put the hosts in the same VLAN won't work. You need to put the servers in another VLAN with an SVI, or connect them to another L3 port and route between those and the subinterfaces towards the router. An L3 interface terminates the VLAN on the switch/router interface and you cannot connect anything else to it any more.
    – Zac67
    Commented Oct 12, 2023 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.