Linux basic configurations - linux dhcp http://basicconfig.com/taxonomy/term/18 en Install and configure dhcp server in Slackware Linux http://basicconfig.com/linuxnetwork/install_configure_dhcp_server_slackware_linux <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>A computer needs an ip address in order to communicate with other computer in a networking environment while a server needs to provide ip addresses for all its clients (users). There are two types of server that provide ip addresses to clients, a dynamic ip address server and static ip address server. A server that provides dynamic ip address is called a DHCP server (DHCP - Dynamic Host Configuration Protocol). That is the server that we are going to setup here.</p> <p>Before we begin, let's look at how dhcp server works and some basic information about dhcp. A dhcp server not only handing over ip addresses to clients but also provides complete networking requirements such as subnet mask, DNS address and gateway router address. All these information are given automatically during boot up when a client has been configured to be a dhcp client.</p> <p>A dhcp server is reasonable in a network environment where over 15 clients needed ip addresses. The reason is static ip addresses are hard to manage and in case of organization is planning for expenditure, dhcp is future proof. A dhcp server needs to be configured with a range of ip addresses that it can assign to network clients. When a client is boot up, it will provide an ip address along with other required addresses and prepare the next ip address in range for the next client. The ip address is never fix for one client, that's why it's called dynamic. When a client computer is shutdown, its ip address is released and can be assigned to another computer.That how a dhcp server works.</p> <h2>Install dhcp server in Slackware</h2> <p>A Linux server needs a dhcp service which is called a dhcpd (it's dhcp daemon) installed before dhcp can be configured. Slackware compiled dhcpd package is in /slackware-12.1/source/n/dhcp directory in Slackware installation dvd. It's recommended to download the latest dhcpd packages from Linux distribution's website or package maintainer website.</p> <p>In Slackware Linux, installing a package is easy with a package utility called pkgtool. Pkgtool is a menu base tool. To use the utility, just type pkgtool in command line terminal. However you need to download whatever package you want to install because pkgtool can't get package from the Internet.</p> <p>Go to <a href="http://packages.slackware.it" target="blank">Slackware packages website</a> to download latest dhcpd package released.</p> <p>Search current dhcpd package, choose nearest mirror and download it. Save dhcpd package in /tmp directory.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/dhcp01.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/dhcp01.png" alt="Slackware search current dhcp package" /></a></p> <p>Change directory to /tmp. Type pkgtool at command line terminal. </p> <table><tr><td><code>root@slackware:# <span style="color:red;">cd /tmp</span><br /> root@slackware:/tmp# <span style="color:red;">pkgtool</span><br /></code></td> </tr></table><p>Choose Current - Install packages from the current directory.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/dhcp02.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/dhcp02.png" alt="Install dhcp packages from the current directory" /></a></p> <p>Choose Yes - Install package dhcp-3.0.6-i486-1.</p> <p><a href="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/dhcp03.png" title="Image" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/j/jinlusuh/thumbs/dhcp03.png" alt="Install package dhcp-3.0.6-i486-1" /></a></p> <p>Slackware also has software package management system called <em>slackpkg</em> which works similar to Debian <em>aptitude</em>. Slackpkg can automatically install and update software package via the Internet. You can install slackpkg from Slackware dvd in <em>extra</em> package. The steps for slackpkg installation from cd or dvd using pkgtool is the same as dhcp installation above. For more information about Slackware slackpkg, see <a href="/linux/slackpkg">slackpkg - Slackware package management system </a>tutorial. Here is a slackpkg syntax to install and upgrade dhcpd package:</p> <ol><li><b><a href="mailto:root@slackware">root@slackware</a>:~# slackpkg install dhcpd</b></li> <li><b><a href="mailto:root@slackware">root@slackware</a>:~# slackpkg upgrade dhcpd</b></li> </ol><p>When you invoke the <b>slackpkg install dhcpd</b>, dhcpd package will be downloaded from the chosen mirror when setting up slackpkg. If you experienced slow connectivity or dhcp download failed, choose other slackpkg mirror. That's all. With slackpkg, you just type the command, and slackpkg will do the rest.</p> <h2>Configure dhcp server in Slackware</h2> <p>The first step is done, now we are going to configure dhcp server in Slackware Linux. Before we continue, let's check whether dhcp package was successfully installed in our system:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">slackpkg search dhcp</span><br /><br /> The list below shows all packages with the selected pattern.<br /><br /> [ installed ] - kdelibs-3.5.9-i486-4<br /><span style="color:blue;">[ installed ] - dhcp-3.0.6-i486-1</span><br /> [ installed ] - dhcpcd-2.0.4-i486-2<br /> [ installed ] - iproute2-2.6.16_060323-i486-2<br /><br /> root@slackware:~#<br /></code></td> </tr></table><p>If you don't have slackpkg, use pkgtool to view the installed packages. You can also check dhcpd package in installed packages log with this command:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">ls -l /var/log/packages | grep dhcpd</span><br /></code></td> </tr></table><p>A dhcp server configuration file is called dhcpd.conf. You can find it in /etc directory. Here, see this:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">cd /etc/</span><br /> root@slackware:/etc# <span style="color:red;">ls -l | grep dhcp</span><br /> drwxr-xr-x 2 root root 4096 2006-07-26 14:09 dhcpc/<br /> -rw-r--r-- 1 root root 75 2008-04-09 10:16 dhcpd.conf<br /> root@slackware:/etc#<br /></code></td> </tr></table><p>Let's see what is in the configuration file:</p> <table><tr><td><code>root@slackware:/etc# <span style="color:red;">cat dhcpd.conf</span><br /> # dhcpd.conf<br /> #<br /> # Configuration file for ISC dhcpd (see 'man dhcpd.conf')<br /> #<br /> root@slackware:/etc#<br /></code></td> </tr></table><p>It's nothing inside. No dhcp configuration's example. Is that means we must start everything from zero? No, don't worry. We have an example of dhcp server configuration in /usr/doc/dhcp-3.0.6/examples/dhcpd.conf. So we just copy the dhcp configuration file and replace our dhcpd.conf file in /etc directory. Here we go:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">cp /usr/doc/dhcp-3.0.6/examples/dhcpd.conf /etc/dhcpd.conf</span><br /> root@slackware:~#<br /></code></td> </tr></table><p><em>Update</em>: Slackware64 14.1 has dhcpd.conf.example in /etc directory.</p> <p>What we need to do next is to use text editor and edit configuration for our network. Here is example of my dhcpd.conf configuration:</p> <table><tr><td><code># dhcpd.conf<br /> #<br /> # Sample configuration file for ISC dhcpd<br /> #<br /><br /> # If this DHCP server is the official DHCP server for the local<br /> # network, the authoritative directive should be uncommented.<br /> authoritative;<br /><br /> # A slightly different configuration for an internal subnet.<br /> # I choose this section to edit for my local dhcp configuration<br /> subnet 192.168.1.0 netmask 255.255.255.0 {<br /> option domain-name "example.com";<br /> option broadcast-address 192.168.1.255;<br /> option domain-name-servers 200.133.0.133 200.133.1.5;<br /> option subnet-mask 255.255.255.0;<br /> option routers 192.168.1.1;<br /> range 192.168.1.20 192.168.1.100;<br /> default-lease-time 600;<br /> max-lease-time 7200;<br /> }<br /></code></td> </tr></table><p>You can add a static server if you have it in your network. Just edit the default example configuration. After you are done setting up server and ip address required in the dhcpd.conf configuration file, save it. It's time to start the dhcp service (dhcp daemon) now.</p> <h2>Start dhcpd service</h2> <p>First we must enable dhcpd service in /etc/rc.d directory and make it executable. If you don't have /etc/rc.d/rc.dhcpd, then copy the code below and save it as rc.dhcpd. Here is the easy way to do it:</p> <p>1 - Copy this code:</p> <table><tr><td><code>#!/bin/sh<br /> #<br /> # /etc/rc.d/rc.dhcpd<br /> # This shell script takes care of starting and stopping<br /> # the ISC DHCPD service<br /> #<br /><br /> # Put the command line options here that you want to pass to dhcpd:<br /> DHCPD_OPTIONS="-q eth1"<br /><br /> [ -x /usr/sbin/dhcpd ] || exit 0<br /><br /> [ -f /etc/dhcpd.conf ] || exit 0<br /><br /> start() {<br /> # Start daemons.<br /> echo -n "Starting dhcpd: /usr/sbin/dhcpd $DHCPD_OPTIONS "<br /> /usr/sbin/dhcpd $DHCPD_OPTIONS<br /> echo<br /> }<br /> stop() {<br /> # Stop daemons.<br /> echo -n "Shutting down dhcpd: "<br /> killall -TERM dhcpd<br /> echo<br /> }<br /> status() {<br /> PIDS=$(pidof dhcpd)<br /> if [ "$PIDS" == "" ]; then<br /> echo "dhcpd is not running!"<br /> else<br /> echo "dhcpd is running at pid(s) ${PIDS}."<br /> fi<br /> }<br /> restart() {<br /> stop<br /> start<br /> }<br /><br /> # See how we were called.<br /> case "$1" in<br /> start)<br /> start<br /> ;;<br /> stop)<br /> stop<br /> ;;<br /> restart)<br /> stop<br /> start<br /> ;;<br /> status)<br /> status<br /> ;;<br /> *)<br /> echo "Usage: $0 {start|stop|status|restart}"<br /> ;;<br /> esac<br /> exit 0<br /></code></td> </tr></table><p>2 - In Slackware command line terminal, type <b>cat &gt; rc.dhcpd</b> and enter. Right-click mouse to paste the code that you copy just now. See example below:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">cat &gt; rc.dhcpd</span><br /> #!/bin/sh<br /> #<br /> # /etc/rc.d/rc.dhcpd<br /> #<br /> # Start/stop/restart the DHCP daemon.<br /> #<br /> # To make dhcpd start automatically at boot, make this<br /> # file executable: chmod 755 /etc/rc.d/rc.dhcpd<br /> ...<br /> ...<br /> ...<br /></code></td> </tr></table><p>Press Ctrl+d to save and exit. You can view the file with less or cat command. Now move the rc.dhcpd file to /etc/rc.d/ directory. See complete step by step instructions example below:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">less rc.dhcpd</span><br /> root@slackware:~# <span style="color:red;">mv rc.dhcpd /etc/rc.d/rc.dhcpd</span><br /> root@slackware:~# <span style="color:red;">ls -l /etc/rc.d/rc.dhcpd</span><br /> -rw-r--r-- 1 root root 792 2008-12-02 15:47 /etc/rc.d/rc.dhcpd<br /> root@slackware:~# <span style="color:red;">chmod 755 /etc/rc.d/rc.dhcpd</span><br /> root@slackware:~# <span style="color:red;">ls -l /etc/rc.d/rc.dhcpd</span><br /> -rwxr-xr-x 1 root root 792 2008-12-02 15:47 /etc/rc.d/rc.dhcpd*<br /> root@slackware:~#<br /></code></td> </tr></table><p>Now add the lines below to the /etc/rc.d/rc.local file to start dhcpd at boot:</p> <table><tr><td><code>if [ -x /etc/rc.d/rc.dhcpd ]; then<br /> /etc/rc.d/rc.dhcpd start<br /> fi </code></td> </tr></table><p>Let's start the dhcpd service now:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">/etc/rc.d/rc.dhcpd start</span><br /> Starting DHCPD...<br /> root@slackware:~#<br /></code></td> </tr></table><p>We can check to see if dhcpd daemon is running using daemon status check. See example below:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">/etc/rc.d/rc.dhcpd status</span><br /><span style="color:orange;">dhcpd is not running!</span><br /> root@slackware:~#<br /></code></td> </tr></table><p>The example shows that dhcpd is not running. There must be something wrong. We can troubleshoot dhcpd error by looking at the system's log. Use <b>tail /var/log/syslog</b> and <b>tail /var/log/messages</b> to read the last 10 logs. Carefully read the error and try suggestion given. See example below:</p> <table><tr><td><code>root@slackware:~# <span style="color:red;">cat /var/log/syslog</span><br /> Jun 20 14:23:15 slackware dhcpd: <span style="color:orange;">/etc/dhcpd.conf line 57: semicolon expected.</span><br /> Jun 20 14:23:15 slackware dhcpd: option domain-name-servers 200.133.0.133 200.<br /> Jun 20 14:23:15 slackware dhcpd: ^<br /> Jun 20 14:23:15 slackware dhcpd: Configuration file errors encountered -- exiting<br /> Jun 20 14:23:15 slackware dhcpd:<br /> Jun 20 14:23:15 slackware dhcpd: If you did not get this software from ftp.isc.org, please<br /> Jun 20 14:23:15 slackware dhcpd: get the latest from ftp.isc.org and install that before<br /> Jun 20 14:23:15 slackware dhcpd: requesting help.<br /> Jun 20 14:23:15 slackware dhcpd:<br /> Jun 20 14:23:15 slackware dhcpd: If you did get this software from ftp.isc.org and have not<br /> Jun 20 14:23:15 slackware dhcpd: yet read the README, please read it before requesting help.<br /> Jun 20 14:23:15 slackware dhcpd: If you intend to request help from the dhcp-server@isc.org<br /> Jun 20 14:23:15 slackware dhcpd: mailing list, please read the section on the README about<br /> Jun 20 14:23:15 slackware dhcpd: submitting bug reports and requests for help.<br /> Jun 20 14:23:15 slackware dhcpd:<br /> Jun 20 14:23:15 slackware dhcpd: Please do not under any circumstances send requests for<br /> Jun 20 14:23:15 slackware dhcpd: help directly to the authors of this software - please<br /> Jun 20 14:23:15 slackware dhcpd: send them to the appropriate mailing list as described in<br /> Jun 20 14:23:15 slackware dhcpd: the README file.<br /> Jun 20 14:23:15 slackware dhcpd:<br /> Jun 20 14:23:15 slackware dhcpd: exiting.<br /> root@slackware:~#<br /></code></td> </tr></table><p>The example above shows that we are missing a semicolon in the /etc/dhcpd.conf file. Actually we got semicolon there but the exact error dhcpd daemon won't start is we need to put a comma to separate two dns ip addresses. So go back and fix the error and start dhcpd daemon again. When dhcpd daemon successfully started, then we can test client computer to connect to the Slackware dhcp server.</p> <h2><a name="dhcp-client" id="dhcp-client"></a>Setup dhcp client on Windows Vista</h2> <p>The dhcp server is ready, now it's time to setup dhcp client. Here is the example to setup dhcp client in Windows Vista. Click <b>Start</b>, choose <b>All Programs</b> and right-click <b>Network</b>. Choose <b>Properties</b>. See picture below:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/2/vista-dhcp.jpg" title="" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/2/thumbs/vista-dhcp.jpg" alt="Windows Vista dhcp client setup image" class="imgp_img" /></a></p> <p>In Windows Vista Network Properties, choose <b>View Status</b> (Windows 7 changes the name to <b>Local Area Connection</b>). See image below:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/2/vista-dhcp2.jpg" title="" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/2/thumbs/vista-dhcp2.jpg" alt="Windows Vista Network Properties image" class="imgp_img" /></a></p> <p>When you click 'View Status', the Local Area Connection Status window pops up. Here we just click Properties. See image below:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/2/vista-dhcp3.jpg" title="" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/2/thumbs/vista-dhcp3.jpg" alt="Windows Vista Local Area Connection Status image" class="imgp_img" /></a></p> <p>Now the Local Area Network Properties window pops up. We choose <b>Internet protocol version 4</b> and click Properties. See image below:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/2/vista-dhcp4.jpg" title="" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/2/thumbs/vista-dhcp4.jpg" alt="Windows Vista Local Area Network Properties image" class="imgp_img" /></a></p> <p>In this window, make sure both <b>Obtain an IP address automatically</b> button and <b>Obtain DNS server address automatically</b> are clicked. Click <b>OK</b> and we are done. See picture below:</p> <p><a href="http://www.basicconfig.com/files/imagepicker/2/vista-dhcp5.jpg" title="" target="_blank"><img src="http://www.basicconfig.com/files/imagepicker/2/thumbs/vista-dhcp5.jpg" alt="Image" class="imgp_img" /></a></p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/18" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux dhcp</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/16" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux server</a></div></div></div> Wed, 22 Jun 2011 17:15:30 +0000 jinlusuh 120 at http://basicconfig.com http://basicconfig.com/linuxnetwork/install_configure_dhcp_server_slackware_linux#comments Install and configure dhcp server Ubuntu http://basicconfig.com/linuxnetwork/configure_dhcp_server_ubuntu <!-- google_ad_section_start --><div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p>This is a guide for Ubuntu dhcp server installation setup. DHCP is a Dynamic Host Configuration Protocol. By configuring a dhcp server, system administrator won't have to manually assign static ip address and other information for clients. </p> <p>A traditional Linux dhcp server called dhcpd. However, a default Ubuntu server Hardy installation, you can no longer install dhcpd. There is no more dhcpd. Ubuntu Hardy or Intrepid only has these dhcp client and server packages:</p> <table><tr><td><code>dhcp-helper (0.7-2) [universe]<br /> A DHCP relay agent<br /> dhcp3-client (3.0.6.dfsg-1ubuntu9)<br /> DHCP client<br /> dhcp3-common (3.0.6.dfsg-1ubuntu9)<br /> common files used by all the dhcp3* packages<br /> dhcp3-relay (3.0.6.dfsg-1ubuntu9) [universe]<br /> DHCP relay daemon<br /> dhcp3-server (3.0.6.dfsg-1ubuntu9)<br /> DHCP server for automatic IP address assignment<br /> dhcp3-server<br /> virtual package provided by udhcpd<br /> dhcpcd (1:3.0.17-2) [universe]<br /> DHCP client for automatically configuring IPv4 networking<br /></code></td> </tr></table><p>Never mind, so we need to install dhcp3-server instead. Here we go:</p> <table><tr><td><code>luzar@ubuntu:~$ <span style="color:red;">sudo apt-get install dhcp3-server</span><br /> [sudo] password for luzar:<br /> Reading package lists... Done<br /> Building dependency tree<br /> Reading state information... Done<br /> The following packages were automatically installed and are no longer required:<br /> libdns32 libisc32<br /> Use 'apt-get autoremove' to remove them.<br /> The following NEW packages will be installed:<br /> dhcp3-server<br /> 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.<br /> Need to get 318kB of archives.<br /> After this operation, 774kB of additional disk space will be used.<br /> Get:1 http://us.archive.ubuntu.com hardy/main dhcp3-server 3.0.6.dfsg-1ubuntu9 [318kB]<br /> Fetched 318kB in 5s (61.2kB/s)<br /> Preconfiguring packages ...<br /> Selecting previously deselected package dhcp3-server.<br /> (Reading database ... 18954 files and directories currently installed.)<br /> Unpacking dhcp3-server (from .../dhcp3-server_3.0.6.dfsg-1ubuntu9_i386.deb) ...<br /> Setting up dhcp3-server (3.0.6.dfsg-1ubuntu9) ...<br /> Generating /etc/default/dhcp3-server...<br /> * Starting DHCP server dhcpd3 <span style="color:red;">[fail]</span><br /> invoke-rc.d: initscript dhcp3-server, action "start" failed.<br /><br /> luzar@ubuntu:~$<br /></code></td> </tr></table><p>Well, now we have <i>Starting DHCP server dhcpd3 - Fail</i>. Let's see what is the problem:</p> <table><tr><td><code>luzar@ubuntu:~$ <span style="color:red;">tail /var/log/syslog</span><br /> Nov 21 11:14:54 ubuntu dhcpd:<br /> Nov 21 11:14:54 ubuntu dhcpd: No subnet declaration for eth0 (192.168.0.47).<br /> Nov 21 11:14:54 ubuntu dhcpd: ** Ignoring requests on eth0. If this is not what<br /> Nov 21 11:14:54 ubuntu dhcpd: you want, please write a subnet declaration<br /> Nov 21 11:14:54 ubuntu dhcpd: in your dhcpd.conf file for the network segment<br /> Nov 21 11:14:54 ubuntu dhcpd: to which interface eth0 is attached. **<br /> Nov 21 11:14:54 ubuntu dhcpd:<br /> Nov 21 11:14:54 ubuntu dhcpd:<br /> Nov 21 11:14:54 ubuntu dhcpd: Not configured to listen on any interfaces!<br /> Nov 21 11:17:01 ubuntu /USR/SBIN/CRON[4762]: (root) CMD ( cd / &amp;&amp; run-parts --report /etc/cron.hourly)<br /> luzar@ubuntu:~$<br /></code></td> </tr></table><p>So we haven't configure the dhcp configuration yet. Ok now let's configure the dhcp configuration file. The dhcp configuration file is /etc/dhcp3/dhcpd.conf. Below is the default ubuntu /etc/dhcp3/dhcpd.conf file:</p> <table><tr><td><code>#<br /> # Sample configuration file for ISC dhcpd for Debian<br /> #<br /> # Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as<br /> # configuration file instead of this file.<br /> #<br /> # $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $<br /> #<br /><br /> # The ddns-updates-style parameter controls whether or not the server will<br /> # attempt to do a DNS update when a lease is confirmed. We default to the<br /> # behavior of the version 2 packages ('none', since DHCP v2 didn't<br /> # have support for DDNS.)<br /> ddns-update-style none;<br /><br /> # option definitions common to all supported networks...<br /> option domain-name "example.org";<br /> option domain-name-servers ns1.example.org, ns2.example.org;<br /><br /> default-lease-time 600;<br /> max-lease-time 7200;<br /><br /> # If this DHCP server is the official DHCP server for the local<br /> # network, the authoritative directive should be uncommented.<br /> #authoritative;<br /><br /> # Use this to send dhcp log messages to a different log file (you also<br /> # have to hack syslog.conf to complete the redirection).<br /> log-facility local7;<br /><br /> # No service will be given on this subnet, but declaring it helps the<br /> # DHCP server to understand the network topology.<br /><br /> #subnet 10.152.187.0 netmask 255.255.255.0 {<br /> #}<br /><br /> # This is a very basic subnet declaration.<br /><br /> #subnet 10.254.239.0 netmask 255.255.255.224 {<br /> # range 10.254.239.10 10.254.239.20;<br /> # option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;<br /> #}<br /><br /> # This declaration allows BOOTP clients to get dynamic addresses,<br /><br /> # This declaration allows BOOTP clients to get dynamic addresses,<br /> # which we don't really recommend.<br /><br /> #subnet 10.254.239.32 netmask 255.255.255.224 {<br /> # range dynamic-bootp 10.254.239.40 10.254.239.60;<br /> # option broadcast-address 10.254.239.31;<br /> # option routers rtr-239-32-1.example.org;<br /> #}<br /><br /> # A slightly different configuration for an internal subnet.<br /> #subnet 10.5.5.0 netmask 255.255.255.224 {<br /> # range 10.5.5.26 10.5.5.30;<br /> # option domain-name-servers ns1.internal.example.org;<br /> # option domain-name "internal.example.org";<br /> # option routers 10.5.5.1;<br /> # option broadcast-address 10.5.5.31;<br /> # default-lease-time 600;<br /> # max-lease-time 7200;<br /> #}<br /><br /> # Hosts which require special configuration options can be listed in<br /> # host statements. If no address is specified, the address will be<br /> # allocated dynamically (if possible), but the host-specific information<br /> # will still come from the host declaration.<br /><br /> #host passacaglia {<br /> # hardware ethernet 0:0:c0:5d:bd:95;<br /> # filename "vmunix.passacaglia";<br /> # server-name "toccata.fugue.com";<br /> #}<br /><br /> # Fixed IP addresses can also be specified for hosts. These addresses<br /> # should not also be listed as being available for dynamic assignment.<br /> # Hosts for which fixed IP addresses have been specified can boot using<br /> # BOOTP or DHCP. Hosts for which no fixed address is specified can only<br /> # be booted with DHCP, unless there is an address range on the subnet<br /> # to which a BOOTP client is connected which has the dynamic-bootp flag<br /> # set.<br /> #host fantasia {<br /> # hardware ethernet 08:00:07:26:c0:a5;<br /> # fixed-address fantasia.fugue.com;<br /> #}<br /><br /> # You can declare a class of clients and then do address allocation<br /> # based on that. The example below shows a case where all clients<br /> # in a certain class get addresses on the 10.17.224/24 subnet, and all<br /> # other clients get addresses on the 10.0.29/24 subnet.<br /><br /> #class "foo" {<br /> # match if substring (option vendor-class-identifier, 0, 4) = "SUNW";<br /> #}<br /><br /> #shared-network 224-29 {<br /> # subnet 10.17.224.0 netmask 255.255.255.0 {<br /> # option routers rtr-224.example.org;<br /> # }<br /> # subnet 10.0.29.0 netmask 255.255.255.0 {<br /> # option routers rtr-29.example.org;<br /> # }<br /> # pool {<br /> # allow members of "foo";<br /> # range 10.17.224.10 10.17.224.250;<br /> # }<br /> # pool {<br /> # deny members of "foo";<br /> # range 10.0.29.10 10.0.29.230;<br /> # }<br /> #}<br /></code></td> </tr></table><p>Don't do anything to file yet. We need to backup the file in case something wrong happened. Use Linux cp command to duplicate the file like the example below:</p> <table><tr><td><code>luzar@ubuntu:~$ <span style="color:red;">sudo cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.bak</span><br /> [sudo] password for luzar:<br /> luzar@ubuntu:~$<br /></code></td> </tr></table><p>Now you can edit the file with your favorite text editor. Here is an example of a simple dhcpd.conf configuration for a local network:</p> <table><tr><td><code># /etc/dhcp3/dhcpd.conf<br /> #<br /> #<br /> ddns-update-style none;<br /><br /> # Lease time is in seconds<br /> # Default lease is 1 week (604800 seconds)<br /> default-lease-time 604800;<br /> # Max lease is 4 weeks (2419200 seconds)<br /> max-lease-time 2419200;<br /><br /> # If this DHCP server is the official DHCP server for the local<br /> # network, the authoritative directive should be uncommented.<br /> authoritative;<br /><br /> # All ip addresses and domain name are examples<br /> subnet 192.168.0.0 netmask 255.255.255.0 {<br /> option domain-name "example.com";<br /> option broadcast-address 192.168.0.255;<br /> option subnet-mask 255.255.255.0;<br /> option domain-name-servers 192.168.0.47, 192.168.1.5; # Comma between domain<br /> option routers 192.168.0.10;<br /> range 192.168.0.20 192.168.0.50; # No comma, just whitespace<br /> }<br /></code></td> </tr></table><p>To make the dhcpd.conf configuration file above works for you, just change the domain name and related ip addresses. When you are done, restart dhcp3 service again. Here is the command:</p> <table><tr><td><code>luzar@ubuntu:~$ <span style="color:red;">sudo /etc/init.d/dhcp3-server start</span><br /> * Starting DHCP server dhcpd3 [ OK ]<br /> luzar@ubuntu:~$<br /></code></td> </tr></table><p>If you failed again, then there is something wrong with your dhcp.conf configuration. Normally, there is an error prompt that include detail about the error such as error name and error line. So, write that down, open dhcp configuration file again and fix the error. Also you can find the error in /var/log/messages and /var/log/daemon.log files. Use tail command to view latest error.</p> <p>That's all. The Ubuntu dhcp server setup and configuration is complete. What's left is to configure client computers to use the server. For Windows client, here is a step by step instructions on <a href="/linuxnetwork/install_configure_dhcp_server_slackware_linux#dhcp-client">how to setup dhcp client</a></p> </div></div></div><!-- google_ad_section_end --><div class="field field-name-field-tags field-type-taxonomy-term-reference field-label-above"><div class="field-label">Tags:&nbsp;</div><div class="field-items"><div class="field-item even" rel="dc:subject"><a href="/taxonomy/term/18" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux dhcp</a></div><div class="field-item odd" rel="dc:subject"><a href="/taxonomy/term/16" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">linux server</a></div></div></div> Fri, 21 Nov 2008 16:34:08 +0000 jinlusuh 121 at http://basicconfig.com http://basicconfig.com/linuxnetwork/configure_dhcp_server_ubuntu#comments