Cisco Switch Stack – Gateway of Last Resort Configuration

ciscoroutingswitch

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?

Best Answer

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.