- Copy over the sample dhcpd.conf file
cp /usr/share/doc/dhcp-2.0pl5/dhcpd.conf.sample /etc/dhcpd.conf
- Edit /etc/dhcpd.conf
Here's a copy of the unmodified sample:
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.1.1;
option time-offset -5; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.128 192.168.0.255;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
Here's the file I used after modifying the above sample:
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option nis-domain "linuxclinic.org";
option domain-name "linuxclinic.org";
option domain-name-servers 192.168.0.100;
option time-offset -6; # Central Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
#Dhcpd server will give out addresses between 128 and 255
range dynamic-bootp 192.168.0.128 192.168.0.255;
default-lease-time 21600;
max-lease-time 43200;
#server.linuxclinic.org:/techtour/ks.cfg is the nfs share
# for a kickstart confgiuration file
filename "/techtour/ks.cfg";
next-server server.linuxclinic.org;
}
#I'm handing out fixed addresses and names for the following mac addresses
#Cim Console
host TechCommEv {
hardware ethernet 00:80:5f:1d:57:47;
fixed-address 192.168.0.2;
}
host tech1 {
hardware ethernet 00:50:8b:d3:f9:ed;
fixed-address 192.168.0.30;
option host-name "tech1";
}
host tech2 {
hardware ethernet 00:50:8b:e1:5d:dc;
fixed-address 192.168.0.31;
option host-name "tech2";
}
host tech3 {
hardware ethernet 00:50:8b:e1:e8:f2;
fixed-address 192.168.0.32;
option host-name "tech3";
}
host tech4 {
hardware ethernet 00:50:8b:e0:1c:e2;
fixed-address 192.168.0.33;
option host-name "tech4";
}
host tech5 {
fixed-address 192.168.0.34;
option host-name "tech5";
hardware ethernet 00:50:8b:f2:c5:c4;
}
- Generate your leases file
Touch /var/dhcpd/leases
- Restart dhcpd
/etc/rc.d/init.d/dhcpd restart
- Check that dhcpd is running
ps ax | grep dhcpd | grep -v grep
- If dhcpd is not running, then run it directly to get more description on the error
/usr/sbin/dhcpd
- Also check /var/log/messages for other error messages
tail -50 /var/log/messages
- Make sure that you have dhcpd starting on bootup
chkconfig --list dhcpd
- If it is not set for runlevels 2345, then set it
chkconfig --level 2345 dhcpd on
- After adding my 2nd network card, I noticed dhcpd wasn't working anymore. It appears that the correct method to fix this is to add subnet lines into the /etc/dhcpd.conf file for each of the networks this box directly connects to. So if my 2nd network card connects to a network that I don't want to hand out dhcpd addresses, I at least need to add a blank entry into my dhcpd.conf file for that network. Let's say this I don't want to affect is on 10.9.9.0, I would then add this additional entry into my dhcpd.conf file as follows:
subnet 10.9.9.0 netmask 255.255.255.0 {
}
|
Of course be sure to add the correct netmask as appropriate.
The dhcpd server loads without problem after adding this entry.
- Check out the pump.html page if you will be working with Linux dhcp clients. Pump can be used to request, release, or give status on dhcp responses.
- Cool test
ping -c 2 -b 192.138.0.255 | sort
arp -a