Is there a way be which I can find IP address on a device on the LAN of which I know the MAC address.

I'm trying to automate something for which I need to know the IP of the device which may change. As I'll be using it in the perl script and hopefully port it to C/C++ in future I need a way to do it from the CLI no GUI tool .

The network itself? No.
How do your machines get IP addresses?
Is there any dedicated DHCP server?
If yes, what's the OS? Could you query your server's arp cache through your perl script?
If no (i.e. your router has a DHCP server role as well), I'm afraid you can't do much, apart from trying to find a way to keep your arp cache up-to-date.

My machine gets IP from DHCP server, But the devices are assigned static IP but the people in charge of those devices keep on changing the IP.

Quote:

Is there any dedicated DHCP server?

There must be a DHCP derver, but as those devices are assigned ststic IP I dont know if there's any point querring DHCP server on top of that half of the subnet IP are reserved of static assignments so DHCP server will not use those IP.

Quote:

If yes, what's the OS? Could you query your server's arp cache through your perl script?

Chances are that it could be a cysco router. But I don't know network administrator will allow me to do that.

Quote:

If no (i.e. your router has a DHCP server role as well), I'm afraid you can't do much, apart from trying to find a way to keep your arp cache up-to-date.

Hmm. Then I'll need to have entire 10.30.1.X subnet into my systems arp cache. One way I could of ding this is to ping all devices (could be very time consuming) and what if I just finished runing ping and somebody changed the IP of one of the devices .

To fill your arp table, just ping the broadcast address for the subnet. For example: ping 192.168.0.255. That will cause every machine on that subnet to respond, and you will get arp entries for every machine on the subnet.

arpwatch is a really handy (passive) layer 2 sniffer that can help identify network problems.

---

I'd also add to all this:

Quote:

Originally Posted by rex

But the devices are assigned static IP but the people in charge of those devices keep on changing the IP.

This is the real problem. The network needs to be better managed, IMO. We don't call one another up and say "hey, can I get your MAC address?" for network communication purposes. There should be a coherent network design and a better change control process in place.

As in the OP's case, suppose host A has an entry in the arp cache for host B. B changes its IP before A's arp cache expires.
Now if A tries to send a packet (using the stale cache entry) to B then what will happen?
And is it documented or implementation dependent?