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
Download the DHCP server (anser yes on all, you dont need developers if you dont compile) Install the RPM’s You can also obtain dhcp sources directly from # ftp ftp.redhat.com/pub/redhat/linux/9/en/os/i386/RedHat/RPMS mget dhcp* # rpm –ivh dhcp-3.0pl1-23.i386.rpm Most RedHat and Fedora Linux software products are available in the RPM format. Downloading and installing RPMs isn't hard. If you need a refresher, the RPM chapter covers how to do this in detail. When searching for the file, 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

3 The /etc/dhcpd.conf File basics
Sample dhcpd.conf file: /usr/share/doc/dhcp-<version-number>/dhcpd.conf.sample There version number is dhcp-3.0pl1-23 in our example Begin with the sample 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. # man 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 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 ;

5 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

6 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 # /etc/init.d/dhcpd start # /etc/init.d/dhcpd stop # /etc/init.d/dhcpd restart

7 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

8 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