4

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 10.20.25.254 to network 0.0.0.0

S*    0.0.0.0/0 [254/0] via 10.20.25.254
      10.0.0.0/8 is variably subnetted, 31 subnets, 3 masks
S        10.0.0.0/8 [1/0] via 10.6.9.0
C        10.6.9.0/24 is directly connected, Vlan2
L        10.6.9.6/32 is directly connected, Vlan2
C        10.6.10.0/24 is directly connected, Vlan10
L        10.6.10.254/32 is directly connected, Vlan10
C        10.6.11.0/24 is directly connected, Vlan11
L        10.6.11.254/32 is directly connected, Vlan11
C        10.6.12.0/24 is directly connected, Vlan12
L        10.6.12.254/32 is directly connected, Vlan12
C        10.6.13.0/24 is directly connected, Vlan13
L        10.6.13.254/32 is directly connected, Vlan13
C        10.6.14.0/24 is directly connected, Vlan14
L        10.6.14.254/32 is directly connected, Vlan14
C        10.6.15.0/24 is directly connected, Vlan15
L        10.6.15.254/32 is directly connected, Vlan15
C        10.6.16.0/24 is directly connected, Vlan16
L        10.6.16.254/32 is directly connected, Vlan16
C        10.6.101.0/24 is directly connected, Vlan101
L        10.6.101.254/32 is directly connected, Vlan101
C        10.6.102.0/24 is directly connected, Vlan102
L        10.6.102.254/32 is directly connected, Vlan102
C        10.6.103.0/24 is directly connected, Vlan103
L        10.6.103.254/32 is directly connected, Vlan103
C        10.6.104.0/24 is directly connected, Vlan104
L        10.6.104.254/32 is directly connected, Vlan104
C        10.6.200.0/24 is directly connected, Vlan200
L        10.6.200.254/32 is directly connected, Vlan200
C        10.20.25.0/24 is directly connected, Vlan25
L        10.20.25.172/32 is directly connected, Vlan25
C        10.50.1.0/24 is directly connected, Vlan50
L        10.50.1.253/32 is directly connected, Vlan50

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

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

ip default-gateway 10.6.9.10
ip default-network 10.6.9.0

But, the gateway of last resort is still showing as 10.20.25.254 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 10.6.9.10? I am not sure how the gateway ever got set to 10.20.25.254 in the first place :\ I see no references to 10.20.25.254 anywhere in my entire configuration.

As a side note, VLAN2 (10.6.9.0/24) is my native VLAN, and this switch stack is trunked to the switch stack with the 10.6.9.10 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 0.0.0.0 0.0.0.0 10.6.9.10...you may also need to remove an existing static route. – YLearn Oct 20 '17 at 2:47
  • That worked. Please convert your comment to an answer. – Richie086 Oct 20 '17 at 12:04
5

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 0.0.0.0 0.0.0.0 10.6.9.10 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 0.0.0.0 0.0.0.0 10.20.25.254 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 Beam Oct 20 '17 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 Oct 20 '17 at 20:54
1

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:

Summary

Use the ip default-gateway command when ip routing is disabled on a Cisco router. Use the ip default-network and ip route 0.0.0.0 0.0.0.0 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 10.6.9.10 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, privacy policy and cookie policy

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