cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
18171
Views
16
Helpful
12
Replies

ip default-gateway problem

tedauction
Level 1
Level 1

Hello, I have two switches connected via a trunk.

Switch 1 has an SVI in VLAN 10 (192.168.10.1). Switch 2 has SVIs in VLAN 10 (192.168.10.2) and VLAN 20 (192.168.20.1).

My goal is to ping from switch 1 (192.168.10.1) to 192.168.20.1 on switch 2 but it cannot do that unless I add the command 'ip route 0.0.0.0 0.0.0.0 192.168.10.2'.

My question is why would my existing command 'ip default-gateway 192.168.10.2' also perform the same function ?

Thanks kindly for any help.

SWITCH 1

ip routing
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
xxx
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
!
ip default-gateway 192.168.10.2
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end

SWITCH 2

ip routing
!
spanning-tree mode pvst
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 20
!
xxxxxxxxx
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.2 255.255.255.0
!
interface Vlan20
ip address 192.168.20.1 255.255.255.0
!
ip classless
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end

1 Accepted Solution

Accepted Solutions

Thanks tedauction, are you able to ping 192.168.10.2 from 192.168.10.1? Please can you send me an output of "show ip interface brief" on Switch2?
Luke


Please rate helpful posts and mark correct answers.

View solution in original post

12 Replies 12

Luke Oxley
Level 1
Level 1

If ip routing is enabled then the ip default-gateway command is ignored.
If ip routing is disabled then the ip route 0.0.0.0 0.0.0.0 command is not effective.
I hope that helps. All the best.
Luke


Please rate helpful posts and mark correct answers.

Hello, thanks for that, however when I removed 'ip routing' and removed the 'ip route 0.0.0.0 0.0.0.0' command I cannot ping 192.168.20.1.

The switches can ping each other. Traceroute shows the ping is reaching 192.168.10.2 on Switch 2 but the ping return is not happening.

Can anyone see why this is happening ?

SWITCH 1
spanning-tree mode pvst
!
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
!
ip default-gateway 192.168.10.2
ip classless
!
ip flow-export version 9
!

Hey tedauction,
Does Switch2 have a route back to Switch1 to return the echo-reply? Also, are trying to ping 192.168.20.1 directly from Switch1, and if so are you sourcing the ping from VLAN10?
Please post the full sanitised configuration from both switches so I can get the full picture. I have a spare few hours so will have a pick through the configurations for you and get it sorted.
Cheers,
Luke


Please rate helpful posts and mark correct answers.

Hello thanks Luke, yes to both of your questions. Here are the full configs.

I appreciate your help.

SWITCH1:

Current configuration : 1272 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch

!
spanning-tree mode pvst

!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
!
ip default-gateway 192.168.10.2
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end

SWITCH 2

Current configuration : 1377 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
ip routing
!
!
spanning-tree mode pvst
!
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 20
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.2 255.255.255.0
!
interface Vlan20
ip address 192.168.20.1 255.255.255.0
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end

Thanks tedauction, are you able to ping 192.168.10.2 from 192.168.10.1? Please can you send me an output of "show ip interface brief" on Switch2?
Luke


Please rate helpful posts and mark correct answers.

thanks kindly Luke. Yes VLAN 20 was in existence.

Here is the output you requested:

Switch(config)#do sh ip int brief

Interface IP-Address OK? Method Status Protocol

FastEthernet0/1 unassigned YES unset up up

FastEthernet0/2 unassigned YES unset up up

FastEthernet0/3 unassigned YES unset down down

FastEthernet0/4 unassigned YES unset down down

FastEthernet0/5 unassigned YES unset down down

FastEthernet0/6 unassigned YES unset down down

FastEthernet0/7 unassigned YES unset down down

FastEthernet0/8 unassigned YES unset down down

FastEthernet0/9 unassigned YES unset down down

FastEthernet0/10 unassigned YES unset down down

FastEthernet0/11 unassigned YES unset down down

FastEthernet0/12 unassigned YES unset down down

FastEthernet0/13 unassigned YES unset down down

FastEthernet0/14 unassigned YES unset down down

FastEthernet0/15 unassigned YES unset down down

FastEthernet0/16 unassigned YES unset down down

FastEthernet0/17 unassigned YES unset down down

FastEthernet0/18 unassigned YES unset down down

FastEthernet0/19 unassigned YES unset down down

FastEthernet0/20 unassigned YES unset down down

FastEthernet0/21 unassigned YES unset down down

FastEthernet0/22 unassigned YES unset down down

FastEthernet0/23 unassigned YES unset down down

FastEthernet0/24 unassigned YES unset down down

GigabitEthernet0/1 unassigned YES unset down down

GigabitEthernet0/2 unassigned YES unset down down

Vlan1 unassigned YES unset administratively down down

Vlan10 192.168.10.2 YES manual up up

Vlan20 192.168.20.1 YES manual up up

tedauction,

I assume these switches are not in production, so we are able to be making changes. On Switch1 and Switch2 can you please run the following command? After this, please save your configuration and reload the switches.
no ip classless
Once they are back up, please enable "debug ip icmp" and "terminal monitor" on both switches. Once these have been enabled, run the two extended ping commands from Switch1 as per the below and kindly send me the results.
Switch1#ping
Protocol [ip]:
Target IP address: 192.168.10.2
Repear count [5]: 10
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: vlan10
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Switch1#ping
Protocol [ip]:
Target IP address: 192.168.20.1
Repear count [5]: 10
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: vlan10
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
From the debug output on Switch2, do you see the ICMP echo-request hit? Do you see it trying to send an echo-reply?
Thanks,
Luke


Please rate helpful posts and mark correct answers.

Hey tedauction,

Have you had a chance to test this as per our conversation? I look forward to hearing back.

Kind regards,
Luke


Please rate helpful posts and mark correct answers.

Helllo, thanks for your help. A reboot got it working somehow !

tedauction,

Great, thanks for confirming. Were any changes made as suggested to resolve this, or just simply a reboot as I said? I'm think the ARP cache may have needed clearing which could have fixed it, especially if they are emulated switches, they can be funky sometimes. Nevertheless, glad you're sorted :-)

Thanks,
Luke

Please rate helpful posts and mark correct answers.

tedauction,
I've just created your setup in my lab environment and it works perfectly for me. I'm thinking you haven't created VLAN20 at layer 2 on Switch2. Run the following commands on Switch2 and test again. Remember to try the pings a few times over before giving up, sometimes the ARP cache can be slow to catch up. I'd be interested to see the output of a "show ip interface brief" from Switch2 as it is.
conf t
!
vlan 20
!
exi
Let me know how you get along. Cheers.
Luke


Please rate helpful posts and mark correct answers.

Perfect

Review Cisco Networking products for a $25 gift card