cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
11269
Views
15
Helpful
13
Replies

Cannot ping the Switches from other subnet

vyasgobinath
Level 1
Level 1

Hi,

 

I have a question about switches. Please refer the topology, I have attached. 

 

The problem is I cannot ping from the PC's to the switch in other subnet. And I cannot ping from the switches to other subnets. PC1 can ping Switch1, but not switch2 and PC2 can ping switch2, but not switch1.

PC1 and PC2 can both ping each other.

I am using GNS3 (I don't know if this is relevant)

When I tried trace route from PC1 to switch2, I see the packet goes to the default gateway, goes to the next hop (i.e. R2) but stops there.

 

Can someone please explain, why the switch behaves this way? or is it just a problem in GNS3 and in real world, it shouldn't behave like this?

 

Thank You for your time.

2 Accepted Solutions

Accepted Solutions

Hi,

 

I am not sure why default Route didn't appeared with your command. Meanwhile, can you add below so at least it should appear in your routing table:

 

Sw2

 

Ip routing 

Ip route 0.0.0.0 0.0.0.0 10.1.3.1

 

On sw1

Ip routing

Ip route 0.0.0.0 0.0.0.0 10.1.1.1

 

Once it appear, your routing issue will be resolved between switches 

View solution in original post

Hello,

 

configs look good actually. On both switches, turn off ip routing and remove the static default routes:

 

S1#conf t

S1(config)#no ip routing

S1(config)#no ip route 0.0.0.0 0.0.0.0 10.1.1.1

 

S2#conf t

S2(config)#no ip routing

S2(config)#no ip route 0.0.0.0 0.0.0.0 10.1.3.1

 

IP routing is enabled by default on the IOU switches, that is why the default gateway command has no effect...

View solution in original post

13 Replies 13

Muhammad Awais Khan
Cisco Employee
Cisco Employee

Hi,

 

Can you share the config of your switches, it seems either default gateway is not there or vlan1 interface is shut. Also share show ip route output if possible. 

 

Make sure, vlan1 is up by issuing "show ip interface br" and in "show ip route" you should see default route on both switches. If not there, please add it.

Dear Muhammad,

 

Both the switches vlan1 interface are UP. I can ping the interface from the local subnet. 

 

Please find attached the config and show output of both the switches.

 

Edit:

When I checked show ip route, it shows gateway of last resort is not set. Now it is confusing.

I did set a gateway by using,  ip default-gateway 10.1.3.1 for S2, but it is not updating.

Am I doing something wrong?

Hello,

 

judging from the output, it appears that S1 is configured with 10.1.1.0/24 IP addresses, while S2 is configured with 10.1.3.0/24 IP addresses. 

 

Both Vlan 1 interfaces need to have IP addresses from the same subnet. So it is either:

 

S1

interface Vlan 1

ip address 10.1.1.2 255.255.255.0

!

ip default-gateway 10.1.1.1

 

S2

interface Vlan 1

ip address 10.1.1.3 255.255.255.0

!

ip default-gateway 10.1.1.1

 

or

 

S1

interface Vlan 1

ip address 10.1.3.2 255.255.255.0

!

ip default-gateway 10.1.3.1

 

S2

interface Vlan 1

ip address 10.1.3.3 255.255.255.0

!

ip default-gateway 10.1.3.1

 

 

 

Hi Georg,

"Both Vlan 1 interfaces need to have IP addresses from the same subnet. So it is either:"
Can you please clarify, why both switches needs to be in the same vlan?

So, are you saying that the switches (L2) cannot ping address from another subnet, even if its default-gateway is set to its router?

This is my doubt - Can switches (L2) ping to any address in another subnet, if their default gateway is set to their corresponding router (Assuming the hosts in the subnet can reach the hosts in the other subnet)?

Hello,

 

what do you use as router ? Post the running configuration of that device...

 

If you use different IP addresses for the switch, you need to use different Vlans as well. You cannot have Vlan 1 in two different IP subnets...

Hi Georg,

 

I'm using IOSv for router and IOSvL2 for switch.

 

I'm not using 2 different ip address for 1 switch. I'm using only 1 ip address for vlan1 interface. 

I'm using 2 switches.

 

Please find the configuration of the routers attached.

Hello,

 

it gets confusing what you have configured. Post the full running config (sh run), not just output snippets, of both switches and both routers...

Sorry if what I posted, was confusing. I just built a very basic topology of having 2 networks, connected by 2 routers - for educational purpose. 

 

Please find the show run outputs of both routers and switches.

 

 

Hello,

 

configs look good actually. On both switches, turn off ip routing and remove the static default routes:

 

S1#conf t

S1(config)#no ip routing

S1(config)#no ip route 0.0.0.0 0.0.0.0 10.1.1.1

 

S2#conf t

S2(config)#no ip routing

S2(config)#no ip route 0.0.0.0 0.0.0.0 10.1.3.1

 

IP routing is enabled by default on the IOU switches, that is why the default gateway command has no effect...

Hi Georg,

 

Thank you so much. Now It is clear, why Switches did not ping the other subnets. IP routing was enabled by default, and that was why gateway was not set. Learning new things and I'm loving it!

Setting up static route was like bypassing the default gateway configuration. But when I negated ip routing command, everything worked like a charm.

thank you very much , you save me 

Hi,

 

I am not sure why default Route didn't appeared with your command. Meanwhile, can you add below so at least it should appear in your routing table:

 

Sw2

 

Ip routing 

Ip route 0.0.0.0 0.0.0.0 10.1.3.1

 

On sw1

Ip routing

Ip route 0.0.0.0 0.0.0.0 10.1.1.1

 

Once it appear, your routing issue will be resolved between switches 

Dear Muhammed,

 

I'm not sure if IOSvL2 supports routing. But I tried what you suggested. But it still cannot ping other subnet.

 

Please find attached the config of the switch with routing enabled.

 

I'm going to try the same topology in packet tracer and update the result.

 

Edit:

I'm sorry. I made a mistake. I added wrong hop to S1. When I corrected it, I was able to ping.

 

Thank you so much! Although, I don't know why default-gateway command did not work.

 

Review Cisco Networking for a $25 gift card