Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

packet transmitting-ARP, Gateway

Status
Not open for further replies.

1028

Technical User
Apr 18, 2002
15
US
hello,
i have some question on how the packet is transmitted. (i'm a newvie in this area, so my question might sounds too simple. but i need your help)

for example, when computer, A pings to B, the first step of this process is that A sends out ARP packet. So, if B is on the same network, A receives ARP reply from B, then A will send ip packet with using B's MAC as destination MAC.

now, say that B is on another network, which means A won't receive any ARP reply packet. Then, what happens? i know that somehow packet from A will be forwarded to Gateway, and then to B, or other router... however i wonder the details of this transmitting step.

any help will be appreciated.
 
You are exactly right about what happens on the local network. A ARPs B, B response to A with an ARP reply, now A has B's MAC address.

Everytime A sends an IP packet, A refers to its routing table. This table can be seen by typing Route Print at a DOS prompt. A will use this table to find the most appropriate route to take. This will be the route that matches the destination IP address, and uses the most bits of subnet mask.

For example, the route 0.0.0.0 has 0 bits of subnet mask. Since we do an AND operation between the subnet mask and the destination IP address, all IP addresses match the 0.0.0.0 route. If A finds a route that has 24 bits of mask that matches the destination IP address, it will choose that route instead.

After choosing the route, A looks at the Gateway IP address for that route. If the Gateway IP Address equals the Interface IP address, A will ARP for the address. If the Gateway IP Address and the Interface IP address are different, A will check the ARP cache to see if it has a MAC address corresponding to the Gateway IP Address. If it does, A will send the packet to the MAC address of the Gateway and the IP address of B (the destination). If A does not have the Gateway's MAC address, it will ARP for the Gateway before sending the packet.

So, for every packet you look at the route table, then look at the ARP cache, then send the packet.

The two useful commands here are:
Route Print - Display Route Table
ARP -a - Display ARP cache

mpennac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top