tonywhitmore.co.uk  

      blog : gallery : wiki : articles : projects : shell scripts : wallpaper : cv : links :
 Project Homepage

DHCP Client Deamon

Preparation

  1. Download the dhcpcd (DHCP client daemon) source code from http://www.phystech.com/download/.
    • Visit http://www.phystech.com/download/ and click on the link for the source code of the latest version of dhcpcd. You will need the source code in .tar.gz format.
      • At the time of writing the latest version of dhcpcd was version 1.3.22-p14, so the file downloaded was dhcpcd-1.3.22-p14.tar.gz.
    • You will be asked to where you wish to save the file. Chose a safe place and make a note of it.
    • The download is about 144kb and will only take a few seconds over a modem, and a lot less over a broadband connection.
    • If you are using a download accelerator program, it will save the file to your default download directory.
  2. Burn the .tar.gz file to a CD. This page assumes that the subdirectory /apps is used for the .tar.gz file. The CD-ROM can be a multi-session disk.
    • Use your CD burning software to create an ISO9660 disc image with the file dhcpcd-1.3.22-p14.tar.gz in the /apps directory.
    • Burn the CD and verify the data stored on it.

Back to simple version

Booting

  1. Boot your Core Linux PC.
  2. Login as root. You will need to enter the password at the prompt.
    • Wait for the following text to appear:
      localhost login:
    • Type root and press Enter.
    • The screen will display this message:
      Password:
    • Enter the password for root that you set earlier.
    • You will be shown a prompt that looks like this:
      [~]#

Back to simple version

Extract the source

  1. Place the CD-R in the CD-ROM drive. Mount the CD-ROM drive under /mnt/cdrom.
    • At the prompt enter:
      mount /dev/hdb /mnt/cdrom
    • You will see the following line appear:
      mount: block device /dev/hdb is write-protected, mounting read-only
  2. Change to the /apps directory on the CD-R.
    • At the prompt enter:
      cd /mnt/cdrom/apps
    • The prompt will change to:
      [/mnt/cdrom/apps]#
  3. Copy the dhcpcd-1.3.22-p14.tar.gz file to the directory /usr/src.
    • At the prompt enter:
      cp dhcpcd-1.3.22-p14.tar.gz /usr/src
    • The system will not display a message if everything is OK.
  4. Change to the /usr/src directory and extract the source from the .tar.gz file.
    • At the prompt enter:
      cd /usr/src
    • The prompt will change to:
      [/usr/src]#
    • At the prompt enter:
      tar -zxvf dhcpcd-1.3.22-p14.tar.gz
    • A long stream of unzipping files and directories should scroll up the screen for a second or two.

Back to simple version

Configure and compile

  1. Change to the /usr/src/dhcpcd-1.3.22-p14 directory.
    • At the prompt enter:
      cd dhcpcd-1.3.22-p14
    • The prompt will change to:
      [/usr/src/dhcpcd-1.3.22-p14]#
  2. Run the ./configure script. You will need to add an argument specifying the architecture of the system, for example:
    ./configure --build=i686-pc-linux-gnu
    • At the prompt enter:
      ./configure --build=i686-pc-linux-gnu
    • A long stream of processes should scroll up the screen for about twenty seconds.
    • The script finishes with the line:
      config.status: executing depfiles commands
  3. Run the make program.
    • At the prompt enter:
      make
    • A long stream of processes should scroll up the screen for about ten seconds.
    • The program finishes with the line:
      gcc -O2 -fomit-frame-pointer -Wall -march=i686 -s -O2 -o dhcpcd peekfd.o udpipgen.o buildmsg.o signals.o arp.o dhcpconfig.o client.o cache.o dhcpcd.o
  4. Run the make program with the argument install.
    • At the prompt enter:
      make install
    • A few processes should scroll up the screen for a second or two
    • The program finishes with the line:
      make[1]: Leaving directory 'usr/src/dhcpcd-1.3.22-p14'

Back to simple version

Initial Testing

  1. If your ethernet interface is already up, take it down.
    • At the system prompt enter:
      ifconfig eth0 down
    • The system will not display a message if everything is OK.
  2. Start the dhcpcd client using /usr/local/sbin/dhcpcd eth0.
    • At the prompt enter:
      /usr/local/sbin/dhcpcd eth0
    • The screen will not display a message if everything is OK.
  3. Use ifconfig to check the IP address assigned to the interface.
    • At the system prompt enter:
      ifconfig
    • The screen will show information relating to the eth0 and lo interfaces. Check the details for the eth0 interface, and look for a line similar to:
      inet addr:192.168.0.15 Bcast:192.168.0.255 Mask:255.255.255.0
    • The IP address, broadcast address and netmask assigned to the interface will vary with your network topology.

Back to simple version

Stopping dhcpcd

  1. Stop the dhcpcd client using kill.
    • At the prompt enter:
      kill `cat /etc/dhcpc/dhcpcd-eth0.pid`
    • The system will not display a message if everything is OK.

Back to simple version

Automating dhcpcd

  1. Append the following line to the /etc/rc.d/rc.mu script:
    /usr/local/sbin/dhcpcd eth0
    If you have previously configured the interface to be assigned a static IP address on boot, you will need to remove the ifconfig line from the script and replace it with the above line. You will also need to remove any lines containing route commands, as this information is set dynamically by the dhcp client. You can also add comments and echoes for your own information.
    • At the prompt enter:
      nano /etc/rc.d/rc.mu
    • The screen will show the contents of /etc/rc.d/rc.mu with information about the file at the top and bottom of the screen.
    • Locate the line that sets the IP address of the interface using the ifconfig command.
    • Replace the line containing ifconfig with the following line:
      /usr/local/sbin/dhcpcd eth0
    • Save the file and exit the text editor.
      • Press Ctrl+x on the keyboard.
      • The contents of the white line at the bottom of the screen will change to read:
        Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
      • Type y.
      • The contents of the white line at the bottom of the screen will change to read:
        File Name to write: /etc/rc.d/rc.mu
      • Press Enter.
      • You will be returned to the system prompt.
    • Reboot the system and check that the interface has been assigned an IP address.
      • At the system prompt enter:
        shutdown -r now
      • Wait for the system to reboot.
      • As the system reboots, watch for any error messages.
      • Once the system has rebooted, enter ifconfig at the system prompt and check for a valid IP address on interface eth0.

Back to simple version

Creative Commons License
The text of this page is licensed under a Creative Commons License.


Valid CSS!     Valid HTML 4.0!     Valid RSS
Original design © For oswd.org by SquireCD