0

I have router in bridge mode which is installed Openwrt and I want to find IP address of devices which are connected to the router. Since router is in bridge mode, I can not find IP from DHCP leases, but I can find mac address of connected devices.

First thing came to mind is broadcast to all network and finding IP address from ARP but this didn't work for me because when I broadcast to the network I can not take response from some of the devices and I am thinking that this may be related my modem's firewall settings.

So, my question is how can I find IP address of device programmatically from mac address ?

  • arp -a should do it – Chopper3 May 20 '16 at 11:51
  • I tried but this is not work because If I didn't ping the device before, device don't seen on arptable. – Enes Aldemir May 20 '16 at 11:58
  • well do a ping scan of your range then – Chopper3 May 20 '16 at 12:06
1

Install nmap to your OpenWRT router:

opkg update;opkg install nmap

Scan all network.For example,the network is: 203.120.12.0/24

 nmap -v -sn 203.120.12.0/24 --open

It should show something like this:

Nmap scan report for 203.120.12.253
Host is up (0.00016s latency).
MAC Address: 04:18:D6:83:90:07 (Ubiquiti Networks)

Then u can use the grep command to get IP address from MAC address

0

One way to find out the IP address of a device is with a protocol analyser such as wireshark. If you capture enough traffic from a network interface, you should see some broadcast traffic generated by just about every device on the network. You can then filter for packets with a source MAC matching your router.

In wireshark this filter would be eth.src == xx:xx:xx:xx:xx:xx

An advantage of this method is that it works even if your router is using an address outside of your subnet.

  • I just editted my question, I want to find ip address programmatically because I will use this ip address with another program. So, wireshark does not work for me. – Enes Aldemir May 20 '16 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.