Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

When to use the default gateway (ARP)

Hi,

Here's a scenario. Two separate IP networks (192.168.10.0 and 192.168.20.0) connected via a router.

When I ping host 192.168.20.2 from 192.168.10.2, what happens first?

Does ARP try to request the hardware address of 192.168.20.2 via a broadcast? Obviously, the broadcast will produce no response so does the host then send the frame to the default gateway?

I'm not quite clear what happens at this initial stage - how the host knows when to try the default gateway.

Thanks,

Dave.

3 REPLIES

Re: When to use the default gateway (ARP)

This is what happens:

The IP stack in your PC knows that 192.168.20.x is not on your network.

It calculates this using the subnet mask (24 bits = 255.255.255.0 I suppose)

When the subnet part of the IP address matches your own network address, its local. Everything not on your network is sent to the default GW.

So, your PC will ARP for the IP address of the local router when needed and send the packet to that mac-address. It knows what IP address to use while you specified the default gateway. The router "routes" the packet to its destination network. The router on that LAN will ARP for 192.168.20.2 and use that mac adress to sent the packet. The source mac address will be the mac address of the remote router. This enables 192.168.20.2 to respond and the process repeats itself in opposite direction.

New Member

Re: When to use the default gateway (ARP)

Thanks for the quick response.

So basically the subnet mask of 255.255.255.0 dictates that my network address of 192.168.10.0 is the only local network available? Therefore if the destination host is anything other than 192.168.10.0 then it uses the default gateway?

Similarly on a class B network if we have networks 172.16.0.0/16 and 172.17.0.0/16 the same rules apply - i.e. a host of 172.16.1.242 pinging 172.16.2.32 is a local echo and 172.17.3.19 is a remote echo.

Cheers!

New Member

Re: When to use the default gateway (ARP)

Actually, once your pc realizes that the IP address is remote (via subnet mask), it looks in it's local ARP cache for the MAC address of the default gateway. If it doesn't have the entry listed, it sends an ARP broadcast and the router responds. The PC then sends the Frame to the default gateway, the DESTINATION MAC is that of the default gateway and the DESTINATION IP is that of the original IP address. If the router receives the packet on interface E0 and then sends it out S0, before it goes out interface s0, the router strips the frame, puts its MAC address (for interface S0) as the SOURCE MAC address and the destination IP stays the same. This happens at every router along the way and on its way back.

561
Views
5
Helpful
3
Replies
CreatePlease login to create content