UNIX Hints & Hacks |
||||||||||||||||||||||
Chapter 2: Networking |
|
|||||||||||||||||||||
|
2.9 Get the Ethernet Address with arp
When you need an Ethernet (MAC) address and your system doesn't have a command to support displaying it, arp outputs the information needed.
Flavors: AT&T, BSD
Syntax:
arp hostname arp -a
telnet in to a remote host that is on the same local segment of the network. Two commands are available within the arp command; one searches the table for a specific host and the other displays all the entries in the table.
star 23% telnet rocket Trying 206.19.11.5... Connected to rocket. Escape character is '^]'.
IRIX (rocket) login: johndoe Password:
IRIX Release 6.4 IP22 rocket Copyright 1987-1996 Silicon Graphics, Inc. All Rights Reserved. Last login: Sun Sep 01 01:17:42 PDT 1998 by UNKNOWN@rocket
rocket 1% arp star star (206.19.11.203) at 8:0:69:9:72:91
rocket 2% arp -a pluto (206.19.11.10) at 0:60:b0:c4:2b:60 star (206.19.11.203) at 8:0:69:9:72:91 moon (206.19.11.161) at 0:e0:b0:e3:d7:49 mars (206.19.11.201) at 0:c0:4f:87:91:ff
rocket 3% exit Connection closed by foreign host. star 24%
The arp table automatically maintains an entry listing for each machine that has recently communicated with the local host. This arp table can also be manually modified to add or delete hosts in the table.
Some flavors of UNIX do not log the Ethernet address in a file or even have a command that returns the address to STDOUT. In most other cases the only way to get the address is to reboot the machine and get the address while the kernel probes the hardware on the system.
Because the Ethernet address is a unique ID, the address is requested by vendors for securing a software license key on the products. It is also needed for diagnosing network problems. When sniffers and packet filtering software monitor the network, they monitor traffic by the Ethernet addresses of the machines talking on the network.
Man pages:
arp
World Wide Web:
Etherman--ftp://ftp.physics.ohio-state.edu/unix/
UNIX Hints & Hacks |
||||||||||||||||||||||
Chapter 2: Networking |
|
|||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.