DHCP server & Client Objectives –to learn how to setup dhcp servers Contents –Download and Install The DHCP Package –The /etc/dhcpd.conf File –Upgrading Your DHCP Server –How to get DHCP started –Modify Your Routes for DHCP on Linux Server –Configuring Linux clients to use DHCP –Simple DHCP TroubleshootingPracticals –working with TCP/IP utilities and files
Download and Install The DHCP Package You have three ways to install DHCP server on SuSE –With Yast (install sample config and prepare lease data base) –RPM (Simply install it, togeather with sample config) –You need at least RPM-package dhcp-server if you download manually –TAR-BALL (Allways latest version, the ISC standard dhcp, manual work) Getting the DHCP server with YAST –Will download and start configure DHCP Installing from RPM’s –Download from Sunet or ftp.suse.com You can also obtain dhcp sources directly from ISC The version rpm number is dhcp in our example, and for the tar ball. # rpm –ivh dhcp i586.rpm # rpm –ivh dhcp-server i586.rpm # rpm –ivh dhcp i586.rpm # rpm –ivh dhcp-server i586.rpm # yast dhcp-server # cd /usr/local/src # wget ftp://ftp.isc.org/isc/dhcp/dhcp tar.gz # cd /usr/local/src # wget ftp://ftp.isc.org/isc/dhcp/dhcp tar.gz
Copy sample dhcpd.conf file to /etc/. : RPM: TAR: It is practical to begin with the sample config file Basic file format, here the subnet declaration The /etc/dhcpd.conf File basics cp /usr/local/src/dhcp-3.0.3/server/dhcpd.conf /etc/. subnet netmask { default-lease-time 86400; max-lease-time 86400; option routers ; option log-servers ; option broadcast-address ; option domain-name-servers , ; option nntp-server ; range ; } subnet netmask { default-lease-time 86400; max-lease-time 86400; option routers ; option log-servers ; option broadcast-address ; option domain-name-servers , ; option nntp-server ; range ; } cp /usr/share/doc/packages/dhcp-server/dhcpd.conf /etc/.
The /etc/dhcpd.conf File fix/denial Deliver fixed address to a host Dont do DHCP on all interfaces/subnets if multihomed TFTP boot server and boot loader file subnet netmask { not authoritative; } subnet netmask { not authoritative; } host printer { hardware ethernet 00:50:DA:38:CE:23; fixed-address ; option domain-name-servers ; option broadcast-address ; option domain-name "printer.ikea.se"; } host printer { hardware ethernet 00:50:DA:38:CE:23; fixed-address ; option domain-name-servers ; option broadcast-address ; option domain-name "printer.ikea.se"; } next-server ;# tftp-server filename "pxelinux.0";# bootloader host brutebert { hardware ethernet00:B0:D0:39:63:8C; } next-server ;# tftp-server filename "pxelinux.0";# bootloader host brutebert { hardware ethernet00:B0:D0:39:63:8C; }
Dynamic DNS & DHCP This is not the full story, DNS is also needed –You will need a DNS in order to update zonefiles Main entries in /etc/dhcpd.conf You also need one authorized key to allow updates These entries comes before any subnet declaration authoritative; ddns-update-style interim; ddns-domainname "radio.ing-steen.se"; update-static-leases on; authoritative; ddns-update-style interim; ddns-domainname "radio.ing-steen.se"; update-static-leases on; key "DHCP-UPDATER" { algorithm HMAC-MD5; secret ” "; } key "DHCP-UPDATER" { algorithm HMAC-MD5; secret ” "; }
Dynamic DNS & DHCP The Forward and Reverse name Zone-files to update –They came after the ddns entries in same file. –Zones must be specified to the DHCP Last comes the standard subnet declaration, like on page 3 with this added to it zone radio.ing-steen.se. { primary ; key DHCP-UPDATER; } zone radio.ing-steen.se. { primary ; key DHCP-UPDATER; } zone in-addr.arpa. { primary ; key DHCP-UPDATER; } zone in-addr.arpa. { primary ; key DHCP-UPDATER; } authoritative; get-lease-hostnames true; do-forward-updates true; allow unknown-clients; ddns-updates on; authoritative; get-lease-hostnames true; do-forward-updates true; allow unknown-clients; ddns-updates on;
How to get DHCP started DHCPD is depending on /var/lib/dhcp/dhcpd.leases You might need to erase existing lease files and create an empty: dhcpd.leases contain leases database format when in action: Starting the dhcpd server at boot Stopping and Reloading the server Manual start of dhcpd (tar-ball) # rm –f /var/lib/dhcp/dhcpd.leases # touch /var/lib/dhcp/dhcpd.leases # rm –f /var/lib/dhcp/dhcpd.leases # touch /var/lib/dhcp/dhcpd.leases lease { starts /09/05 04:41:09; ends /09/06 04:41:09; hardware ethernet 00:0d:93:83:8a:8e; uid 01:00:0d:93:83:8a:8e; } lease { starts /09/05 04:41:09; ends /09/06 04:41:09; hardware ethernet 00:0d:93:83:8a:8e; uid 01:00:0d:93:83:8a:8e; } # chkconfig dhcpd on # rcdhcpd start # rcdhcpd stop # rcdhcpd restart # rcdhcpd start # rcdhcpd stop # rcdhcpd restart # /usr/sbin/dhcpd –cf /etc/dhcpd.conf
Modify Your Routes for DHCP on Linux Server Client temporary solution to broadcast for IP Add the route to from the command line If the message : Unknown host appears then try adding the following entry to your /etc/hosts file: Then, try: Permanent solution add in /etc/init.d/boot.local # route add -host dhcp dev eth0 # route add -host dev eth dhcp # route add -host dev eth0
Summary DHCP server is used to deliver IP parameters Configuration sit in /etc/dhcpd.conf Leases sit in /var/lib/dhcp/dhcpd.leases DHCP can deliver boot strap files to diskless With options you can deliver many functions DHCP server usally run as stand alone server Start dhcp server with /etc/init.d/dhcpd start Stop dhcp server with /etc/init.d/dhcpd stop Reload dhcp server with /etc/init.d/dhcpd restart DHCP can be used with DNS for dynamic DNS