how to run udcpc
Rory Slegtenhorst
rory.slegtenhorst at gmail.com
Sun Dec 17 06:20:04 PST 2006
satpal,
As Denis already explained, the script is a required feature of udhcpc.
As soon as udhcpc gets a lease, it runs the script setting various
variables you can then use.
They include your IP, netmask, DNS servers etc.
Within the script you are required to take appropiate measures eg.
Enable the interface using ifconfig, filling your resolv.conf with the
dns info, setting up your default gatewat.
udhcpc does nothing of that kind!!!!!
You obviously should read the manual about udhcp as I'm working with
it too and it works like a charm :)
Here's a copy of /usr/share/udhcpc/default.script:
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim at Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
/sbin/ifconfig $interface 0.0.0.0
echo "0" > /tmp/udhcpc_lease
;;
renew|bound)
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
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
route add default gw $i dev $interface
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
echo "1" > /tmp/udhcpc_lease
;;
leasefail)
echo "0" > /tmp/udhcpc_lease
;;
*)
echo "uDHCPc $1"
;;
esac
exit 0
Cheers mate
--
Rory Slegtenhorst
rory dot slegtenhorst at gmail dot com
More information about the busybox
mailing list