I have a custom board with LPC1788, 32Mbyte SDRAM, 128 Mbyte Nand flash, on 108Mhz. I download the emcraft uclinux and networking project.
The poroblem is the busybox udhcpc command:
init started: BusyBox v1.17.0 (2014-12-05 16:25:33 CET)
~ # ifconfig
~ # udhcpc -f -i eth0
udhcpc (v1.17.0) started
Setting IP address 0.0.0.0 on eth0
Sending discover 0...
Sending discover 0...
Sending select for 192.168.0.27...
Received DHCP NAK
Sending discover 0...
Sending select for 192.168.0.27...
Received DHCP NAK
Sending discover 0...
Sending select for 192.168.0.27...
Received DHCP NAK
^C
~ # ifconfig
eth0 Link encap:Ethernet HWaddr C0:B1:3C:88:88:84
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:37 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7432 (7.2 KiB) TX bytes:2278 (2.2 KiB)
Interrupt:28 Base address:0x4000
~ #
The u-boot is not send bootargs networking option. udhcpc is always received NAK
this is the default script:
#!/bin/sh
# udhcpc script edited by Tim Riker
RESOLV_CONF="/etc/resolv.conf"
[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
NETMASK=""
[ -n "$subnet" ] && NETMASK="netmask $subnet"
BROADCAST=""
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
case "$1" in
deconfig)
echo "Setting IP address 0.0.0.0 on $interface"
ifconfig $interface 0.0.0.0
;;
renew|bound)
echo "Setting IP address $ip on $interface"
ifconfig $interface $ip $NETMASK $BROADCAST
if [ -n "$router" ] ; then
echo "Deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
for i in $router ; do
echo "Adding router $i"
route add default gw $i dev $interface
done
fi
echo "Recreating $RESOLV_CONF"
echo -n > $RESOLV_CONF-$$
[ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$
for i in $dns ; do
echo " Adding DNS server $i"
echo "nameserver $i" >> $RESOLV_CONF-$$
done
mv $RESOLV_CONF-$$ $RESOLV_CONF
;;
esac
exit 0
The 192.168.0.27 is correct ip address from my router, but why received nak? Why not work the udhcpc, this is a default project I not modify, I don't understand. Please give me an advice!
udhcpc is doing a discovery, and getting an offer. For some reason the dhcp server is responding with a NAK when we are asking for the address. Perhaps the dhcp server wants some specific fields that we are not requesting? Logs on the dhcp server should give some idea. If you don't have logs, running tcpdump on another node might help debug. Something like: