When I run show ip route on my Cisco 3850 switch stack, i get the following output

PO-SW-SVR-SS-02(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is to network

S* [254/0] via is variably subnetted, 31 subnets, 3 masks
S [1/0] via
C is directly connected, Vlan2
L is directly connected, Vlan2
C is directly connected, Vlan10
L is directly connected, Vlan10
C is directly connected, Vlan11
L is directly connected, Vlan11
C is directly connected, Vlan12
L is directly connected, Vlan12
C is directly connected, Vlan13
L is directly connected, Vlan13
C is directly connected, Vlan14
L is directly connected, Vlan14
C is directly connected, Vlan15
L is directly connected, Vlan15
C is directly connected, Vlan16
L is directly connected, Vlan16
C is directly connected, Vlan101
L is directly connected, Vlan101
C is directly connected, Vlan102
L is directly connected, Vlan102
C is directly connected, Vlan103
L is directly connected, Vlan103
C is directly connected, Vlan104
L is directly connected, Vlan104
C is directly connected, Vlan200
L is directly connected, Vlan200
C is directly connected, Vlan25
L is directly connected, Vlan25
C is directly connected, Vlan50
L is directly connected, Vlan50

However, I do not want my gateway of last resort to be set to to network

The network I need the gateway of this switch stack to point to is so it can then get out to the Internet. I have attempted to set the gateway of last resort to with the following commands:

ip default-gateway
ip default-network

But, the gateway of last resort is still showing as for some reason. I am guessing I am missing something. Can anyone point me in the right direction to get my switch stack pointing at I am not sure how the gateway ever got set to in the first place :\ I see no references to anywhere in my entire configuration.

As a side note, VLAN2 ( is my native VLAN, and this switch stack is trunked to the switch stack with the address. That being said, since the device is directly connected and both switch stacks have an interface in VLAN2, is this even necessary?

  • 3
    You don't give any other config or switch models, but my guess is that the switch is running in L3 mode. In L3 mode on a Cisco switch the default-gateway is not used. Rather try a static route: ip route may also need to remove an existing static route.
    – YLearn
    Commented Oct 20, 2017 at 2:47
  • That worked. Please convert your comment to an answer.
    – Richie086
    Commented Oct 20, 2017 at 12:04

2 Answers 2


Without knowing the switch model or code version, and based on the routing table output you provided, it is most likely that your switch is operating in L3 mode (i.e. has ip routing enabled in the configuration).

The ip default-gateway command is only used by L2 switches and is entirely ignored by a switch in L3 mode. If you want to use the ip default-gateway command and run the switch in L2 mode, you need to configure no ip routing.

On a switch in L3 mode, you need to create a static route in the configuration such as ip route which is inserted into the routing table.

Based on your routing table, you already have a static route configured. You may also need to remove this with a no ip route command.

  • also, default-network is used where a dynamic routing protocol is running. the default route will be whatever is necessary to get back to that network. (it works, but does have a few dangerous issues.)
    – Ricky
    Commented Oct 20, 2017 at 20:50
  • @RickyBeam, true that will work, but I personally feel very strongly that using default-network should be avoided unless absolutely necessary due to the dangers and poor design it generally represents. As such I won't generally even discuss it unless one of those absolutely necessary situations comes up (and I can't think of one at the moment). It is almost always better if people forget (or never learn) that command ever existed.
    – YLearn
    Commented Oct 20, 2017 at 20:54

As YLearn points out, you need to determine if the switch is operating as strictly a layer-2 switch, or is it actually routing (layer-3). If it is routing, then you do not want to use the default-gateway or default-network commands.

You should not use the ip default-gateway commands on a router that is acting as a router, and the ip default-network command is really for IGRP, which doesn't understand the default route; you can use a static default route.

Cisco has a document that explains the differences: Configuring a Gateway of Last Resort Using IP Commands:


Use the ip default-gateway command when ip routing is disabled on a Cisco router. Use the ip default-network and ip route commands to set the gateway of last resort on Cisco routers that have ip routing enabled. The way in which routing protocols propagate the default route information varies for each protocol.

You also say that the address that you want to use for the gateway is another switch. You need to make sure that address really is a gateway for that network. Do not confuse the layer-2 LAN with the layer-3 routing. The address you use as a gateway needs to be a router (or layer-3 switch) that knows how to get to other networks.

You should edit your question to include a good description (a diagram would be great) of how your network is connected, and the full switch configurations. That would help us give you a more specific answer.

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.