Address Resolution Protocol (ARP)


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 Cache

ARP 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:

  • Solicited ” A solicited ARP message means that a specific ethernet address was asked for by a host.

  • Unsolicited ” An unsolicited ARP message is information stored about a host that issued an ARP request.

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:

  • S ” A static entry that is not subject to the limit specified in the ip_ire_arp_interval variable. Static entries persist until the next reboot.

  • P ” A published entry that is advertised to other systems.

  • M ” A mapped entry indicating that this is a multicast entry.

  • U ” An unresolved or incomplete entry.

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

Option

Format

Description

-a

arp -a or arp hostname

Displays all entries, or a single entry.

-d

arp -d hostname

Deletes a single entry from the ARP cache.

-f < file >

arp -f file

Adds multiple entries to the cache. Entries must be in the following form: Hostname Eth_addr [pub]

-s

arp -s hostname Eth_addr [pub temp trail]

Adds a static entry to the ARP cache. The pub option publishes the entry to other systems, the temp option specifies a temporary entry, and the trail option allows trailer encapsulations to be sent to the host.

graphics/alert_icon.gif

When arp -a is used to display the entries in the ARP cache, hostnames are normally resolved where possible. If you do not want hostnames to be resolved, so that only the IP address is displayed, add the -n option. For example, arp -an .




Solaris 9 Network Administration Exam Cram 2 (Exam Cram CX-310-044)
Solaris 9 Network Administrator Exam Cram 2 (Exam CX-310-044)
ISBN: 0789728702
EAN: 2147483647
Year: 2003
Pages: 174
Authors: John Philcox

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net