15.2 The ARP Command

   


The arp command can be used to output the ARP table (ARP cache) of a computer. It can also be used to manipulate the ARP table (e.g., to create permanent entries or delete entries).

The following options are available for the arp command:

  • Display the ARP table: you can use option -a when running the arp command to view the ARP table of a computer:

     root@tux # arp -a IP address HW type HW address 129.25.10.97 10Mbit/s Ethernet 49:72:16:08:80:70 129.25.10.72 10Mbit/s Ethernet 49:72:16:08:64:14 129.25. 10.81 10Mbit/s Ethernet 49:17:92:96:96:96 

    The first column shows the IP address of the destination computer; the second column shows the LAN category (e.g., 10-mbps Ethernet); the last column shows the layer-2 address of the network adapter.

    If the word incomplete appears in an entry in the last column upon repeated calls, then this means that the network device specified by the entry has failed or is defective.

  • Address format: In addition to Ethernet, ARP is also used in other broadcast-enabled LAN technologies (e.g., AX.25 amateur radio networks and token ring) for address resolution. These network technologies may use different address formats. arp shows the address format used in the second column. Notice that arp shows only the entries for Ethernet addresses, by default. To view a list of AX.25 addresses, you have to use the -t option with the command: arp -a -t ax25.

  • Deleting ARP entries: You can use arp with the option -d computer to remove the entry of that computer. This forces a new ARP request upon the next request for the layer-2 address of the specified computer. Deleting an ARP address mapping can be useful when a computer's configuration is wrong or when the layer-2 address has changed for example, when a network adapter has been replaced.

    To avoid this case, ARP entries are automatically declared invalid after a certain period of time. This period is in the range of a few minutes, so that the replacement of a network adapter should actually not cause any problem.

  • Setting ARP entries: It can sometimes be useful to add an entry manually to the ARP table. The option -s computer layer-2-address is available for such cases. It can also be used when ARP requests to a specific computer are not answered, because of faulty or missing ARP instances. The option -s can also be useful when a second computer in the same LAN identifies itself erroneously with the same IP address and replies sooner to the ARP request. The following command adds the computer tux having layer-2 address 49:72:16:08:64:14 to the ARP table: arp -s tux 49:72:16:08:64:14.

    In contrast to entries determined automatically in the ARP cache, entries created with the option -s are not removed after a certain period; they remain in the ARP cache until the computer restarts (static entry).


       


    Linux Network Architecture
    Linux Network Architecture
    ISBN: 131777203
    EAN: N/A
    Year: 2004
    Pages: 187

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