Presentation is loading. Please wait.

Presentation is loading. Please wait.

DHCP server & Client Objectives Contents

Similar presentations


Presentation on theme: "DHCP server & Client Objectives Contents"— Presentation transcript:

1 DHCP server & Client Objectives Contents
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 Normally if you have client computers their IP addresses dynamically assigned from your name servers. The PC will most likely get its IP address at boot time from dhcp server’s. This chapter only covers the configuration of a DHCP server that provides IP addresses. The configuration of a Linux DHCP client that gets its IP address from a DHCP server is ”TCP/IP networking” chapter.

2 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 in our example, and for the tar ball. # yum install dhcp-server # rpm –ivh dhcp i586.rpm # rpm –ivh dhcp-server i586.rpm When searching for the file’s, remember that the DHCP server RPM's filename usually starts with the word "dhcp" followed by a version number like this: dhcp-3.0pl1-23.i386.rpm and dhcp-devel-3.0pl1-23.i386.rpm It become two rpm-files because one is libraries and the other is the server. TAR-balls are downloaded from ftp.isc.org/isc/dhcp/ it is ISC who maintain and develope the DHCP standards. Usally they offer Latest stable, beta version of next generation and historical versions. Tar ball is allways one file. Remember to download the tar-ball and rpm’s in /usr/local/src because it is the standard place for forigin sources. # cd /usr/local/src # wget ftp://ftp.isc.org/isc/dhcp/dhcp tar.gz

3 The /etc/dhcpd.conf File basics
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 # cp /usr/share/doc/dhcp-3.0pl1-23/dhcpd.conf.sample \   /etc/dhcpd.conf 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 ; } When DHCP starts it reads the file /etc/dhcpd.conf. It uses the commands here to configure your network. Many RPM packages don't automatically install a /etc/dhcpd.conf file, but you can find a sample copy of dhcpd.conf in the following directory which you can always use as a guide. You will probely have to copy the sample dhcpd.conf file to the /etc directory and then you'll have to edit it. There many more options statements you can use to configure DHCP. These include telling the DHCP clients where to go for services such as finger and IRC. Check the dhcp-options man page after you do your install. Manual pages: dhcpd.leases (5) DHCP client lease database dhcpdump (1) DHCP packet dumper dhcpd (8) Dynamic Host Configuration Protocol Server dhcpd.conf (5) dhcpd configuration file dhcp-options

4 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 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"; } subnet netmask { not authoritative; } ddns-update-style interim # Redhat Version 8.0+ ignore client-updates     # Fedora Core 1+ subnet netmask { # The range of IP addresses the server # will issue to DHCP enabled PC clients # booting up on the network range ; # Set the amount of time in seconds that # a client may keep the IP address default-lease-time 86400; max-lease-time 86400; # Set the default gateway to be used by # the PC clients option routers ; # Don't forward DHCP requests from this # NIC interface to any other NIC # interfaces option ip-forwarding off; # Set the broadcast address and subnet mask # to be used by the DHCP clients option broadcast-address ; option subnet-mask ; # Set the DNS server to be used by the # DHCP clients option domain-name-servers ; # Set the NTP server to be used by the option nntp-server ; # If you specify a WINS server for your Windows clients, # you need to include the following option in the dhcpd.conf file: option netbios-name-servers ; } # # List an unused interface here # subnet netmask { } # You can also assign specific IP addresses based on the clients' # ethernet MAC address as follows (Host's name is "smallfry": host smallfry { hardware ethernet 08:00:2b:4c:59:23; fixed-address ; next-server ; # tftp-server filename "pxelinux.0"; # bootloader host brutebert { hardware ethernet00:B0:D0:39:63:8C; }

5 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; key "DHCP-UPDATER" { algorithm HMAC-MD5; secret ”<keydata>"; } You will need to have a DNS server (bind) installed for fullfunctionality, this just show you what to do on the DHCPserverside,since it is updating the nameserver zonefiles. The update procedure isprotected by the MD5 checksummed key. Here we make this key as a checksum of dhcp.net05.se. 1. Generate authorized key for zone file updates: dnssec-keygen -a HMAC-MD5 -b 512 -n HOST dhcp.net05.se 2. Chen that the two keyfiles were made ls -1 Kdhcp.net05.se key Kdhcp.net05.se private 3. Look inside the key files cat K* dhcp.net05.se. IN KEY nLcoYW0ns1P4CgQU2kTH4aLmwB8a91xd6Va+HwkZI4xIQ7dPKMdS/s2a PBp5oU4p/R8VUqx2Pp7ZrxvxqTHqNw== Private-key-format: v1.2 Algorithm: 157 (HMAC_MD5) Key: nLcoYW0ns1P4CgQU2kTH4aLmwB8a91xd6Va+HwkZI4xIQ7dPKMdS/s2aPBp5oU4p/R8VUqx2Pp7ZrxvxqTHqNw== 4. Mark and copy all after Key: the .private (skip the first spacebar) 5. Paste the key inside secret ”<keydata>” secret ” nLcoYW0ns1P4CgQU2kTH4aLmwB8a91xd6Va+HwkZI4xIQ7dPKMdS/s2aPBp5oU4p/R8VUqx2Pp7ZrxvxqTHqNw==”

6 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 in-addr.arpa. { primary ; key DHCP-UPDATER; } In next chapter wewillfinalize the Dynamic DNS updater. Dynamic DNS is very comfortable in some enviroments where a lot of PC’s are setup independently of eachother. It is not nessesary to add names for all of them inside the DNS,the DHCP will simply take the client hostname and try to update the DNS. It works for most of the time, but sometimes not, you are warned. authoritative; get-lease-hostnames true; do-forward-updates true; allow unknown-clients; ddns-updates on;

7 Upgrading Your DHCP Server
When updating Look 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+ Always refer to the sample file after doing an upgrade as new required commands may have been added. For example, in Redhat Version 8.0+ (dhcpd version 3.0b2pl11>) you will need to add the line at the very top of the config file or else you will get errors: ddns-update-style interim If you install with rpm, your current dhcpd.conf file will be saved as dhcpd.conf.rpm

8 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 Stoppinig and Reloading the server # 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; } Some older Fedora / RedHat versions of the DHCP server will fail unless there is an existing dhcpd.leases file or if it is missing. Use the command "touch /var/lib/dhcp/dhcpd.leases" to create the file if it does not exist. Only edit the leases file when you have trouble with some client IP address! Use the /etc/init.d/dhcpd script to start/stop/restart DHCP after booting Remember to restart the DHCP process every time you make a change to the conf file for the changes to take effect on the running process. You also can test whether the DHCP process is running with the following command, you should get a response of plain old process ID numbers: pgrep dhcpd Finally, always remember to set your PC to get its IP address via DHCP. # chkconfig dhcpd on # service dhcpd start # service dhcpd stop # service dhcpd restart

9 Modify Your Routes for DHCP on Linux Server
Temporary solution 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/sysconfig/static-routes If this doesn't work properly try adding the following entry to your /etc/hosts file: # route add -host dev eth0 dhcp # route add -host dhcp dev eth0 This step is usally not nessesary! When a DHCP configured PC boots, it will request its IP address from the DHCP server. It does this by sending a standardized DHCP broadcast request packet to the DHCP server with a source IP address of You will have to add a route for this address on your Linux DHCP server so that it knows the interface on which to send the reply, if not, it sends it to the default gateway. (In both examples below, we're assuming that DHCP requests will be coming in on interface eth0). Note:    You can't run your DHCP sever on multiple interfaces as you can only have one route to network If you try to do it, you'll discover that DHCP serving working on only one interface. eth0 host dhcp

10 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


Download ppt "DHCP server & Client Objectives Contents"

Similar presentations


Ads by Google