These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/ARP Tables And Routing

Classnotes | UNIX02 | RecentChanges | Preferences

Showing revision 1


A mechanism is needed to map IP addresses onto the addresses of the underlying network. The mechanism used is the Address Resolution Protocol (ARP). The idea underlying ARP is exactly what most people do when they have to find Mr. X in a throng of 150 people: the person who wants him calls out loudly enough that everyone in the room can hear them, expecting him to respond if he is there. When he responds, we know which person he is.

ARP is not confined to Ethernet, but is used on other types of networks, such as ham radio.

The Linux Kernel keeps a cache of ARP entries. You can access and manipulate this cache using the arp command. arp has the following usage:

 arp [-v] [-t hwtype] -a [hostname]
 arp [-v] [-t hwtype] -s hostname hwaddr
 arp [-v] -d hostname [hostname...]

All hostname arguments may be either symbolic hostnames or IP addresses in dotted quad notation.

The first invocation displays the ARP entry for the IP address or host specified, or all hosts known if no hostname is given. For example, on my Linux box at home, this might give something like this:

 sam@rygel:~$ arp -a ( at 00:01:42:F8:1F:54 [ether] on eth0

and my work box may give something like this:

 [hart@einstein hart]$ /sbin/arp -a
 astro.physics.Arizona.EDU ( at 00:00:F8:0C:25:5C [ether] on eth0
 foonly.physics.Arizona.EDU ( at 00:E0:18:B9:79:1C [ether] on eth0 ( at 00:01:B3:1A:1F:D4 [ether] on eth0

The -s option is used to permanently add hostname's Ethernet address to the ARP tables. The hwaddr argument specifies the hardware address, which is by default expected to be an Ethernet address specified as six hexadecimal bytes separated by colons. You may also set the hardware address for other types of hardware, using the -t option.

For some reason, ARP queries for the remote host sometimes fail, for instance when its ARP driver is buggy or there is another host in the network that erroneously identifies itself with that host's IP address; this problem requires you to manually add an IP address to the ARP table. Hard-wiring IP addresses in the ARP table is also a (very drastic) measure to protect yourself from hosts on your Ethernet that pose as someone else.

Invoking arp using the -d switch deletes all ARP entries relating to the given host. This switch may be used to force the interface to re-attempt obtaining the Ethernet address for the IP address in question. This is useful when a misconfigured system has broadcasted wrong ARP information (of course, you have to reconfigure the broken host first).

IP Routing

You may wonder how a host can reach an Internet address that may be on a different network halfway around the world. The answer to this question involves routing, namely finding the physical location of a host in a network.

Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions | View current revision
Edited April 25, 2003 9:08 pm (diff)
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.