1 DHCP configuration
This section describes configuration of DHCP server. DHCP stands for Dynamic
Host Configuration Protocol. It allows central storage and retrieval of client con-
figuration information including IP address, net mask, default gateway, DNS server
address and others.
1.1 Benefits of DHCP
• centralized management of client specific configuration
• temporary leasing of the client IP address
• widely supported by most operating systems including most Unix systems and
even MS Windows
1.2 Installing DHCP server
The Linux kernel must be compiled with CONFIG_PACKET and CONFIG_FILTER option
to successfully run DHCP server. This requirement is met by default RedHat’s
kernels.
Most Linux distributions includes free DHCP server made by Internet Software
Consortium1
. Installation looks as follows in RedHat 6.1:
# rpm -Uvh dhcp-2.0-3.i386.rpm
# # Create empty database of leased IP address
# touch /var/state/dhcp/dhcpd.leases
Also check that DHCP server is ran on bootup using /usr/sbin/ntsysv com-
mand.
1.3 Configuring DHCP server
The DHCP server does not run “out of the box”. There is need to setup /etc/dhcpd.conf
configuration file. You should know at least this information to configure DHCP
server:
Property Example
subnet IP address 192.168.1.0
subnet mask 255.255.255.0
default gateway(s) 192.168.1.1
DNS server 192.168.1.2
your DNS domain domain.com
range for dynamic IP addresses 192.168.1.128–192.168.1.254
Optionally you would make list of local computers, that will have assigned static
IP address (useful for some servers etc.). You may obtain their HW addresses later
(if you lookup their IP address and HW address in /var/log/messages).
There already exists simple template in /usr/doc/dhcp-2.0/dhcpd.conf.sample.
Copy that file into /etc/dhcpd.conf and make required changes. Here is brief ex-
ample for our sample data:
# simple configuration
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
1http://www.isc.org
1
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
# NIS domain is for Sun’s Network Infomation Services (NIS), optional
option nis-domain "domain.com";
option domain-name "domain.com";
option domain-name-servers 192.168.1.2;
range dynamic-bootp 192.168.1.128 192.168.1.254;
default-lease-time 21600;
max-lease-time 43200;
# here is list of static IP address hosts
# static host: server1.domain.com
host server1 {
# next-server - "upload" file server
next-server 192.168.1.1
# hw address (MAC address)
hardware ethernet 12:34:56:78:9A:BC;
# static IP address
fixed-address 192.168.1.11;
}
}
1.4 Running DHCP server on single interface
If you want to provide DHCP server for specific subnet on specific netcard (for
example eth1) change the “daemon” line in /etc/rc.d/init.d/dhcpd to:
daemon /usr/sbin/dhcpd eth1
1.5 Configuring DHCP clients (RedHat 6.x)
Use either linuxconf or make /etc/sysconfig/network-scripts/ifcfg-eth0 file
like this:
DEVICE="eth0"
BOOTPROTO="dhcp"
IPADDR=""
NETMASK=""
ONBOOT="yes"
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"
2
Mandatory are the 5 top lines.
3

DHCP concept

  • 1.
    1 DHCP configuration Thissection describes configuration of DHCP server. DHCP stands for Dynamic Host Configuration Protocol. It allows central storage and retrieval of client con- figuration information including IP address, net mask, default gateway, DNS server address and others. 1.1 Benefits of DHCP • centralized management of client specific configuration • temporary leasing of the client IP address • widely supported by most operating systems including most Unix systems and even MS Windows 1.2 Installing DHCP server The Linux kernel must be compiled with CONFIG_PACKET and CONFIG_FILTER option to successfully run DHCP server. This requirement is met by default RedHat’s kernels. Most Linux distributions includes free DHCP server made by Internet Software Consortium1 . Installation looks as follows in RedHat 6.1: # rpm -Uvh dhcp-2.0-3.i386.rpm # # Create empty database of leased IP address # touch /var/state/dhcp/dhcpd.leases Also check that DHCP server is ran on bootup using /usr/sbin/ntsysv com- mand. 1.3 Configuring DHCP server The DHCP server does not run “out of the box”. There is need to setup /etc/dhcpd.conf configuration file. You should know at least this information to configure DHCP server: Property Example subnet IP address 192.168.1.0 subnet mask 255.255.255.0 default gateway(s) 192.168.1.1 DNS server 192.168.1.2 your DNS domain domain.com range for dynamic IP addresses 192.168.1.128–192.168.1.254 Optionally you would make list of local computers, that will have assigned static IP address (useful for some servers etc.). You may obtain their HW addresses later (if you lookup their IP address and HW address in /var/log/messages). There already exists simple template in /usr/doc/dhcp-2.0/dhcpd.conf.sample. Copy that file into /etc/dhcpd.conf and make required changes. Here is brief ex- ample for our sample data: # simple configuration subnet 192.168.1.0 netmask 255.255.255.0 { # --- default gateway 1http://www.isc.org 1
  • 2.
    option routers 192.168.1.1; optionsubnet-mask 255.255.255.0; # NIS domain is for Sun’s Network Infomation Services (NIS), optional option nis-domain "domain.com"; option domain-name "domain.com"; option domain-name-servers 192.168.1.2; range dynamic-bootp 192.168.1.128 192.168.1.254; default-lease-time 21600; max-lease-time 43200; # here is list of static IP address hosts # static host: server1.domain.com host server1 { # next-server - "upload" file server next-server 192.168.1.1 # hw address (MAC address) hardware ethernet 12:34:56:78:9A:BC; # static IP address fixed-address 192.168.1.11; } } 1.4 Running DHCP server on single interface If you want to provide DHCP server for specific subnet on specific netcard (for example eth1) change the “daemon” line in /etc/rc.d/init.d/dhcpd to: daemon /usr/sbin/dhcpd eth1 1.5 Configuring DHCP clients (RedHat 6.x) Use either linuxconf or make /etc/sysconfig/network-scripts/ifcfg-eth0 file like this: DEVICE="eth0" BOOTPROTO="dhcp" IPADDR="" NETMASK="" ONBOOT="yes" IPXNETNUM_802_2="" IPXPRIMARY_802_2="no" IPXACTIVE_802_2="no" IPXNETNUM_802_3="" IPXPRIMARY_802_3="no" IPXACTIVE_802_3="no" IPXNETNUM_ETHERII="" IPXPRIMARY_ETHERII="no" IPXACTIVE_ETHERII="no" IPXNETNUM_SNAP="" IPXPRIMARY_SNAP="no" IPXACTIVE_SNAP="no" 2
  • 3.
    Mandatory are the5 top lines. 3