Next Previous Contents

27. DHCPd SERVER configuration

DHCP is an automatic IP addressing tool much like BOOTP is. With DHCP, IP addresses don't have to be statically addressed and possibly manually changed on EACH computer in the future. Not only can DHCP give out IP addresses but far more information (see below). It really is a powerful mechanism. For more info, check out the DHCP section in Section 5.

Critical Note:

27.1 The Differences between DHCP and BOOTP

DHCP or Dynamic Host Control Protocol is the direct cousin of BOOTP.

27.2 Configuring DHCP support on various Linux Distributions:

Though TrinityOS primarily supports Redhat, I'm contantly adding support for other Linux distributions. If you have additions or comments, please let me know.

27.3 Determining MAC addresses for static DHCP scopes

NOTE: This config defines a STATIC IP address per core machine. All other machines get dynamic DHCP IP addresses. I do this for security reasons.

To find out the MAC address of a machine's Ethernet card, do the following:

Win95: run "winipcfg" WinNT: run "ipconfig /all" Linux: run "arp"

- For ALL distributions using the DHCPcd client, create and modify the file /etc/dhcpd.conf

27.4 Creating the /etc/dhcpd/conf file


--<begin>--
server-identifier roadrunner-int.acme123.com;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1, 24.1.64.33, 24.1.64.34;
option domain-name "acme123.com";
default-lease-time 86400;               

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.9 192.168.0.10;
}
        
host coyote.acme123.com {
        hardware ethernet 00:60:08:B1:36:4A;
        fixed-address 192.168.0.4;      
}
--<end>--

Next, you need to create the dhcp.leases file:


                "touch /etc/dhcpd.leases"

As mentioned above, you will need to replace the hardware Ethernet MAC addresses with the MAC addresses of your specific NIC cards.

* Ok, now you need to put in all of your DHCP IP addresses into DNS as described in Section 24 and then restart Bind.

Now, you need to make sure you have the following lines in your /etc/services file:


                --
                bootps          67/udp                          # bootp server
                bootpc          68/udp                          # bootp client
                --

27.5 Starting up DHCP

Finally, lets start DHCP up:

Slackware: Run "/usr/sbin/dhcpd eth1"

Redhat: Run "/etc/rc.d/init.d/dhcpd start"

* Additional security: DHCPd runs as root in a non-chroot'ed way. If you are paranoid about security, check out the LASG doc. The URL is in Section 5

If that works well, you should enable DHCP full time:

Redhat:


                        chkconfig --level 2345 dhcpd on

27.6 Using DHCP Relay for LANS seperated by routers

Ok, so say that you have a network that you'd like to enable DHCP on but it is seperated by a router. Without any specical configuration, the DHCP server would somply send DHCP requests to the BROADCAST network address (255.255.255.255). The problem is that routers, by definition, surpress network broadcasts. How do you solve this? Most modern routers support a feature called "DHCP Relay" (Juniper calls it "dhcp-relay" which Cisco calls it it "ip-helper address". To read up on this, check out RFC 1542 in Section 5.

What a DHCP Relay agent does is record the originating network address of the requesting DHCP client and re-sends it out on the segment where the DHCP server is. In addition to this, router embeds the IP address of the router's local IP address in GIADDR field of the DHCP packet.

When the DHCP server then figures out what IP address to give to the client, it sends it back to the IP as given in the above GIADDR field. When the router receives the DHCP reply from the DHCP server, ther router again will re-transmit the DHCP reply on the original requesting DHCP network. Voila!

So how do you configure the DHCP server to deal with DHCP Relay enabled network(s)? You basically configure NOTHING! Huh? How does that work? When the DHCP server receives a DHCP request, it looks at the SRC IP address and the GIADDR field within the packet. If that SRC IP network MATCHES a configured "subnet" DHCP scope, it simply gives an IP address from that particular scope vs . a different one found in the dhcpd.conf file. The one thing to note is that if the DHCP server is on the same network that it will be also serving DHCPed IP addresses to, just make sure that local "subnet' confuration comes FIRST in /etc/dhcpd.conf file.


Next Previous Contents