Thread View: comp.os.linux.networking
2 messages
2 total messages
Started by Bob
Mon, 18 Jan 1999 00:00
dhcpcd gets dynamic IP and nameserver
Author: Bob
Date: Mon, 18 Jan 1999 00:00
Date: Mon, 18 Jan 1999 00:00
53 lines
2447 bytes
2447 bytes
Debian's dhcpcd .70-5 deb pkg wasn't working with my Intel eth0
and potato kernel 2.1.125 so I couldn't get a DSL account. Now I'm set,
thanks to Sergei Viznyuk. /etc/dhcpc/ has a file written by dhcpcd
which has my IP and the DNS nameserver assigned by ISP.
To get your IP assigned dynamically as by dial-up or ADSL or
cable modem, and to find out nameserver IP's--it's also necessary
to upgrade dhcpcd for kernels 2.1.125 and up, and for certain
netcards such as Intel--
ftp://phystech.com/pub
get the latest dhcpcd dhcp client by Sergei Viznyuk [applause, cheers]
which today is 1.3.17-pl2
untar ungzip cd
make ; make install
Now you have /sbin/dhcpcd
Get your old dhcpcd out of the way--it was /usr/sbin/dhcpcd
In Debian it seemed logical to load dhcpcd using /etc/init.d/network
script--
most of this varies according to site-- "dhcpcd -h username" wasn't
working
from /etc/init.d/dhcpc script's line using start-stop-daemon, so--
#! /bin/sh
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
ISP_USER_ID=username
ifconfig lo 127.0.0.1
route add -net 127.0.0.0 netmask 255.0.0.0 lo
if dhcpcd -h $ISP_USER_ID -d eth0 ; then
echo -n "DHCP succeeded..."
logger "DHCP succeeded..."
else
echo -n "DHCP failed..."
logger "DHCP failed... "
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
route add ${NETWORK} famlan
[ "${GATEWAY}" ] && route add default gw ${GATEWAY} metric 1
fi
-Bob Dodds
dhcpcd cuter scripts
Author: Bob
Date: Fri, 12 Feb 1999 00:00
Date: Fri, 12 Feb 1999 00:00
53 lines
2426 bytes
2426 bytes
Bob wrote:
> To get your IP assigned dynamically as by dial-up or ADSL or
> cable modem, and to find out nameserver IP's--it's also necessary
> to upgrade dhcpcd for kernels 2.1.125 and up, and for certain
> netcards such as Intel--
>
> ftp://phystech.com/pub
>
> get the latest dhcpcd dhcp client by Sergei Viznyuk [applause, cheers]
> which today is 1.3.17-pl2
>
> untar ungzip cd
>
> make ; make install
>
> Now you have /sbin/dhcpcd
>
> Get your old dhcpcd out of the way--it was /usr/sbin/dhcpcd
#! /bin/sh
# /etc/init.d/networks
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
# uncomment and edit username for @Home cable modems--
#OPT_USER_ID="-h username"
ifconfig lo 127.0.0.1
route add -net 127.0.0.0 netmask 255.0.0.0 lo
if dhcpcd $OPT_USER_ID -d eth0 ; then
/usr/local/bin/dhcp_host_ip
echo "DHCP succeeded..."
logger "DHCP succeeded..."
fi
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXXa00375 installed on Fri Feb 12 00:58:32 1999)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
SHELL=/bin/sh
PATH=/usr/local/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
*/20 * * * * exec /usr/local/bin/dhcp_host_ip
#!/bin/sh
# /usr/local/bin/dhcp_host_ip
# cron script to transfer dhcpcd's IP to /etc/hosts
PATH=/sbin:/bin:/usr/bin
HOST=$( hostname )
HOST_IP=$( ifconfig eth0 | grep "inet addr" - | cut -d: -f2 - | cut -d" "
-f1 - )
LINE_OLD=$( grep -G ${HOST}'$' /etc/hosts | grep -v '^;' - )
LINE_NEW=${HOST_IP}" "${HOST}
sed s/"$LINE_OLD"/"$LINE_NEW"/ /etc/hosts > /tmp/.hosts.tmp
mv /tmp/.hosts.tmp /etc/hosts
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads