ARP is used to map a 32-bit IP address to a 48-bit ethernet address. As you saw in Chapter 1, "Local Area Networks," an ethernet frame contains the sending and receiving ethernet addresses. If two systems need to communicate across a network, these ethernet addresses are needed; otherwise the ethernet frame will not be delivered to the correct recipient, very much like what would happen if you sent a letter to someone but left the address blank. ARP uses the broadcast mechanism to try to find a host's ethernet address. The only information that ARP possesses, at this point, is the IP address (say 192.168.0.1), so it basically sends a request to all stations on the local network, asking, "Who has the IP address 192.168.0.1?" The receiving station that has been assigned the relevant IP address responds with its own ethernet address. The following fragment of output from the snoop command shows a remote host that is booting. Initially, it doesn't respond, but when its network interface has been initialized , it answers with its ethernet address. The items of interest are in bold: ETHER: ----- Ether Header ----- ETHER: ETHER: Packet 1 arrived at 10:54:40.99 ETHER: Packet size = 42 bytes ETHER: Destination = ff:ff:ff:ff:ff:ff, (broadcast) ETHER: Source = 8:0:20:b3:41:1b, Sun ETHER: Ethertype = 0806 (ARP) ETHER: ARP: ----- ARP/RARP Frame ----- ARP: ARP: Hardware type = 1 ARP: Protocol type = 0800 (IP) ARP: Length of hardware address = 6 bytes ARP: Length of protocol address = 4 bytes ARP: Opcode 1 (ARP Request) ARP: Sender's hardware address = 8:0:20:b3:41:1b ARP: Sender's protocol address = 192.168.0.28, ultra10 ARP: Target hardware address = ? ARP: Target protocol address = 192.168.0.21, systema ARP: ... ETHER: ----- Ether Header ----- ETHER: ETHER: Packet 28 arrived at 10:55:10.80 ETHER: Packet size = 42 bytes ETHER: Destination = 8:0:20:8e:48:de, Sun ETHER: Source = 8:0:20:b3:41:1b, Sun ETHER: Ethertype = 0806 (ARP) ETHER: ARP: ----- ARP/RARP Frame ----- ARP: ARP: Hardware type = 1 ARP: Protocol type = 0800 (IP) ARP: Length of hardware address = 6 bytes ARP: Length of protocol address = 4 bytes ARP: Opcode 2 (ARP Reply) ARP: Sender's hardware address = 8:0:20:b3:41:1b ARP: Sender's protocol address = 192.168.0.28, ultra10 ARP: Target hardware address = 8:0:20:8e:48:de ARP: Target protocol address = 192.168.0.21, systema ARP: Notice that in the first packet, the ethernet destination address is ff:ff:ff:ff:ff:ff , which is the ethernet broadcast address, but several packets later, the destination is the system's ethernet address because it has responded to the request. Also, it is interesting to note that in the first packet, the ARP: Target hardware address is set to ? , indicating that it is unknown, but several packets later, this value has been set to the remote system's ethernet address as it has been provided in the response. ARP CacheARP stores its responses in a cache, so that the information is available if it is required again. The cache stores this information for only up to 20 minutes by default, as can be seen by inspecting the contents of the ip_ire_arp_interval variable, using the ndd command as shown in the following: # ndd /dev/ip ip_ire_arp_interval 1200000 The value 1200000 is in microseconds and equates to 20 minutes. There are two types of ARP messages:
The value of 20 minutes in the previous command relates only to solicited ARP entries in the cache; unsolicited ARP entries are held for only 5 minutes. The arp command is used to manage entries in the ARP cache. To display the entries in the ARP cache, use the “a option, which shows the following output: ultra10# arp -a Net to Media Table: IPv4 Device IP Address Mask Flags Phys Addr ------ -------------------- --------------- ----- --------------- hme0 systema 255.255.255.255 08:00:20:8e:48:de hme0 dell14 255.255.255.255 00:b0:d0:e7:9f:f2 hme0 ultra10 255.255.255.255 SP 08:00:20:b3:41:1b hme0 224.0.0.0 240.0.0.0 SM 01:00:5e:00:00:00 The flags entry in the preceding output can consist of a number of values. These are described in the following list:
The previous code shows that the ARP entry for the local system is a static entry and is published to other hosts . The multicast entry (224.0.0.0) is also static and contains the M flag. Table 3.1 shows all the options for the arp command. Table 3.1. Options of the arp command
|