
How do I install DHCP on my Linux Server?I am planning to install DHCP on my Linux Server. I do not know that much in Linux (Red Hat), however. How can I install and configure a DHCP server on my system? First off, a definition. DHCP is the Dynamic Host Configuration Protocol and rather than use the default DHCP server included with your Red Hat / Fedora Linux system, I recommend that you pop over to the Internet Software Consortium and Download the latest version of the DHCP Server. As I write this, it's at version 3.0.3. Why is it important to have the latest version? In a word, security. As with any software that you're going to run on your server, it's critically important that you have the very latest version of this 'daemon' (as we Linux geeks call programs that run on the server without intervention) on your system. It's also very important to shut off any services you aren't using (a process I detail in my popular book Teach Yourself Unix System Administration in 24 Hours, by the way). So once you've downloaded the latest version of the software, you'll want to unpack it with: $ tar xzf ./dhcp-303-tar.gz
Now, move to the new directory that contains all the source and type in the following commands (the tons of output these commands have has been deleted to save our sanity here): $ ./configure
$ make Assuming all has gone well, switch to root by using the sudo command and install the new server: $ sudo make install
you'll be prompted for the root password, then, if you typed it in correctly, the new DHCP server will be installed onto your system. Good. Now you have the latest DHCP server it's time to configure it properly for your environment. This is best done by copying the file server/dhcp.conf from the installation directory into your /etc directory, like this: $ sudo cp server/dhcp.conf /etc
This time, since you just did a sudo command a few seconds ago, you won't be prompted for your password (an exceedingly slick feature of sudo, actually!) Now, again using sudo, it's time to edit the configuration file to match your system configuration. Here's what the dhcp.conf file looks like:
ddns-update-style interim # Redhat Version 8.0+
subnet 192.168.1.0 netmask 255.255.255.0 { # The range of IP addresses the server will issue to range 192.168.1.201 192.168.1.220; # Set the amount of time in seconds that default-lease-time 86400; option broadcast-address 192.168.1.255; option domain-name-servers 192.168.1.100; option netbios-name-servers 192.168.1.100; } # List an unused interface here host smallfry { As with many Linux configuration files, this is actually fairly well documented, especially since you should be able to type man dhcp-options to get an exhaustive explanation of each and every configuration option. In particular, make sure you set the domain name properly, identify your set of DNS servers by name, and define the subnet range for which you want to provide services via DHCP. Once that's all configured to your liking, a little bit more tweaking is required to get everything checked and started properly: $ sudo touch /var/lib/dhcp/dhcp.leases
Will make sure that you have a 'leases' file, a critical part of how the DHCP server tracks what systems it's seen and serviced. $ sudo chkconfig --level 35 dhcpd on
This will check your configuration and make sure it will be added to the list of daemons to start up at boot time from now on. Very useful if you don't want to remember to restart it each time! $ /etc/init.d/dhcp restart
Now you should be running a DHCP server on your system. Check to make sure it's running by using ps aux | grep dhcp but you should be -- hopefully -- good to go!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.
Categorized:
Unix and Linux Help
(Article 4170)
Tagged: Previous: Why Does My Mac Always Try to Boot Off the Wrong Disk? Next: How do I build a cool LinkedIn Signature Box? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. unless you really need to flexibility and power of a true blue dhcp server, try udhcpd. just google for it. its small and fairly stable for what its built for. kjteoh Posted by: kjteoh at February 7, 2006 4:57 AMI want to know whether dhcp works across VLAN. We're getting a bit out of my depths, but as far as I understand, you'd need a different DHCP server on each LAN segment. Posted by: Dave Taylor at February 28, 2006 9:03 AMYou don't need a DHCP server per VLAN. You will need to configure the L3 switch or router to forward IP broadcasts - Cisco uses IP helper command. When the router forwards the DHCP request it will "tell" the DHCP server from which subnet the request came. Your DHCP will then (if it supports it) allocate an appropriate IP address (ie one from that subnet). Some DHCP servers will only allocate addresses from their own subnet (in which case it won't work). Posted by: Steve Worrall at May 31, 2006 4:05 PMFor different vlans how can i set up my dhcp server so that my client in diff.vlans get ip from dhcp server. hello Suport, now i have dhcp server but that is very old now i want migrate this in new one , please guide me how can i take the backup of old ane restor same in new also let me know what configuration is require for dhcp installation in linux box. i have downloaded the .tar, unpacked it, ./configure-make, are the commands i have done so far. but i have this lines after the make command cc -g -I/root/dhcp-3.0.6 -I/root/dhcp-3.0.6/includes -DLINUX_MAJOR=2 -DLINUX_MINOR=4 -c -o raw.o raw.c In version 3.0.6 you must issue the commands at the top of this page in this order. (3 seperate commands) ./configure Then continue like normal ... Posted by: Ben DeMott at November 20, 2007 11:32 PMi have a Intel P4 Pc with 945/946 intel motherboard and SATA HDD. How I can install RHEL 4 or Fedora core 5. How I can creat VPN, DHCP, DNS server in RHEL4/Fedora core 5. Posted by: titas at December 4, 2007 8:16 AMWhere do i find the DHCp after its installed? Posted by: Student at January 7, 2008 7:50 AMI saw the post above that gets an error after make but can't find the resolution. it worked after i installed the gcc compiler. Posted by: jay at February 6, 2008 5:29 PMThe error output is from make - it means that a compiler - 'cc' - isn't in your path. So installing gcc will fix this. You can check compilation/setup options by entering ./configure --help before actually configuring the package. If you for example want to install it somewhere other than /usr/local you need to set it in the configure line like so ./configure --prefix=/folder/to/install/into
I have a lot to say, but ...
I do have a comment, now that you mention it!
|
Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|