Article View: comp.os.linux.networking
Article #522dhcpcd cuter scripts
From: 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
Technical Details
Message-ID:
<36C4F953.F77C1BCA@erols.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36A2E633.CEDA234A@erols.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10669a,cdbdb2bd48b05dcd X-Google-Attributes: gid10669a,public X-Google-Thread: 11663c,cdbdb2bd48b05dcd X-Google-Attributes: gid11663c,public X-Google-Thread: fb7a0,cdbdb2bd48b05dcd X-Google-Attributes: gidfb7a0,public From: Bob <recbo@erols.com> Subject: dhcpcd cuter scripts Date: 1999/02/12 Message-ID: <36C4F953.F77C1BCA@erols.com> X-Deja-AN: 443855778 Content-Transfer-Encoding: 7bit References: <36A2E633.CEDA234A@erols.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rcn.com X-Trace: P0Z20/XXIz8Jgn1SO9ZO/PI1shw98FUwGFqytrFC2us= Mime-Version: 1.0 NNTP-Posting-Date: 13 Feb 1999 03:38:11 GMT Newsgroups: comp.os.linux.networking,linux.debian.user,dc.org.linux-users