Last modified Dec 20 2002

The DHCP Configuration Page


1.  What does this page mean to me?
2.  I'd need help stopping or restarting the Coyote Linux DHCP Client Deamon (dhcpcd)
3.  I'd need help restarting the Coyote Linux DHCP Server (dhcpd) - I'd like to recreate the dhdpd.conf
4.  I'd like to start the Coyote Linux DHCP Server (dhcpd) and see logs for debugging
5.  I'd like to do a simple DHCP release and renew under FreeBSD
6.  I'd like to use the FreeBSD DHCP Client and also have a static address in case the DHCP server cannot be contacted


1.  What does this page mean to me?
In playing around with Linux, Unix, FreeBSD... I found myself wanting to shutdown, restart and tweak the DHCP Clients and Servers
The context, commands, paths, slip away from memory if not written down and referenced
So here they are



2.  I'd need help stopping or restarting the Coyote Linux DHCP Client Deamon (dhcpcd)
Stopping the dhcpcd
The PID is in /var/run/dhdpcd-eth1.pid
Use kill -1 HUP or -15 (TERM) on its pid (See snip below for details)
kill `cat /var/run/dhcpcd-eth1.pid'
Or use ps to find the pid and kill by its number
Here is a snip from a dhdpcd man page

"
If dhcpcd receives SIGHUP it will send DCHP_RELEASE message to the server and destroy dhcpcd cache.
If 
dhcpcd receives SIGTERM which is normally used by shutdown(8) when rebooting the system dhcpcd will not send DHCP_RELEASE and will not destroy cache.
When system boots
dhcpcd will use cache to request the same IP address from DHCP server which was assigned before the system went down."

Starting the dhcpcd
/sbin/dhcpcd eth1 -d     Starts the dhcpcd process on eth1 with messages.



3.  I'd need help restarting the Coyote Linux DHCP Server (dhcpd) - I'd like to recreate the dhdpd.conf
If you chose the DHCP Server option, the first time you reboot Coyote, the dhcpd configuration file dhcpd.conf is created.
dhdpd.conf will include DNS information supplied by /etc/resolv.conf
If you backed up your Coyote disk, dhcpd.conf is also backed up
Perhaps you moved the Coyote box to another network or maybe your ISP's DNS information has changed
Now you may find your dhcpd is retaining your old network DNS information
Doh
This is becasue the dhcpd is still using the old dhcpd.conf
All you have to do is delete it or force its recreation
Here are a couple of ways I found to get past this

The geeky way
/usr/sbin/mkdhcpconf.sh            This script will build the dhdpd.conf
kill `cat /var/run/dhcpd.pid`        This will kill the dhcpd.  The ` is under ~ or tilde
/usr/sbin/dhcpd eth0                  This will start the dhcpd on eth0
Save to floppy                           Dont forget to save

The easy way
Delete /etc/dhcpd.conf
Save to floppy
Reboot
Save to floppy



4.  I'd like to start the Coyote Linux DHCP Server (dhcpd) and see logs for debugging

You can run the dhdpd is the foreground with debugging for troubleshooting purposes with this

/usr/sbin/dhcpd eth0 -d -f

You can check the dhcpd log using this
cat /var/log/daemon.log



5.  I'd like to do a simple DHCP  release and renew under FreeBSD
# dhclient -r    Release the current lease and exit the client.  Here's a clip of dhclient from the FreeBSD man pages;
                        "The client normally doesn't release the current lease as
it is not required by the DHCP protocol. Some cable ISPs require their clients to notify the server if they wish to
                        release an assigned IP address. The -r flag explicitly releases the current lease, and once the lease has been released, the client exits." end clip
                        If you are getting kill: xxxx: No such process This means the dhclient process was already stopped

# dhclient xl0    Starts the dhclient process for interface xl0  

                          I think its a good idea to specify an interface

                         Otherwise you may notice your /var/log/messages filling up with "dhclient: send_packet: Address family not supported by protocol family"

                         Here's a clip of dhclient from the FreeBSD man pages;
                         "If no interface names are specified on the command line dhclient will normally identify all network interfaces, elimininating non-broadcast interfaces if possible,
                         and attempt to configure each interface." end clip
                          I'm pretty sure these log messages are related to this



6.  I'd like to use the FreeBSD DHCP Client and also have a static address in case the DHCP server cannot be contacted
No problem, here's how to setup an ip alias
Edit /etc/dhclient.conf
Add this

alias {
interface "xl0";
fixed-address 192.168.42.40;
option subnet-mask 255.255.255.0;
}


You have to specify your interface, IP and subnet correctly


Here is an example;

# $FreeBSD: src/etc/dhclient.conf,v 1.2.2.1 2001/12/14 11:44:31 rwatson Exp $
#
#    This file is required by the ISC DHCP client.
#    See ``man 5 dhclient.conf'' for details.
#
#    In most cases an empty file is sufficient for most people as the
#    defaults are usually fine.
#
alias {
interface "xl0";
fixed-address 192.168.42.40;
option subnet-mask 255.255.255.0;
}

If dhclient fails to contact a dhcp server, I still have 192.168.42.40 to play with.

Woohoo


Home                   Back

If you find an error or wish to comment please let  me know.