|
|
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!
More Useful Unix and Linux Help Articles:
✔ Copy and Paste from the Mac OS X Command Line?
I am constantly running commands in Terminal.app on my MacBook and then copying and pasting the results into email messages or documents. Yes,...
✔ Shell script to convert lowercase to title case?As part of a project I'm working on, I find myself deep in a Linux shell script, needing to have a subroutine that...
✔ Can I script renaming files based on an XML data map?I have a folder full of files which are named with four digits and a file extension e.g. 0312.file and an XML-file describing...
✔ Test for valid numbers in a Bash shell script?In a different discussion on this site [see Redirecting input in a shell script] a visitor commented that "I was too busy trying...
✔ Review: iSSH for the iPad/iPhoneIf you're running an online business like I am, there are times when you need to connect and log in to the server...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help
right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
Categorized:
Unix and Linux Help
(Article 4170,
Written by Dave Taylor)
Tagged: Previous: Why Does My Mac Always Try to Boot Off the Wrong Disk? Next: How do I build a cool LinkedIn Signature Box? Reader Comments To Date: 25jagannath ojha said, on February 28, 2006 3:32 AM:
I want to know whether dhcp works across VLAN. Dave Taylor said, on February 28, 2006 9:03 AM:
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. Steve Worrall said, on May 31, 2006 4:05 PM:
You 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). Ganesh rout said, on May 7, 2007 3:23 AM:
For different vlans how can i set up my dhcp server so that my client in diff.vlans get ip from dhcp server. suneel said, on July 2, 2007 6:49 AM:
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. osahon said, on November 20, 2007 10:17 AM:
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 Ben DeMott said, on November 20, 2007 11:32 PM:
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 ... titas said, on December 4, 2007 8:16 AM:
i 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. Student said, on January 7, 2008 7:50 AM:
Where do i find the DHCp after its installed? jay said, on February 5, 2008 7:30 PM:
I saw the post above that gets an error after make but can't find the resolution. jay said, on February 6, 2008 5:29 PM:
it worked after i installed the gcc compiler. Daniel said, on April 8, 2008 1:26 PM:
a litle tutorial to how to configure DHCP dhcp John O'Driscoll said, on May 2, 2008 5:58 PM:
The 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
roshan said, on May 13, 2008 11:43 AM:
Hi Dev, How can i configure a DHCPD IN FEDORA 5 AND THE FTP SERVICE.. Regards, roshan said, on May 13, 2008 11:49 AM:
Dear Dev, How to configure vsftpd in fedora 5 Regards, noname said, on June 1, 2008 5:12 PM:
supposed help to others when it is INCOMPLETE is really frustrating. How the hell does one find where the output to the tar command went? Without knowing this, installing dhcp server is IMPOSSIBLE. from a frusterated biginner. Dave Taylor said, on July 15, 2008 11:52 AM:
noname, tar archives unpack in the current directory, either spewing their files everywhere in the current directory or, ideally, creating a subdirectory of their own with all the files therein. In this case, look for a new subdirectory called "dhcp-303" or similar. Colin said, on November 1, 2008 12:03 PM:
This is pretty helpful. I've configured my DHCP, but I have a (maybe stupid) question... I'm using a Linksys WRT54G router as my switch. What physical connection do I have to make between the DHCP and the switch in order to get my server functioning? Do I just attach it to the stanard ports? kirtan said, on November 21, 2008 2:04 AM:
Please post me vijay said, on December 16, 2008 7:15 AM:
how can i install fedora 9 server on sunfire x4200,x2200 amd server with firewall,squid proxy,email server unknown said, on April 21, 2009 8:37 AM:
I am unable to get dhcp to start on Fedora 8, I have the config file for dhcp, but it does not show up on the enable list for the firewall, would that be the reason that it will not start through the terminal? sahil raza said, on January 4, 2010 5:45 AM:
i check this tips but its all not working on my linu red hat fedora core 7 thanx hafeez said, on March 18, 2010 1:19 AM:
A working configuration example Server ip : 172.27.0.10 Please note default vlan 172.27.0.x in this case Switch and server need to be in default lan for communication / or else we need to trunk in case other vlan connected , we need to configure vconfig on server to communicate
ddns-update-style interim;
option subnet-mask 255.255.255.0;
Chkconfig –list dhcpd on /var/log/messages Check for the ip helper address in layer 3 swtich , which act as dhcp-relay
1) Run the Dhcp service in debug mode dhcpd in the foreground in debug mode with /usr/sbin/dhcpd -d –f Hopefully, a DHCP server like the one we’ll be configuring will respond. Running tcpdump shows a dhcp request looks like: Congratulations you have finally configured In easy steps KS Arulmozhi said, on August 17, 2011 10:36 AM:
how to install dhcp in fedora 13. error in this step : sudo touch /var/lib/dhcp/dhcp.leases i got error please help how to solve this problem touch: cannot touch `/var/lib/dhcp/dhcp.leases': No such file or directory thank u..........
I do have a comment, now that you mention it!Check This Out Too... |
Recent Entries
Look for Answers
Recommended
All Our Categories
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and Blogging Building Web Site Traffic Business and Management Computer and Internet Basics d) None of the Above Facebook Help Google Gmail Help Google Plus Help HTML, JavaScript and Web Site Programming Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Kindle Fire Help Mac OS X Help Pay Per Click (PPC) Advertising Pinterest Help Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help Find Me on Google+ ADT on G+ |
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