Ping to different Subnet.

Answered Question
Mar 4th, 2010
User Badges:

Hello All,



I have two machines---Host A ( 10.1.1.1/8 ) & Host B( 10.1.1.2/24 ) connected to a Layer 2 switch. Where this Layer 2 switch is connected to a Router A. What will be the steps if I have to ping Host A to Host B, we wont be able to ping because both are in different subnets. But still how Host A would come to know this. Would that traffic go to Router or Layer 2 switch would send it directly to Host B.Image_1.bmp

Correct Answer by Jon Marshall about 7 years 2 months ago

subodh121 wrote:


Hello All,



I have two machines---Host A ( 10.1.1.1/8 ) & Host B( 10.1.1.2/24 ) connected to a Layer 2 switch. Where this Layer 2 switch is connected to a Router A. What will be the steps if I have to ping Host A to Host B, we wont be able to ping because both are in different subnets. But still how Host A would come to know this. Would that traffic go to Router or Layer 2 switch would send it directly to Host B.


Subodh


Actually they should be able to ping each other via the L2 switch.


Host A sends traffic to Host B.


Host A works out it's own network by using it's IP address and it's subnet mask -  10.1.1.1 255.0.0.0 means the network is 10.0.0.0


Host A then compares Host B's address with it's own subnet mask - 10.1.1.2 255.0.0.0 means host A thinks host B is on 10.0.0.0 which is the same network. Note host A has to use it's own subnet mask in this comparison because it doesn't know what subnet mask host B is configured with.


So because Host A thinks B is on the same network it just arps out for it.


When host B replies to Host A it does the same comparison as Host A did ie.


B's IP = 10.1.1.2 255.255.255.0  so it is on network 10.1.1.0.  B compares A's IP with it's own subnet mask - 10.1.1.1 255.255.255.0 so B thinks A is on 10.1.1.0 which is the same network. So it can talk directly with A via the L2 switch.


So even though they have different subnet masks they both think they are on the same subnet.


Jon

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Jon Marshall Thu, 03/04/2010 - 13:06
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

subodh121 wrote:


Hello All,



I have two machines---Host A ( 10.1.1.1/8 ) & Host B( 10.1.1.2/24 ) connected to a Layer 2 switch. Where this Layer 2 switch is connected to a Router A. What will be the steps if I have to ping Host A to Host B, we wont be able to ping because both are in different subnets. But still how Host A would come to know this. Would that traffic go to Router or Layer 2 switch would send it directly to Host B.


Subodh


Actually they should be able to ping each other via the L2 switch.


Host A sends traffic to Host B.


Host A works out it's own network by using it's IP address and it's subnet mask -  10.1.1.1 255.0.0.0 means the network is 10.0.0.0


Host A then compares Host B's address with it's own subnet mask - 10.1.1.2 255.0.0.0 means host A thinks host B is on 10.0.0.0 which is the same network. Note host A has to use it's own subnet mask in this comparison because it doesn't know what subnet mask host B is configured with.


So because Host A thinks B is on the same network it just arps out for it.


When host B replies to Host A it does the same comparison as Host A did ie.


B's IP = 10.1.1.2 255.255.255.0  so it is on network 10.1.1.0.  B compares A's IP with it's own subnet mask - 10.1.1.1 255.255.255.0 so B thinks A is on 10.1.1.0 which is the same network. So it can talk directly with A via the L2 switch.


So even though they have different subnet masks they both think they are on the same subnet.


Jon

subodh121 Thu, 03/04/2010 - 17:13
User Badges:

Thanks Jon, you made it clear with brief explanation.

Actions

This Discussion