27 May 2011

Locating the Address from the DHCP Server

No matter what OS the client uses, you can locate the MAC address from the DHCP server in several ways. One method is to configure the DHCP client to use DHCP and then activate its network interface. The DHCP client should pick up an address. You can then examine the DHCP server’s logs for evidence of a lease granted for that address. The DHCP leases file typically (/var/lib/dhcp/dhcpd.leases) should include a multiline entry identifying the IP address and MAC address.

Typing grep dhcpd /var/log/messages | tail -n 1 or grep dhcpd /var/log/daemon.log | tail -n 1 as root should also reveal an entry with the IP address and MAC address in question. (If some other DHCP activity occurs between the target system’s lease being granted and you typing this command, though, that activity will show up instead.

Increase the number from 1 to 2 or higher to reveal earlier entries.) Finally, you can type ping -c 1 ip.addr; /sbin/arp ip.addr, where ip.addr is the IP address, to learn the MAC address of the computer. This last approach will also work if you temporarily configure the future DHCP client with a static IP address.

biOos

No comments: