dhcp concept
DESCRIPTION
Description of DHCP server configurationTRANSCRIPT
![Page 1: DHCP concept](https://reader036.vdocuments.site/reader036/viewer/2022081816/54982665b47959384d8b533c/html5/thumbnails/1.jpg)
1 DHCP configuration
This section describes configuration of DHCP server. DHCP stands for DynamicHost Configuration Protocol. It allows central storage and retrieval of client con-figuration information including IP address, net mask, default gateway, DNS serveraddress 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 andeven MS Windows
1.2 Installing DHCP server
The Linux kernel must be compiled with CONFIG_PACKET and CONFIG_FILTER optionto successfully run DHCP server. This requirement is met by default RedHat’skernels.
Most Linux distributions includes free DHCP server made by Internet SoftwareConsortium1. 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.confconfiguration file. You should know at least this information to configure DHCPserver:
Property Examplesubnet IP address 192.168.1.0subnet mask 255.255.255.0default gateway(s) 192.168.1.1DNS server 192.168.1.2your DNS domain domain.comrange for dynamic IP addresses 192.168.1.128–192.168.1.254
Optionally you would make list of local computers, that will have assigned staticIP 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 configurationsubnet 192.168.1.0 netmask 255.255.255.0 {# --- default gateway
1http://www.isc.org
1
![Page 2: DHCP concept](https://reader036.vdocuments.site/reader036/viewer/2022081816/54982665b47959384d8b533c/html5/thumbnails/2.jpg)
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.comhost server1 {
# next-server - "upload" file servernext-server 192.168.1.1
# hw address (MAC address)hardware ethernet 12:34:56:78:9A:BC;
# static IP addressfixed-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 (forexample 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 filelike 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
![Page 3: DHCP concept](https://reader036.vdocuments.site/reader036/viewer/2022081816/54982665b47959384d8b533c/html5/thumbnails/3.jpg)
Mandatory are the 5 top lines.
3