# Discover the IP address assigned by DHCP

<abstract>
By default the Acme boards get the IP address from the DHCP server 
on your LAN this article explains how to discover its IP. 
</abstract>

##Reading the IP address from the Debug Port console

To use this method you need a [Debug Port Interface](/DPI) or an [USB to 3V TTL](/USB-3V-SER). 

Plug the DPI interface on the debug port and run on your PC a terminal emulator like minicom (Linux) or putty (Windows), 
select the serial port allocated for the DPI interface and configure it as 115200,8,N,1 then type [Enter].

Type this command:

	ifconfig eth0
	
	eth0      Link encap:Ethernet  HWaddr 00:04:25:ac:00:46
	          inet addr:192.168.1.29  Bcast:192.168.1.255  Mask:255.255.255.0
	          inet6 addr: fe80::204:25ff:feac:46/64 Scope:Link
	          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	          RX packets:2857 errors:33 dropped:0 overruns:0 frame:29
	          TX packets:270 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:1000
	          RX bytes:175887 (171.7 KiB)  TX bytes:12757 (12.4 KiB)
	          Interrupt:21 Base address:0x4000

The IP address assigned is indicated as <b>inet addr</b>. In this case it is equal to <b>192.168.1.29</b>. If no address is listed  your DHCP 
is probably not working well or the netcable is detached.

##Getting the IP address from the DHCP server on your LAN

If you have access to the administrator panel of the DHCP on your LAN this is probably the easiest way to discover the IP 
address assigned to the Acme board. You can identify the IP easily by searching for hostname <b>netusg20</b> or <b>ariag25</b> or 
MAC address that starts with <b>00:04:25:..:..:..</b>.

##Using a shell script

A  method (although not very fast) to discover your Acme board IP address is using this simple script:

<pre class="prettyprint">
#!/bin/sh
echo "Usage: $0 <base_network_ip>"
i=1
while [ "$i" -lt 254 ]
do
  ping -c 1 -W 1 "$1.$i" > /dev/null
	if [ "$?" -ne 1 ]
	then
 		echo "$1.$i SUCCESS !"
	else
 		echo "$1.$i fail"
	fi
	i=$(( $i + 1 ))
done
</pre>

Save it in a file (for example scanip.sh) and enable as executable file with chmod +x scanip.sh then execute providing the base address of your LAN. For example:

<pre class="minicom">
./scanip.sh 192.168.1
</pre>

It will ping all the addresses from 1 to 254 on your LAN in that way:

<pre class="minicom">
Usage: ./scanip.sh <base_network_ip>
192.168.1.1 SUCCESS !
192.168.1.2 SUCCESS !
192.168.1.3 fail
192.168.1.4 fail
192.168.1.5 fail
192.168.1.6 fail
...
</pre>

The timeout on fail condition is 1 second so the test needs max 254 second to scan a C class network.

@shop='DPI'



