The Address Resolution Protocol

   
 
                    TCP      UDP
                      ^       ^
                       \     /
                        \   /
                         v v
                         IP
                        / ^
                       /  |
                      v   |
                     ARP  |
                     ^    |
                      \   |
                       v  |
                       ETHERNET
   
 
Example:
 
        A   B   C    D    E   F   G  H
        |   |   |   / \   |   |   |  |
      --------------   -------------- --
 
Machine A's IP address is 198.11.109.08, and machine B's IP address is 198.11.109.09
   
The ARP request protocol:
 
bytes: 2    2          1         1      2     6       4        6        4
  ----------------------------------------------------------------- -----------
  Hardware| Protocol |Hardware |Protocol| op |sender | sender |target | target
    type  |  type    |address  |address |    |ether  | IP     | ether |  IP
          |          | size    | size   |    |addr   | addr   | addr  |  addr
  ----------------------------------------------------------------- -----------
 
Hardware type:  0001 means Ethernet
Protocol type:  0800 means IP
Hardware address size:  06  (Ethernet address is 6 bytes)
Protocol address size:  04  (IP address is 4 bytes)
op:  0001 for request, 0002 for reply
 
 
Example:
   
  0001 0800  06  04  0001 08 00 20 1A 1B DE C6 0B 6D 08 00 00 00 00 00 00 C6 0B 6D 0A
 
Notes:  
What goes onto the Ethernet wire?
 
If old Ethernet:
 
 
   ----------------------------------------------------------- -----
   | Preamble | SOF | ff ff ff ff ff ff | 08 00 20 1A 1B DE | 0806 |
   ----------------------------------------------------------- ------
   | 0001 0800  06  04  0001 08 00 20 1A 1B DE C6 0B 6D 08         |
   | 00 00 00 00 00 00 C6 0B 6D 0A                                  |
   ----------------------------------------------------------- ------
   |  checksum |
   -------------
   
If 802.3:
 
   ----------------------------------------------------------- -----
   | Preamble | SOF | ff ff ff ff ff ff | 08 00 20 1A 1B DE | 002E |
   ----------------------------------------------------------- ------
   | AA AA 03 00 0000 0806                                          |
   | 0001 0800  06  04  0001 08 00 20 1A 1B DE C6 0B 6D 08         |
   | 00 00 00 00 00 00 C6 0B 6D 0A                                  |
   | (10 bytes of padding)                                          |
   ----------------------------------------------------------- ------
   |  checksum |
   -------------
 
---> check your notes on 802.3 and see why the data looks like that.

Also, you should know why there are 10 bytes of padding there.
 
The ARP reply:
 
   0001 0800  06  04  0002 08 00 20 11 F1 A6 C6 0B 6D 0A
   08 00 20 1A 1B DE C6 0B 6D 08
 
 Note:
 

 
 
What goes onto the Ethernet wire?
 
If old Ethernet:
 
   ----------------------------------------------------------- -----
   | Preamble | SOF | 08 00 20 1A 1B DE | 08 00 20 11 F1 A6 | 0806 |
   ----------------------------------------------------------- ------
   | 0001 0800  06  04  0002 08 00 20 11 F1 A6 C6 0B 6D 0A         |
   | 08 00 20 1A 1B DE C6 0B 6D 08                                  |
   ----------------------------------------------------------- ------
   |  checksum |
   -------------
 
If 802.3:
 
   ----------------------------------------------------------- -----
   | Preamble | SOF | 08 00 20 1A 1B DE | 08 00 20 11 F1 A6 | 002E |
   ----------------------------------------------------------- ------
   | AA AA 03 00 0000 0806                                          |
   | 0001 0800  06  04  0002 08 00 20 11 F1 A6 C6 0B 6D 0A         |
   | 08 00 20 1A 1B DE C6 0B 6D 08                                  |
   | (10 bytes of padding)                                          |
   ----------------------------------------------------------- ------
   |  checksum |
   -------------
 
Side question:  does everyone see why the Ethernet address is in the ARP data?  Remember that the Ethernet driver will strip off the Ethernet header before delivering the packet to the ARP layer. So, in order for ARP to know the Ethernet address, the address  must be in the ARP data.
 
 
Important facts:
   
Other things to know:
   
Gratuitous ARP
                          - It is gratuitous is the sense that no reply is expected.