Finding a device IP Address

If you are developing software for an Ethernet (or Wifi) device, you’ll need to access the board for debugging and/or testing purpose. If your board does not have user interface or the serial port is not available, you’ll have to find the IP address (assuming it is using DHCP) before accessing the board thru telnet or ssh.

A simple way to do that is to ping the broadcast address and check the arp table.

> ping -b 192.168.0.255

WARNING: pinging broadcast address
PING 192.168.0.255 (192.168.0.255) 56(84) bytes of data.
64 bytes from 192.168.0.246: icmp_seq=0 ttl=64 time=0.018 ms
64 bytes from 192.168.0.101: icmp_seq=0 ttl=64 time=0.217 ms (DUP!)
64 bytes from 192.168.0.246: icmp_seq=1 ttl=64 time=0.023 ms

> arp -i eth0

arp -i eth1
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.0.103            ether   00:50:FC:00:00:01   C                     eth1
192.168.0.109            ether   00:13:20:01:01:01   C                     eth1

If you cannot find your device, it may be configured to ignore ping broadcast (in order to avoid denial-of-service attack). To enable it, make sure /proc file system is mounted and type:

echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

Leave a Reply

avatar
  Subscribe  
Notify of