Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have some computers I need to reinstall over the network, but for the install to work correctly, the computer needs to have its MAC address registered in the DNS/DHCP so that it'll be recognized and get the right IP address and thus policies from AD.

The problem is that the computer often isn't registered in the DNS/DHCP for some reason, and that won't be noticed before a late stage in the reinstall-process, and thus it's wasting a lot of time to troubleshoot this way.

I'm wondering if there is some way to query a DNS-server with a MAC address, and see if its properly registered to an IP address?

(I don't have access to AD.)

share|improve this question

migrated from stackoverflow.com Jan 1 '10 at 16:54

This question came from our site for professional and enthusiast programmers.

7 Answers 7

AFAIK, there's no way to query a DHCP server with a MAC address, but you can use ping and the ARP table on your computer.

ping -b <broadcast address>
arp -a

will give you the MAC and IP addresses of all the hosts in the network.

share|improve this answer
    
On WinXP Prof. it does not work. The option -b does not exist. –  furtelwart Mar 6 '09 at 12:54
    
try removing -b. –  Can Berk Güder Mar 6 '09 at 13:01
    
I haven't used Windows in many years. –  Can Berk Güder Mar 6 '09 at 13:02
    
Does not show the wanted effect. The arp table is as empty as before and the ping command returns a time out. –  furtelwart Mar 6 '09 at 14:46
1  
Works on my computer™ –  Can Berk Güder Mar 6 '09 at 17:25

Depending on the size of your network, it can be very quick to scan every possible machine.


device_hwaddr="XX:XX:XX:XX:XX"

# we ping every ip in the range 192.168.0.*
ip_last_number=0
while test $ip_last_number -ne 255; do
    ping -c 1 192.168.0.$ip_last_number >/dev/null 2>&1 &
    ip_last_number=$(($ip_last_number + 1))
done

# we search in the arp table if their is our device
echo $(arp|grep $device_hwaddr)

share|improve this answer
    
Thanks for comment, although it wouldnt work as it wouldnt be accessable/answering, seeing how it wouldnt have been setup yet. What I'd need is some way to query the DNS with a MAC-adress to see what its IP should be. –  Duveit Dec 16 '09 at 14:52

You can use the Reverse Address Resolution Protocol (RARP). It resolves IP addresses to a given MAC address via a broadcast. It's old (even obsolte via DHCP), but it should work.

share|improve this answer
    
RARP is deprecated. –  Can Berk Güder Mar 6 '09 at 12:54
    
Besides, RARP is used to determine the host's own IP address. Depending on how the OP is planning to use this, he might be looking for something like InARP, which, AFAIK, is also deprecated. –  Can Berk Güder Mar 6 '09 at 12:57
    
s/deprecated/obsoleted/g –  Can Berk Güder Mar 6 '09 at 13:01
    
I inserted your comment. –  furtelwart Mar 6 '09 at 14:45
    
How would you use RARP? Any standard windows commands that would be capable? –  Duveit Mar 6 '09 at 18:27

Is it only at install time that these machines need a certain IP address to set policy? If not, why aren't they getting the correct addresses at install time? Do they get assigned the correct IP later when they are deployed?

It would seem to me that creating static entries for each machine's MAC address in the DHCP server is the solution you're looking for. In your post it sounds like you can't do that yourself, but if it's necessary your sys-admin will probably do it for you. He can also probably allow you read-only access to all static address assignments (so you can check on them before installation).

share|improve this answer
    
All machines have static IP set through the DHCP server based upon their physical MAC address, and yeah, I'd need to ask the sysadmin about actual mapping for MAC/IP's, and it's a bit of a hassle contacting him all the time a computer doesnt seem to get recognized. But maybe I can get that access. –  Duveit Mar 9 '09 at 7:35

I had the same problem: I had a MAC address, but the IP address changed on me. Broadcast ping did not seem to work for me on Windows XP, and our Linux machines were on a different subnet, so brute force led me to:

for /l %i in (1,1,254) do ping -n 1 -l 1 -w 1 10.11.2.%i

Where 10.11.2.0 is my subnet. Then I could do

arp -a

and look/grep for my known MAC address. (Note that Windows uses the - separator and Linux uses the : in MAC addresses).

You could extend this for a larger subnets too, with extra for loops.

share|improve this answer

Dynamic IP addresses usually are chosen from a disjunctive range. For example, static 192.168.0.0/25, dynamic 192.168.0.128/25. It depends on your configuration.

If you don't have access to the DHCP server's configuration, I don't think there are other ways to check whether it's static or dynamic.

share|improve this answer

DNS server: no.

But, with DHCP server, you can use the [netsh DHCP] (http://technet.microsoft.com/en-us/library/bb490941.aspx) command.

What I usually like to do is just pull the entries from the specific DHCP range and then pipe only output that matches your MAC address. i.e.

Netsh DHCP server \\<myserver> scope <192.168.0.0>  show clients | findstr "<YourMACAddressHere>"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.