Traduisez - Übersetzen - Traduzca - Traduza - Tradurre - Translate

VanLUG Email Archive

Re: ADSL DHCP

Wesley Terpstra
Sun, 18 Oct 1998 16:52:34 -0700 (PDT)

> > My startup script is:
> > ] <snip>
> > ]# Setup my router
> > ]route add default gw $ROUTER

> Slava wrote:
> When I use dhcpcd under debian I had /etc/init.d/dhcpc to start and stop
> dhcpcd and did initialization fot eth0 jpico /etc/dhcpc/config
> # List here the interface that the dhcpcd daemon should use.
> # The default is to assign an IP address to eth0.
> # If you want to disable the daemon, enter "none" here.
> #IFACE=eth0
> IFACE ="your externel NIC" check for your case

Yes. dhcpc starts&stops it and /.../config is the config, but you need to
tell dhcpcd to run a script after it gets an IP.

Here's my modified /etc/init.d/dhcpcd
====
#! /bin/sh
# <snip>

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/dhcpcd
NAME=$0
SCR=/etc/dhcpc/startup

test -f $DAEMON || exit 0

# Load up our config file, if present.
if [ -f /etc/dhcpc/config ] ; then
source /etc/dhcpc/config
fi

case "$1" in
start)
if [ "$IFACE" = "none" ] ; then
echo "DHCP client daemon is disabled."
exit
fi
echo -n "Starting DHCP client daemon: dhcpcd"
start-stop-daemon --start --quiet --exec $DAEMON -- -c $SCR $IFACE
echo "."
;;
stop)
echo -n "Stopping DHCP client daemon: dhcpcd"
start-stop-daemon --stop --quiet --exec $DAEMON
echo "."
;;
restart)
$0 stop
$0 start
;;
force-reload)
echo "/etc/init.d/$NAME: force-reload: not implemented"
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop}"
exit 1
;;
esac

exit 0
====

The only diff is the -c $SCR before $IFACE
and the
SCR=/etc/dhcpc/startup

You can then make /etc/dhcpc/startup:
====
#!/bin/sh
# Setup my router
route add default gw $ROUTER
====

-rwxr-xr-x 1 root root 407 Sep 23 17:47 /etc/dhcpc/startup

Then it will config your router nicely for you.

---
Primary e-mail: 


, alternate: terpstra@unixg.ubc.ca Residence: 204 Cariboo, Place Vanier, UBC, Canada Company page: www.singularity.home.ml.org, personal: www.iota.ml.org