1400 lines
27 KiB
HTML
1400 lines
27 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Client Setup</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
|
|
REL="HOME"
|
|
TITLE="DHCP mini-HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="DHCP protocol"
|
|
HREF="x69.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="DHCP Server Setup"
|
|
HREF="x369.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>DHCP mini-HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x69.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x369.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="AEN74"
|
|
>3. Client Setup</A
|
|
></H1
|
|
><P
|
|
>Currently there are three different DHCP client programs for Linux, dhcpcd,
|
|
pump and dhclient. This mini-HOWTO deals primarily with dhcpcd.</P
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN77"
|
|
>3.1. Downloading the client daemon (dhcpcd)</A
|
|
></H2
|
|
><P
|
|
>Depending on your distribution you might have to download the
|
|
DHCP client daemon. If you want to compile it from the source you
|
|
package you need is called dhcpcd and the current version is 1.3.18.
|
|
It is maintained by Sergei Viznyuk <TT
|
|
CLASS="EMAIL"
|
|
><<A
|
|
HREF="mailto:sergei@phystech.com"
|
|
>sergei@phystech.com</A
|
|
>></TT
|
|
> and
|
|
today it comes as a binary package with most distributions.</P
|
|
><P
|
|
>dhcpcd source can be downloaded from following locations</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ftp://ftp.phystech.com/pub/"
|
|
TARGET="_top"
|
|
>ftp://ftp.phystech.com/pub/</A
|
|
> (Primary site)</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="http://www.cps.msu.edu/~dunham/out/"
|
|
TARGET="_top"
|
|
>http://www.cps.msu.edu/~dunham/out/</A
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>Then follow the instructions below. They should be the same.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="SLACKWARE"
|
|
>3.2. Slackware</A
|
|
></H2
|
|
><P
|
|
>You can download the latest copy of the DHCPcd from any Metalab mirror
|
|
or following:</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ftp://metalab.unc.edu/pub/Linux/system/network/daemons"
|
|
TARGET="_top"
|
|
>ftp://metalab.unc.edu/pub/Linux/system/network/daemons</A
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><A
|
|
HREF="ftp://ftp.phystech.com/pub/"
|
|
TARGET="_top"
|
|
>ftp://ftp.phystech.com/pub/</A
|
|
> (Primary site)</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>Download the latest version of <TT
|
|
CLASS="FILENAME"
|
|
>dhcpcd.tar.gz</TT
|
|
>. </P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Unpack it</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>tar -zxvf dhcpcd-1.3.18pl1.tar.gz</B
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>cd into the directory and make dhcpcd</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>cd dhcpcd-1.3.18pl1</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>make</B
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Install it (you have to run the following command as root)</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>make install</B
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>This will create the directory /etc/dhcpc where DHCPcd will store the
|
|
DHCP information and dhcpcd file will be copied into /usr/sbin.</P
|
|
><P
|
|
>In order to make the system initialize using DHCP during boot type:</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>cd /etc/rc.d</B
|
|
></P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>mv rc.inet1 rc.inet1.OLD</B
|
|
></P
|
|
><P
|
|
>This will move the old network initialization script into
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>rc.inet1.OLD</TT
|
|
>.
|
|
You now need to create the new <TT
|
|
CLASS="FILENAME"
|
|
>rc.inet1</TT
|
|
> script.
|
|
Following code is all you need:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>#!/bin/sh
|
|
#
|
|
# rc.inet1 This shell script boots up the base INET system.
|
|
|
|
HOSTNAME=`cat /etc/HOSTNAME` #This is probably not necessary but I
|
|
#will leave it in anyways
|
|
|
|
# Attach the loopback device.
|
|
/sbin/ifconfig lo 127.0.0.1
|
|
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
|
|
|
|
# IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the
|
|
# eth0 interface. If you're only using loopback or SLIP, don't include the
|
|
# rest of the lines in this file.
|
|
|
|
/usr/sbin/dhcpcd</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>Save it and reboot your computer.</P
|
|
><P
|
|
>When you are finished go the <A
|
|
HREF="x74.html#NAMESERVER"
|
|
>last step</A
|
|
>.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="REDHAT6"
|
|
>3.3. RedHat 6.x and Mandrake 6.x</A
|
|
></H2
|
|
><P
|
|
>DHCPcd configuration under RedHat 6.0+ is really easy. All you need to do
|
|
is start the Control Panel by typing <B
|
|
CLASS="COMMAND"
|
|
>control-panel</B
|
|
>.</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Select "Network Configuration"</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Click on Interfaces</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Click Add</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Select Ethernet</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>In the Edit Ethernet/Bus Interface select "Activate
|
|
interface at boot time" as well as select "DHCP" as "Interface
|
|
configuration protocol"</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>Please note that in RedHat 6.x Redhat as default includes a DHCP client called
|
|
pump instead of above mentioned dhcpcd. CD-ROM does include dhcpcd RPM so if you
|
|
have no luck with pump try with dhcpcd. After you install dhcpcd
|
|
(e.g. <B
|
|
CLASS="COMMAND"
|
|
>rpm -i dhcpcd-1.3.17pl2-1.i386.rpm</B
|
|
>) you
|
|
will have to make some <A
|
|
HREF="x74.html#LINUXPPC-RH6"
|
|
>changes</A
|
|
>.</P
|
|
><P
|
|
>Additional notes from Alexander Stevenson
|
|
<TT
|
|
CLASS="EMAIL"
|
|
><<A
|
|
HREF="mailto:alexander.stevenson@home.com"
|
|
>alexander.stevenson@home.com</A
|
|
>></TT
|
|
>:</P
|
|
><P
|
|
>I had no luck with DHCPcd. What finally worked for me was "pump", which
|
|
comes with Linux Mandrake 6.0 (and so I assume it is included with
|
|
RedHat as well). The command I used was:</P
|
|
><P
|
|
><B
|
|
CLASS="COMMAND"
|
|
>pump -i eth0 -h hostname</B
|
|
></P
|
|
><P
|
|
>It didn't matter what "hostname" was, but without it the server would
|
|
not respond.</P
|
|
><P
|
|
>I then changed the line in my <TT
|
|
CLASS="FILENAME"
|
|
>/sbin/ifup</TT
|
|
> script to reflect the change;
|
|
the default version does not have the -h switch, and so didn't work for
|
|
me.</P
|
|
><P
|
|
>Basically, if you're using linuxconf, and after setting the adapter to
|
|
"DHCP" it still doesn't work, try adding a "<B
|
|
CLASS="COMMAND"
|
|
>-h
|
|
hostname</B
|
|
>" to the pump line in the
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/sbin/ifup</TT
|
|
> script. My script now looks like this:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>...
|
|
if [ -n "$PUMP" ]; then
|
|
echo -n "Determining IP information for $DEVICE..."
|
|
if /sbin/pump -i $DEVICE -h hostname; then
|
|
echo " done."
|
|
else
|
|
echo " failed."
|
|
exit 1
|
|
fi
|
|
else ...</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>Another more elegant way to add hostname field is provided by Aad van der Klaauw:</P
|
|
><P
|
|
>Currently i'm configuring a gateway system at home, needed to set the
|
|
MAC address and use the '-h hostname' workaround. So I decided to
|
|
*not* change the script but to use the configure file.
|
|
In my /etc/sysconfig/network-scripts/ifcfg-eth0 I have added the following</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>DEVICE="eth0"
|
|
MACADDR="00:11:22:33:44:55"
|
|
DHCP_HOSTNAME="trigger_for_terayon"</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>Which will survive upgrades, and is imho a "cleaner" way.</P
|
|
><P
|
|
>That is it. Reboot your machine or type <B
|
|
CLASS="COMMAND"
|
|
>/sbin/ifup eth0</B
|
|
> on the command line.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN166"
|
|
>3.4. RedHat 5.x</A
|
|
></H2
|
|
><P
|
|
>DHCPcd configuration under RedHat 5.0+ is really easy. All you need to do
|
|
is start the Control Panel by typing <B
|
|
CLASS="COMMAND"
|
|
>control-panel</B
|
|
>.</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Select "Network Configuration"</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Click on Interfaces</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Click Add</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Select Ethernet</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>In the Edit Ethernet/Bus Interface select "Activate
|
|
interface at boot time" as well as select "DHCP" as "Interface
|
|
configuration protocol"</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>When you are finished go the <A
|
|
HREF="x74.html#NAMESERVER"
|
|
>last step</A
|
|
>. </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN183"
|
|
>3.5. RedHat 4.x and Caldera OpenLinux 1.1/1.2</A
|
|
></H2
|
|
><P
|
|
>DHCPcd is included in the standard RedHat distribution as an RPM and
|
|
you can find it on your distribution's CD-ROM in RPMS directory or you can
|
|
download it from:</P
|
|
><P
|
|
><A
|
|
HREF="ftp://ftp.redhat.com/pub/redhat/redhat-4.2/i386/RedHat/RPMS/dhcpcd-0.6-2.i386.rpm"
|
|
TARGET="_top"
|
|
>ftp://ftp.redhat.com/pub/redhat/redhat-4.2/i386/RedHat/RPMS/dhcpcd-0.6-2.i386.rpm</A
|
|
></P
|
|
><P
|
|
>Install it with <B
|
|
CLASS="COMMAND"
|
|
>rpm -i dhcpcd-0.6-2.i386.rpm</B
|
|
>.</P
|
|
><P
|
|
>Alternatively you can compile your own version by following the steps
|
|
outlined in the <A
|
|
HREF="x74.html#SLACKWARE"
|
|
><I
|
|
>Slackware</I
|
|
></A
|
|
>.</P
|
|
><P
|
|
>The following information was provided to me by nothing
|
|
<TT
|
|
CLASS="EMAIL"
|
|
><<A
|
|
HREF="mailto:nothing@cc.gatech.edu"
|
|
>nothing@cc.gatech.edu</A
|
|
>></TT
|
|
>.</P
|
|
><A
|
|
NAME="AEN194"
|
|
></A
|
|
><BLOCKQUOTE
|
|
CLASS="BLOCKQUOTE"
|
|
><P
|
|
>Removed my static ip and name from
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/resolv.conf</TT
|
|
>. However, I did leave in the
|
|
search line and my two nameserver lines (for some reason my dhcpcd never
|
|
creates a <TT
|
|
CLASS="FILENAME"
|
|
>/etc/dhcpc/resolv.conf</TT
|
|
>, so I have to use
|
|
a static <TT
|
|
CLASS="FILENAME"
|
|
>/etc/resolv.conf</TT
|
|
>).</P
|
|
><P
|
|
>In <TT
|
|
CLASS="FILENAME"
|
|
>/etc/sysconfig/network</TT
|
|
> I removed the HOSTNAME
|
|
and GATEWAY entries. I left the other entries as is (NETWORKING,
|
|
DOMAINNAME, GATEWAYDEV).</P
|
|
><P
|
|
>In <TT
|
|
CLASS="FILENAME"
|
|
>/etc/sysconfig/network-scripts/ifcfg-eth0</TT
|
|
> I
|
|
removed the IPADDR, NETMASK, NETWORK, and BROADCAST entries. I left
|
|
DEVICE and ONBOOT as is. I changed the BOOTPROTO line to
|
|
BOOTPROTO=dhcp.</P
|
|
><P
|
|
>Save the file. Reboot your computer.</P
|
|
></BLOCKQUOTE
|
|
><P
|
|
>When you are finished go the <A
|
|
HREF="x74.html#NAMESERVER"
|
|
>last step</A
|
|
>. </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="DEBIAN"
|
|
>3.6. Debian</A
|
|
></H2
|
|
><P
|
|
>There is a deb package of DHCPcd (make sure it starts with dhcpcd) at:</P
|
|
><P
|
|
><A
|
|
HREF="http://ftp.debian.org/debian/dists/slink/main/binary-i386/net/"
|
|
TARGET="_top"
|
|
>http://ftp.debian.org/debian/dists/slink/main/binary-i386/net/</A
|
|
></P
|
|
><P
|
|
>Or, follow the <A
|
|
HREF="x74.html#SLACKWARE"
|
|
><I
|
|
>Slackware</I
|
|
></A
|
|
> installation instructions. </P
|
|
><P
|
|
>To unpack the deb package type <B
|
|
CLASS="COMMAND"
|
|
>dpkg -i /where/ever/your/debian/packages/are/dhcpcd*deb</B
|
|
>.</P
|
|
><P
|
|
>It appears that there isn't a need for any DHCPcd configuration because:</P
|
|
><A
|
|
NAME="AEN216"
|
|
></A
|
|
><TABLE
|
|
BORDER="0"
|
|
WIDTH="100%"
|
|
CELLSPACING="0"
|
|
CELLPADDING="0"
|
|
CLASS="BLOCKQUOTE"
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
VALIGN="TOP"
|
|
> </TD
|
|
><TD
|
|
WIDTH="80%"
|
|
VALIGN="TOP"
|
|
><P
|
|
>The dhcpcd package installs it's startup script as usual for debian
|
|
packages in
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/init.d/<TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>package_name</I
|
|
></TT
|
|
></TT
|
|
>,
|
|
here as <TT
|
|
CLASS="FILENAME"
|
|
>/etc/init.d/dhcpcd</TT
|
|
>,
|
|
and links this to the various <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc?.d/</TT
|
|
> directories. </P
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
VALIGN="TOP"
|
|
> </TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
COLSPAN="2"
|
|
ALIGN="RIGHT"
|
|
VALIGN="TOP"
|
|
>--<SPAN
|
|
CLASS="ATTRIBUTION"
|
|
>From: Heiko Schlittermann
|
|
<TT
|
|
CLASS="EMAIL"
|
|
><<A
|
|
HREF="mailto:heiko@os.inf.tu-dresden.de"
|
|
>heiko@os.inf.tu-dresden.de</A
|
|
>></TT
|
|
></SPAN
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
> </TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>The contents of the <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc?.d/</TT
|
|
> dirs is then executed at boot time.</P
|
|
><P
|
|
>If you don't reboot after installing you should consider starting
|
|
the daemon manually: <B
|
|
CLASS="COMMAND"
|
|
>/etc/init.d/dhcpcd start</B
|
|
>.</P
|
|
><P
|
|
>When you are finished go the <A
|
|
HREF="x74.html#NAMESERVER"
|
|
>last step</A
|
|
>. </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN230"
|
|
>3.7. LinuxPPC and MkLinux</A
|
|
></H2
|
|
><P
|
|
>Following section has been written by R. Shapiro </P
|
|
><P
|
|
>As of the "1999" (R5) release, Linuxppc is now almost completely
|
|
compatible with Redhat 6, with one caveat (see below). In general the
|
|
instructions are exactly the same as for the current release of
|
|
<A
|
|
HREF="x74.html#REDHAT6"
|
|
><I
|
|
>RedHat 6.x and Mandrake 6.x</I
|
|
></A
|
|
>.</P
|
|
><P
|
|
>The remaining problem is that Redhat 6 uses the 'pump' client for dhcp
|
|
by default, and 'pump' doesn't work reliably in Linuxppc. <A
|
|
NAME="LINUXPPC-RH6"
|
|
></A
|
|
>To get around this, you should install the latest
|
|
dhcpcd from Sergei Viznyuk, and then edit
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/sbin/ifup</TT
|
|
> to use <B
|
|
CLASS="COMMAND"
|
|
>dhcpcd</B
|
|
>
|
|
instead of <B
|
|
CLASS="COMMAND"
|
|
>pump</B
|
|
>. </P
|
|
><P
|
|
>Change</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
|
|
PUMP=true
|
|
fi
|
|
|
|
if [ -n "$PUMP" ]; then</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>with</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
> if [ "$BOOTPROTO" = bootp ]; then
|
|
echo " done."
|
|
else
|
|
echo " failed."
|
|
exit 1
|
|
fi
|
|
elif [ "$BOOTPROTO" = dhcp ]; then
|
|
echo -n "Determining IP information for $DEVICE..."
|
|
if /sbin/dhcpcd -d $DEVICE ; then
|
|
if [ -f /etc/dhcpc/dhcpcd-${DEVICE}.exe ]; then
|
|
/etc/dhcpc/dhcpcd-${DEVICE}.exe
|
|
fi</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>and a coresponding changes for <B
|
|
CLASS="COMMAND"
|
|
>ifdown</B
|
|
>. Change</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
|
|
....
|
|
fi</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>with</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>if [ "$BOOTPROTO" = bootp ]; then
|
|
fi
|
|
|
|
if [ "$BOOTPROTO" = dhcp ]; then
|
|
if [ -f /var/run/dhcpcd-${DEVICE}.pid ]; then
|
|
kill `cat /var/run/dhcpcd-${DEVICE}.pid`
|
|
rm -f /var/run/dhcpcd-${DEVICE}.pid
|
|
fi
|
|
fi</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>A working ppc rpm for dhcpcd is included on the Linuxppc 1999 cd; a
|
|
slightly later rpm is available in the contrib directory on
|
|
<A
|
|
HREF="ftp://ftp.linuxppc.org/"
|
|
TARGET="_top"
|
|
>ftp://ftp.linuxppc.org/</A
|
|
>.
|
|
Sources, which compile out of the box in Linuxppc 1999, are available
|
|
from <A
|
|
HREF="ftp://ftp.phystech.com/pub/dhcpcd-1.3.17-pl9.tar.gz"
|
|
TARGET="_top"
|
|
>ftp://ftp.phystech.com/pub/dhcpcd-1.3.17-pl9.tar.gz</A
|
|
>.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="NAMESERVER"
|
|
>3.8. Tying it all together</A
|
|
></H2
|
|
><P
|
|
>After your machine reboots your network interface should be configured.
|
|
Type: <B
|
|
CLASS="COMMAND"
|
|
>ifconfig</B
|
|
>.</P
|
|
><P
|
|
>You should get something like this:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
> lo Link encap:Local Loopback
|
|
inet addr:127.0.0.1 Bcast:127.255.255.255 Mask:255.0.0.0
|
|
UP BROADCAST LOOPBACK RUNNING MTU:3584 Metric:1
|
|
RX packets:302 errors:0 dropped:0 overruns:0 frame:0
|
|
TX packets:302 errors:0 dropped:0 overruns:0 carrier:0 coll:0
|
|
|
|
eth0 Link encap:Ethernet HWaddr 00:20:AF:EE:05:45
|
|
inet addr:24.128.53.102 Bcast:24.128.53.255 Mask:255.255.254.0
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
|
|
RX packets:24783 errors:1 dropped:1 overruns:0 frame:1
|
|
TX packets:11598 errors:0 dropped:0 overruns:0 carrier:0 coll:96
|
|
Interrupt:10 Base address:0x300 </PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>If you have some normal number under <TT
|
|
CLASS="LITERAL"
|
|
>inet addr</TT
|
|
> you are set. If you see
|
|
0.0.0.0 don't despair, it is a temporary setting before
|
|
<B
|
|
CLASS="COMMAND"
|
|
>dhcpcd</B
|
|
> acquires
|
|
the IP address. If even after few minutes you are seeing 0.0.0.0 please
|
|
check out <A
|
|
HREF="x74.html#TROUBLESHOOTING"
|
|
><I
|
|
>Troubleshooting</I
|
|
></A
|
|
>. DHCPcd is a daemon and will
|
|
stay running as long as you have your machine on. Every three hours it
|
|
will contact the DHCP server and try to renew the IP address lease. It
|
|
will log all the messages in the syslog (on Slackware
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/var/adm/syslog</TT
|
|
>, RedHat/OpenLinux
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/var/log/syslog</TT
|
|
>).</P
|
|
><P
|
|
>One final thing. You need to specify your nameservers. There are two ways to do
|
|
it, you can either ask your provider to provide you with the addresses of your
|
|
name server and then put those in the
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/resolv.conf</TT
|
|
> or DHCPcd will obtain
|
|
the list from the DHCP server and will build a
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>resolv.conf</TT
|
|
> in <TT
|
|
CLASS="FILENAME"
|
|
>/etc/dhcpc</TT
|
|
>.</P
|
|
><P
|
|
>I decided to use DHCPcd's <TT
|
|
CLASS="FILENAME"
|
|
>resolv.conf</TT
|
|
> by doing the following:</P
|
|
><P
|
|
>Back up your old <TT
|
|
CLASS="FILENAME"
|
|
>/etc/resolv.conf</TT
|
|
>: <B
|
|
CLASS="COMMAND"
|
|
>mv /etc/resolv.conf
|
|
/etc/resolv.conf.OLD</B
|
|
></P
|
|
><P
|
|
>If directory <TT
|
|
CLASS="FILENAME"
|
|
>/etc/dhcpc</TT
|
|
> doesn't
|
|
exist create it: <B
|
|
CLASS="COMMAND"
|
|
>mkdir /etc/dhcpc</B
|
|
></P
|
|
><P
|
|
>Make a link from <TT
|
|
CLASS="FILENAME"
|
|
>/etc/dhcpc/resolv.conf</TT
|
|
> to
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/resolv.conf</TT
|
|
>: <B
|
|
CLASS="COMMAND"
|
|
>ln -s
|
|
/etc/dhcpc/resolv.conf /etc/resolv.conf</B
|
|
></P
|
|
><P
|
|
>If that doesn't work try this (fix suggested by
|
|
<TT
|
|
CLASS="EMAIL"
|
|
><<A
|
|
HREF="mailto:nothing@cc.gatech.edu"
|
|
>nothing@cc.gatech.edu</A
|
|
>></TT
|
|
> with a little amendment by Henrik
|
|
Stoerner): </P
|
|
><A
|
|
NAME="ERROR3"
|
|
></A
|
|
><P
|
|
>This last step I had to perform only because my dhcpcd doesn't
|
|
create an <TT
|
|
CLASS="FILENAME"
|
|
>/etc/dhcpc/resolv.conf</TT
|
|
>. In <TT
|
|
CLASS="FILENAME"
|
|
>/etc/sysconfig/network-scripts/ifup</TT
|
|
> I
|
|
made the following changes (which are a very poor hack, but they work
|
|
for me): </P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
|
|
echo -n "Using DHCP for ${DEVICE}... "
|
|
/sbin/dhcpcd -c /etc/sysconfig/network-scripts/ifdhcpc-done ${DEVICE}
|
|
echo "echo \$$ > /var/run/dhcp-wait-${DEVICE}.pid; exec sleep 30" | sh
|
|
|
|
if [ -f /var/run/dhcp-wait-${DEVICE}.pid ]; then
|
|
^^^^
|
|
echo "failed."
|
|
exit 1</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>I changed to:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
|
|
echo -n "Using DHCP for ${DEVICE}... "
|
|
/sbin/dhcpcd
|
|
echo "echo \$$ > /var/run/dhcp-wait-${DEVICE}.pid; exec sleep 30" | sh
|
|
|
|
if [ ! -f /var/run/dhcp-wait-${DEVICE}.pid ]; then
|
|
^^^^^^
|
|
echo "failed."
|
|
exit 1</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><BLOCKQUOTE
|
|
CLASS="NOTE"
|
|
><P
|
|
><B
|
|
>Note: </B
|
|
>Notice the ! (bang) in <TT
|
|
CLASS="LITERAL"
|
|
>if [ ! -f
|
|
/var/run/dhcp-wait-${DEVICE}.pid ];</TT
|
|
></P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
><P
|
|
>Now sit back and enjoy :-). </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN293"
|
|
>3.9. Various notes</A
|
|
></H2
|
|
><P
|
|
>Following step(s) are not necessary but might be useful to some people:</P
|
|
><P
|
|
></P
|
|
><OL
|
|
TYPE="a"
|
|
><LI
|
|
><P
|
|
>If you need network connectivity only occasionally you can
|
|
start <B
|
|
CLASS="COMMAND"
|
|
>dhcpcd</B
|
|
> from the command line (you have to be
|
|
root to do this) with: <B
|
|
CLASS="COMMAND"
|
|
>/usr/sbin/dhcpcd</B
|
|
>.</P
|
|
><P
|
|
>When you need to down (turn off) the network type
|
|
<B
|
|
CLASS="COMMAND"
|
|
>/usr/sbin/dhcpcd -k</B
|
|
>.</P
|
|
></LI
|
|
></OL
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="TROUBLESHOOTING"
|
|
>3.10. Troubleshooting</A
|
|
></H2
|
|
><P
|
|
>If you have followed the steps outlined above and you are unable to access
|
|
the network there are several possible explanations:</P
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN306"
|
|
>3.10.1. Your network card is not configured properly</A
|
|
></H3
|
|
><P
|
|
>During the boot up process your Linux will probe your network card and should say something along these lines:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>eth0: 3c509 at 0x300 tag 1, 10baseT port, address 00 20 af ee 11 11, IRQ 10.
|
|
3c509.c:1.07 6/15/95 becker@cesdis.gsfc.nasa.gov</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>If a message like this doesn't appear your ethernet card might not be recognized
|
|
by your Linux system. If you have a generic ethernet card (a NE2000 clone) you
|
|
should have received a disk with DOS utilities that you can use to set up
|
|
the card. Try playing with IRQs until Linux recognizes your card (IRQ
|
|
9,10,12 are usually good).</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN311"
|
|
>3.10.2. Your DHCP server supports RFC 1541/My DHCP server is Windows
|
|
NT</A
|
|
></H3
|
|
><P
|
|
>Try running <B
|
|
CLASS="COMMAND"
|
|
>dhcpcd</B
|
|
> by typing <B
|
|
CLASS="COMMAND"
|
|
>dhcpcd -r</B
|
|
>.</P
|
|
><P
|
|
>Use <B
|
|
CLASS="COMMAND"
|
|
>ifconfig</B
|
|
> to check if your network interface is
|
|
configured (wait few seconds for the configuration process, initally it
|
|
will say <TT
|
|
CLASS="LITERAL"
|
|
>Inet.addr=0.0.0.0</TT
|
|
>)</P
|
|
><P
|
|
>If this solves your problem add the "-r" flag to the boot up scripts,
|
|
ie: instead of <B
|
|
CLASS="COMMAND"
|
|
>/sbin/dhcpcd</B
|
|
> you will have
|
|
<B
|
|
CLASS="COMMAND"
|
|
>/sbin/dhcpcd -r</B
|
|
>.</P
|
|
><P
|
|
>For example under RedHat edit script
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/sysconfig/network-scripts/ifup</TT
|
|
>
|
|
and change the following:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
> IFNAME=$[ {DEVICE} \
|
|
"/sbin/dhcpcd -r -c /etc/"- etc etc. </PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN325"
|
|
>3.10.3. During bootup I get error message "Using DHCP for eth0 ...
|
|
failed" but my system works fine.</A
|
|
></H3
|
|
><P
|
|
>You are most likely using RedHat and you haven't followed instructions
|
|
carefully :-). You are missing the ! (bang) in one of the if statements.
|
|
Jump <A
|
|
HREF="x74.html#ERROR3"
|
|
>here</A
|
|
> and check how to fix it.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN329"
|
|
>3.10.4. My network works for few minutes and then stops
|
|
responding</A
|
|
></H3
|
|
><P
|
|
>There are some reports of gated (gateway daemon) screwing up routing on
|
|
Linux boxes which results in problem described above. Check if gated is
|
|
running with: <B
|
|
CLASS="COMMAND"
|
|
>ps -auxww | grep gate</B
|
|
>.</P
|
|
><P
|
|
>If it is try removing it with RedHat's RPM manager or removing the entry
|
|
in <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc.d/</TT
|
|
>.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN335"
|
|
>3.10.5. My ethernet card is recognized during boot up but I still get "NO
|
|
DHCPOFFER" message in my logs. I also happen to have a PCMCIA ethernet
|
|
card.</A
|
|
></H3
|
|
><P
|
|
>You need to make sure that you have the 10BaseT port ("phone" plug) on
|
|
your network card activated. Best way to verify it is to check what kind
|
|
of connector your card is configured for during bootup e.g.</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>eth0: 3c509 at 0x300 tag 1, 10baseT port, address 00 20 af ee 11 11, IRQ 10.
|
|
^^^^^^^^^^^^
|
|
3c509.c:1.07 6/15/95 becker@cesdis.gsfc.nasa.gov</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>I have received reports of laptop users having this kind of problems due
|
|
to the PCMCIA utilities (specifically ifport) that would set the
|
|
connector type to 10Base2 (thinnet). You have to make sure you use 10BaseT
|
|
for your connection. If you are not reconfigure the card and restart the
|
|
computer.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN340"
|
|
>3.10.6. My DHCP client broadcasts requests but no one answers
|
|
(Contributed by Peter Amstutz)</A
|
|
></H3
|
|
><P
|
|
>On some systems, you need to include some hostname for your machine as
|
|
part of the request. With dhcpcd, do this with <B
|
|
CLASS="COMMAND"
|
|
>dhcpcd -h
|
|
<TT
|
|
CLASS="REPLACEABLE"
|
|
><I
|
|
>foohost</I
|
|
></TT
|
|
></B
|
|
>
|
|
Probably the hostname wanted will be your account username on the network. </P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN345"
|
|
>3.10.7. I have followed all the steps but still my machine is not able to
|
|
connect</A
|
|
></H3
|
|
><P
|
|
>The cable modem will usually memorize the ethernet address of your
|
|
network card so if you connect a new computer or switch network cards you
|
|
will somehow have to "teach" your cable modem to recognize the new
|
|
computer/card. Usually you can turn of the modem and bring it back up
|
|
while computer is on or you will have to call tech support and tell them
|
|
that you have changed a network card in the computer.</P
|
|
><P
|
|
>You have firewall rules (ipfwadm rules) that disallow port 67/68
|
|
traffic used by DHCP to distribute configuration info. Check your firewall
|
|
rules carefully.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT3"
|
|
><H3
|
|
CLASS="SECT3"
|
|
><A
|
|
NAME="AEN349"
|
|
>3.10.8. I have MediaOne Express service and I still can't
|
|
connect.</A
|
|
></H3
|
|
><P
|
|
>It appears that MediaOne has been using adding some things to DHCP that
|
|
shouldn't be there. Supposedly this is not a problem anymore but if you
|
|
experience outages check for these things. If you are (un)lucky to have
|
|
Windows NT on your machine if you go into Event Viewer you will see a
|
|
warning like this:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>DHCP received an unknown option 067 of length 005. The raw option data is
|
|
given below.
|
|
|
|
0000: 62 61 73 69 63 basic</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>If this is the problem go to
|
|
<A
|
|
HREF="ftp://vanbuer.ddns.org/pub/"
|
|
TARGET="_top"
|
|
>ftp://vanbuer.ddns.org/pub/</A
|
|
>
|
|
and either download a binary or get the source for the change.</P
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN355"
|
|
>3.11. Alternative DHCP client (ISC dhclient)</A
|
|
></H2
|
|
><P
|
|
>If you have not had success getting your Linux connection running with
|
|
the dhcpcd you might want to try ISC dhclient. dhclient comes with
|
|
the DHCP distribution from ISC which includes both a DHCP client
|
|
and a DHCP server. Instructions on how to get and compile
|
|
the DHCP distribution can be found <A
|
|
HREF="x369.html#DHCPSERVER"
|
|
>here</A
|
|
>.
|
|
When you are done with it please return to this section to configure
|
|
the client.</P
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><BLOCKQUOTE
|
|
CLASS="NOTE"
|
|
><P
|
|
><B
|
|
>Note: </B
|
|
>Following information has been provided by
|
|
Ted Lemon <TT
|
|
CLASS="EMAIL"
|
|
><<A
|
|
HREF="mailto:mellon@isc.org"
|
|
>mellon@isc.org</A
|
|
>></TT
|
|
>
|
|
one of the authors of dhclient.</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
><P
|
|
>With the current version of the DHCP client,
|
|
you don't actually need a <TT
|
|
CLASS="FILENAME"
|
|
>dhclient.conf</TT
|
|
>. All you
|
|
have to do is invoke dhclient e.g.: <B
|
|
CLASS="COMMAND"
|
|
>/sbin/dhclient</B
|
|
>.</P
|
|
><P
|
|
>This will configure all broadcast interfaces. If this doesn't
|
|
work or you want to specify only one interface create a
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/dhclient.conf</TT
|
|
> file with this example
|
|
configuration.</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>interface "eth0" {
|
|
send dhcp-client-identifier 1:xx:xx:xx:xx:xx:xx;
|
|
send dhcp-lease-time 86400;
|
|
}</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>Here we assume that the ethernet interface is eth0. If not
|
|
change accordingly. Also replace xx:xx:xx:xx:xx with your ethernet
|
|
address. This dhclient.conf makes the client look more
|
|
like a Win95 client.</P
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x69.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x369.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>DHCP protocol</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>DHCP Server Setup</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |