Variations on ARP

From rukapedia
Revision as of 15:40, 11 February 2006 by Peter (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Various Plazes tools depend on the presence of the arp command in the OS to obtain the MAC address of the default gateway. And various implementations of arp return results in their own fashion. On this page I'm starting to assemble a list of variations on the output of arp to aid in developing a standard library of code that will allow all variations to be used.

Mac OS X

Usage:

usage: arp [-n] hostname
       arp [-n] -a
       arp -d hostname [pub]
       arp -d -a
       arp -s hostname ether_addr [temp] [pub]
       arp -S hostname ether_addr [temp] [pub]
       arp -f filename

Sample output, using the IP address of the default gateway:

# arp 192.168.1.1
? (192.168.1.1) at 0:14:bf:8f:53:2d on en0 [ethernet]

Linux

RedHat Enterprise Linux v4

Usage:

Usage:
  arp [-vn]  [<HW>] [-i <if>] [-a] [<hostname>]             <-Display ARP cache
  arp [-v]          [-i <if>] -d  <hostname> [pub][nopub]    <-Delete ARP entry
  arp [-vnD] [<HW>] [-i <if>] -f  [<filename>]              <-Add entry from file
  arp [-v]   [<HW>] [-i <if>] -s  <hostname> <hwaddr> [temp][nopub] <-Add entry
  arp [-v]   [<HW>] [-i <if>] -s  <hostname> <hwaddr> [netmask <nm>] pub  <-''-
  arp [-v]   [<HW>] [-i <if>] -Ds <hostname> <if> [netmask <nm>] pub      <-''-

        -a                       display (all) hosts in alternative (BSD) style
        -e                       display (all) hosts in default (Linux) style
        -s, --set                set a new ARP entry
        -d, --delete             delete a specified entry
        -v, --verbose            be verbose
        -n, --numeric            don't resolve names
        -i, --device             specify network interface (e.g. eth0)
        -D, --use-device         read <hwaddr> from given device
        -A, -p, --protocol       specify protocol family
        -f, --file               read new entries from file or from /etc/ethers

  <HW>=Use '-H <hw>' to specify hardware address type. Default: ether
  List of possible hardware types (which support ARP):
    strip (Metricom Starmode IP) ash (Ash) ether (Ethernet) 
    tr (16/4 Mbps Token Ring) tr (16/4 Mbps Token Ring (New)) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) rose (AMPR ROSE) arcnet (ARCnet) 
    dlci (Frame Relay DLCI) fddi (Fiber Distributed Data Interface) hippi (HIPPI) 
    irda (IrLAP) x25 (generic X.25)

Sample output, using the IP address of the default gateway:

# arp 192.168.1.1
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.1              ether   00:14:BF:8F:53:2D   C                     eth0

Windows