Can I Check The Mac Address On DHCP From My Command Line

Home » CentOS » Can I Check The Mac Address On DHCP From My Command Line
CentOS 1 Comment

Hi,

I have an interesting problem. I want to be able to verify that my hostname, ipaddress, and mac address are correct in the DNS/DHCP. I have the values, how do I compare.

I am able to use NSLOOKUP for the hostname=ip confirmation

How do I do the ip addresss = mac address comparison

I tried arp and a few other things. Almost everything on google says either to logon to DHCP (which I do not own) or use arp, which is not giving the desired results.

I provided the mac address, ip address, and host name I want to find out if a missed entry might be causing the pxe boots and network problems I am having to fail.

Dan

One thought on - Can I Check The Mac Address On DHCP From My Command Line

  • Checking the arp table on your Linux host is what you want to do.

    As long as there’s steady traffic from the hosts, they’ll show up in the arp table. What I normally do when I’m locating a host via the Layer2
    address (IP phone, etc) is to ping the broadcast address. From there the hosts on that Layer2 segment respond back and you have them in your arp table. If you were to use a continuous ping, you’ll find the ping utility tells you there were DUPs (duplicate packets) as there should be since you have multiple hosts replying back.

    Say your subnet is 192.168.1.0/24 (255.255.255.0 netmask)
    ping 192.168.1.255 -b -c1

    From there you can grep the arp table:
    Since you’ll know the interface that subnet is off of:
    arp -i ethX | grep 00:11:22:33:44:55
    Or you could grep through the entire arp table:
    arp -a | grep 00:11:22:33:44:55

    There is no guarantee that pinging the broadcast address will work all the time [0], so your other option is to run ping in a loop [1] or use nmap to ping sweep [2].

    [0] http://reggle.wordpress.com/2011/09/14/broadcast-pings-do-they-work/
    [1] http://www.commandlinefu.com/commands/view/3144/ping-sweep-without-nmap
    [2] http://nmap.org/book/man-host-discovery.html

    Some of your hosts may not have recent traffic, so their arp entry(ies) on your host became stale and were removed.

    I’ve found it useful to run tcpdump (while I’m connected to the same Layer2
    network) and watch for multicast traffic (ex: igmp) from hosts when they’re booting especially. That has helped me determine addresses on HP Jet Direct printer cards and various other devices.