dhcp server & client objectives –to learn how to setup dhcp servers contents –download and...
TRANSCRIPT
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 RedHat– With yum/up2date (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 yum– Will download and start configure DHCP
• Installing from RPM’s
• You can also obtain dhcp sources directly from ISC
The version rpm number is dhcp-3.0.2-6 in our example, and 3.0.3 for the tar ball.
# yum install dhcp-server# yum install dhcp-server
# rpm –ivh dhcp-3.0.2-6.i586.rpm# rpm –ivh dhcp-server-3.0.2-6.i586.rpm
# rpm –ivh dhcp-3.0.2-6.i586.rpm# rpm –ivh dhcp-server-3.0.2-6.i586.rpm
# cd /usr/local/src# wget ftp://ftp.isc.org/isc/dhcp/dhcp-3.0.3.tar.gz
# cd /usr/local/src# wget ftp://ftp.isc.org/isc/dhcp/dhcp-3.0.3.tar.gz
• Sample dhcpd.conf file:/usr/share/doc/dhcp-<version-number>/dhcpd.conf.sample
Their version number is dhcp-3.0pl1-23 in this example
• Begin with the sample configuration file
• Basic file format
The /etc/dhcpd.conf File basics
# cp /usr/share/doc/dhcp-3.0pl1-23/dhcpd.conf.sample \ /etc/dhcpd.conf
# cp /usr/share/doc/dhcp-3.0pl1-23/dhcpd.conf.sample \ /etc/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 { default-lease-time 86400; max-lease-time 86400;option routers 192.168.1.100;option log-servers 192.168.1.100;option broadcast-address 192.168.1.255;option domain-name-servers 192.168.1.100, 80.84.37.3;option nntp-server 192.168.1.100;range 192.168.1.201 192.168.1.220; }
subnet 192.168.1.0 netmask 255.255.255.0 { default-lease-time 86400; max-lease-time 86400;option routers 192.168.1.100;option log-servers 192.168.1.100;option broadcast-address 192.168.1.255;option domain-name-servers 192.168.1.100, 80.84.37.3;option nntp-server 192.168.1.100;range 192.168.1.201 192.168.1.220; }
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 80.84.37.0 netmask 255.255.255.240 { not authoritative; }
subnet 80.84.37.0 netmask 255.255.255.240 { not authoritative; }
host printer { hardware ethernet 00:50:DA:38:CE:23; fixed-address 192.168.1.64; option domain-name-servers 192.168.1.100; option broadcast-address 192.168.1.255; option domain-name "printer.ikea.se";}
host printer { hardware ethernet 00:50:DA:38:CE:23; fixed-address 192.168.1.64; option domain-name-servers 192.168.1.100; option broadcast-address 192.168.1.255; option domain-name "printer.ikea.se";}
next-server 192.168.1.60; # tftp-serverfilename "pxelinux.0"; # bootloaderhost brutebert { hardware ethernet00:B0:D0:39:63:8C; }
next-server 192.168.1.60; # tftp-serverfilename "pxelinux.0"; # bootloaderhost 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 ”<keydata>";}
key "DHCP-UPDATER"{ algorithm HMAC-MD5; secret ”<keydata>";}
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 172.16.0.5; key DHCP-UPDATER;}
zone radio.ing-steen.se.{ primary 172.16.0.5; key DHCP-UPDATER;}
zone 16.172.in-addr.arpa.{ primary 172.16.0.5; key DHCP-UPDATER;}
zone 16.172.in-addr.arpa.{ primary 172.16.0.5; 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;
Upgrading Your DHCP Server
• When updatingLook in header of sample file: /usr/share7doc/dhcp<version>/dhcpd.conf.sample
Add those lines in your existing /etc/dhcpd.conf file
ddns-update-style interim # Redhat Version 8.0+ignore client-updates # Fedora Core 1+
ddns-update-style interim # Redhat Version 8.0+ignore client-updates # Fedora Core 1+
How to get DHCP started
• DHCPD is depending on /var/lib/dhcp/dhcpd.leasesYou might need to erase existing lease files and create an empty:
dhcpd.leases contain leases database format when in action:
• Starting the dhcpd server
• Stoppinig and Reloading the server
# 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 172.16.0.67 { starts 0 2004/09/05 04:41:09; ends 1 2004/09/06 04:41:09; hardware ethernet 00:0d:93:83:8a:8e; uid 01:00:0d:93:83:8a:8e;}
lease 172.16.0.67 { starts 0 2004/09/05 04:41:09; ends 1 2004/09/06 04:41:09; hardware ethernet 00:0d:93:83:8a:8e; uid 01:00:0d:93:83:8a:8e;}
# chkconfig dhcpd on# chkconfig dhcpd on
# service dhcpd start# service dhcpd stop# service dhcpd restart
# service dhcpd start# service dhcpd stop# service dhcpd restart
Modify Your Routes for DHCP on Linux Server
• Temporary solutionAdd the route to 255.255.255.255 from the command line
If the message 255.255.255.255: Unknown host appears then try adding the following entry to your /etc/hosts file:
Then, try:
• Permanent solution add in /etc/sysconfig/static-routes
If this doesn't work properly try adding the following entry to your /etc/hosts file:
# route add -host dhcp dev eth0# route add -host dhcp dev eth0
# route add -host 255.255.255.255 dev eth0# route add -host 255.255.255.255 dev eth0
255.255.255.255 dhcp255.255.255.255 dhcp
eth0 host 255.255.255.255eth0 host 255.255.255.255
255.255.255.255 dhcp255.255.255.255 dhcp
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