Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to setup a dhcp server

first things first, make sure you have your dhcp software installed


to check it quickly do this


rpm -qa dhcp*


If it doesnt display anything you can download the RPMs and install them manually, or click on the redhat/system settings/add remove applications/Servers/Network Servers and put a check mark beside DHCP server.


ok once it is installed now you have to configure it, this is done by manually editing a file called /etc/dhcpd.conf


if the file does not yet exist don't worry, there is a sample stored on your distro,


to find it do this


updatedb && locate dhcpd.conf


it will probably be somewhere like this




Copy this file to /etc as follows


cp /usr/share/doc/dhcp-3.0.1rc12/dhcpd.conf.sample


Now edit the file and change the ip subnet/netmask settings to your liking and save the file.


To start the dhcp server you'll need a leases file created otherwise it will fail to start (first time start). Do as follows to create the file


touch /var/lib/dhcp/dhcpd.leases


Now we want it to start at boottime, so lets tell chkconfig to start it at boot by doing


chkconfig --level 35 dhcpd on


That's it, now we want to start the server, to do so try this


/etc/init.d/dhcpd start


ok, connect a client to the server with dhcp enabled and see do they get an ip !


If you want to share the internet via this DHCP server then try the following


iptables -t nat -F POSTROUTING

iptables -t nat -A POSTROUTING -s -j MASQUERADE


The first line CLEARS your current IPTABLEs rules so don't do it unless you really intend to do it. The second line shares out as long as the client points their gateway to


here is a sample dhcpd.conf file



ddns-update-style interim;
ignore client-updates;
filename "pxelinux.0";

subnet netmask

   # --- default gateway
   option routers;
   option subnet-mask;

   option nis-domain  "";
   option domain-name  "";
   option domain-name-servers;

   option time-offset  -18000; # Eastern Standard Time
   #   option ntp-servers;
   #   option netbios-name-servers;
   # --- Selects point-to-point node (default is hybrid). Don't change this unless
   # -- you understand Netbios very well
   #   option netbios-node-type 2;

   range dynamic-bootp;
   default-lease-time 21600;
   max-lease-time 43200;

   # we want the nameserver to appear at a fixed address
   host ns
       hardware ethernet 12:34:56:78:AB:CD;






Do you need to install this in order to run a webhosting service?


Quote:service dhcpd start
instead of:
Quote:/etc/init.d/dhcpd start

does the same, but using 'service' is nicer :P


i want to setup dhcpv6 server on linux box(RHEL6), which can provide ipv6 addresses when connect to a router.

Can somebody let me know how can a setup this?


Hi masterblaster,


You need to install the dhcp package:


# yum install dhcp


You now need to edit /etc/dhcp/dhcp6.conf and set up your DHCPv6 scope for the subnet you want to offer IPv6 addresses to (take a look at /usr/share/doc/dhcp*/dhcpd6.conf.sample).


Finally, once you have finished editing the config file for the DHCPv6 server, launch it:


# service dhcpd6 start


and perhaps also set it to run at start up:


# chkconfig dhcpd6 on


Just to thread-hijack.... do you know anything about dynamic DNS? I can set up DNS and DHCP individually, but there's something new in DHCPd that seems to prod a host+IP dynamically into the DNS zone (without it inserting a new entry into the DNS file and reloading the configuration), the idea being that you just let DHCP allocate an address and DNS picks it up - handy for static leases or address reservations.


I've seen settings displayed in Webmin, but the webmin guides are very scant on details, and I haven't found a HowTo that properly explains how it all works. I've tried setting up a few from Webmin then looking at the zone files it creates, but I'm still none the wiser. I'd like to properly get this working if possible.


In short, no. :(


I've played with this The Microsoft Way, with Active Directory, MS's DNS Server and MS's DHCP Server, where it is all automatic, but not with BIND and dhcpd. To be honest, I haven't yet had a huge need to, and as you've discovered, it doesn't seem that anyone has sat down and produced a decent guide. Have you seen this guide? Again, I'm afraid I haven't looked into this in detail, so I don't know how good that is.


Quote:Have you seen this guide? Again, I'm afraid I haven't looked into this in detail, so I don't know how good that is.
mmm.. actually, that guide isn't too bad. Other guides I've seen have been outdated (and talk about perl scripts to modify zone files) but that one could be the ticket, ta. Most of it seems like the standard DNS/DHCP stuff I know, but it's the additional directives that are useful.


Ta, lad - that could save me bacon!


Forum Jump:

Users browsing this thread: 1 Guest(s)