Tuesday, March 13, 2012

ARP



1> This is used to locate the hardware address of another device on the same subnet.

2> If Device A wants to communicate to Device B the ip stack locates if the destination address is known if the mac address is not known then it uses ARP to locate the destination address of the destination node.

3> ARP request are broadcast over the lan, so all the devices will come to know that a particular h/w address is requested for, the destination device will send an ARP reply with its own mac address howver the ARP reply wil be an unicast reply.


A-------------------- B
Arp request         Arp reply
Broadcast             Unicast


4> When host A wants to send traffic to host B it will first check its own arp cache to see if the destination mac address of host b is learnt if the mac address is not learnt it will send an arp request

5> The Arp response received from B is stored in the ARP cache the next time A wants to send data to B it will first search the entry in its cache if the entry exists it will use the existing entry and will not send the broadcast again.

6> Device B will also have the entry for A in its arp table in the format as ip address and mac address format.

7>Prior to this we discussed about the hosts in the same subnet

Host 1----------> Router------->Router 2-------> Host 2

If host 1 wants to send data to host 2 which is in a different subnet Host 1 will send an ARP request for the default gateway which is the router interface which is connected to Host 1.
The router after receiving the ARP request sends an ARP reply with its own mac address.

8> ARP only works within a broadcast domain and cannot be forwarded outside the broadcast domain.

9> Host 2 responds with a unicast ARP response to Router 2.

10>Arp request packet
Dest=All F's
Type :- 0x0806

10> Opcode determines if it is an ARP request or an ARP reply

Request opcode 1
Reply opcode 2

11> Arp request packet:-

Frame 31 (60 bytes on wire, 60 bytes captured)
Ethernet II, Src: 00:04:80:9f:78:00, Dst: ff:ff:ff:ff:ff:ff
Destination: ff:ff:ff:ff:ff:ff
Source: 00:04:80:9f:78:00
Type: ARP (0x0806)
Trailer: 000000000000000000000000000000000000
Address Resolution Protocol (request)
Hardware type: Ethernet (0x0001)
Protocol type: IP (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: request (0x0001)
Sender MAC address: 00:04:80:9f:78:00
Sender IP address: 138.120.53.253
Target MAC address: 00:00:00_00:00:00
Target IP address: 138.120.53.149

12> Arp reply packet:-

Frame 32 (42 bytes on wire, 42 bytes captured)
Ethernet II, Src: 00:11:43:45:61:23, Dst: 00:04:80:9f:78:00  <<<<=== The source becomes the destination address in the case of ARP reply
Destination: 00:04:80:9f:78:00
Source: 00:11:43:45:61:23
Type: ARP (0x0806)
Address Resolution Protocol (reply)
Hardware type: Ethernet (0x0001)
Protocol type: IP (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: reply (0x0002)
Sender MAC address: 00:11:43:45:61:23
Sender IP address: 138.120.53.149
Target MAC address: 00:04:80:9f:78:00
Target IP address: 138.120.53.253


****************

No comments:

Post a Comment