Multi Scoped Linux DHCP Server

Charles Steinkuehler charles at steinkuehler.net
Tue Dec 17 02:51:46 CST 2002


Jeffrey A. McCright wrote:
> I am preparing to look for how-to's for setting up a multi-scoped DHCP
> server under Red Hat Linux. I know how to edit the dhcpd.conf file for a
> single scope, but I need one server to hand out ip addresses to 4
> different subnets. Example: I need to hand out IP addresses to 10.2.0.0,
> 10.3.0.0, 10.4.0.0, etc... Anyone got any ideas? Also, if possible can
> you provide an example of the dhcpd.conf file?

You simply need a subnet specification for each network connected to 
your dhcp server box.  It is OK for a subnet section to be empty, if you 
don't want to assign any dhcp IP's on that subnet.

My dhcpd.conf, with two IP ranges (I assign a couple IP's on in my 
external SDSL IP space for testing firewall images):

<dhcpd.conf>
dynamic-bootp-lease-length 604800;
max-lease-time 1209600;

subnet 10.34.1.0 netmask 255.255.255.0 {
     option routers 10.34.1.254;
     option domain-name "private.network";
     option domain-name-servers 216.171.153.188, 216.171.129.13, 
216.171.129.14;
     option netbios-name-servers 10.28.1.12;
     option netbios-node-type 8;
     range 10.34.1.65 10.34.1.191;
#    host cdsteinkuehler {
#       hardware ethernet 00:a0:c9:27:c4:69;
#       fixed-address 10.34.1.222;
#    }
}

subnet 216.171.153.128 netmask 255.255.255.192 {
     option routers 216.171.153.129;
     option domain-name "private.network";
     option domain-name-servers 216.171.129.13, 216.171.129.14;
     range 216.171.153.140 216.171.153.143;
}
</dhcpd.conf>

WARNING:  Some lines may wrap.

NOTES:

1) You can add as many subnet specifiers as required.  Dhcpd will barf 
if you try to attach it to an interface hooked to an IP network that 
does not have a valid subnet declaration.

2) It is legal to have a "null" subnet declaration...for instance, if 
dhcpd is complaining on startup that you don't have a subnet declartion 
for network 1.2.3.4/24, simply adding the following to your dhcpd.conf 
will fix the problem:

subnet 1.2.3.4 netmask 255.255.255.0 {
}

...dhcpd will *NOT* assign any IP's on this subnet, since there is no 
range declaration in the subnet definition.  If you want IP's (and dns, 
routing, etc.) assigned, fill out the subnet specification as desired.

3) There is a fixed IP assignment for my personal workstation that has 
been commented out, since I now use a dynamic IP for all workstatins. 
Also, I'm assigning netbios name servers (aka WINS servers) and netbois 
node-type (affects windows name resolution) via dhcp since I have a VPN 
link to corperate HQ (home of the WINS server).  See the dhcp options 
man page for details on these options...you probably won't need them.

4) As usual, the man pages are a good source of reference information. 
I have copies on my website:
http://lrp.steinkuehler.net/Packages/man/dhcpd.conf.5.man.htm
http://lrp.steinkuehler.net/Packages/man/dhcp-options.5.man.htm

-- 
Charles Steinkuehler
charles at steinkuehler.net




More information about the Kclug mailing list