Previous ToC Next

Using DHCP to assign a Hybrid IP address

I don't really know what this is called. I call it a Hybrid IP because it is an IP address that is "statically" assigned through DHCP by the mac address of the NIC. It acts like a static IP in that the fact that the address assigned to the particular NIC stays with that NIC, but it is assigned by DHCP allowing the flexibility to release and renew at will.

The way DHCP works:

A client makes a DHCP request(DHCPDISCOVER)
The DHCP server detects the request and offers an IP to that MAC address (DHCPOFFER)
The same client reloads the interface and makes an ack request (DHCPREQUEST)
The DHCP server pings the newly-released IP address and acknowliges its existence (DHCPACK)

This is the standard for the DHCP order however where the IP address comes from is of concern. In the /etc/dhcpd.conf file, the statement that reads:
range 192.168.0.2 192.168.0.25;
specifies that the range 192.168.0.2 to 192.168.0.25 is allocated for DHCP leases. This does not limit thr amount of DHCP leases that the server can hand out however, this does limit thr DHCP leases that are not "registered" with the server. You can tell DHCP to hand a particular MAC address some specific IP address by specifying a host section in your /etc/dhcpd.conf file. A sample host section looks like this:
host bugzilla {
hardware ethernet 00:23:D4:F4:12:AD;
fixed-address 192.168.0.40;}
The above host command basically tells DHCP to assign the NIC with the above listed MAC address to get the fixed address 192.168.0.40. It's pretty easily read. The name specified, in this case bugzilla is not really used, however I recommend that you make the host name match the DNS name, if you are going to make the router do DNS functionas as showin in Chapter 12. This will help you keep your hosts straight.

All hosts statements must be made within the subnet statement but outside of the range statement. Likewise you can not "fixed-address" an IP that exists within the range specified within the range statement.

Simply put: if your range statement is "range 10.0.0.2 10.0.0.50" then you can not assign an IP address that is within that range. You can assign IPs from 10.0.0.51 on.

That's it as far as assigning a Hybrid IP address. This chapter doesn't do much by itself, but does prepare you for the next chapter, Setting up BIND and caching-nameserver