Linux in General > Linux Tutorials & How To's

DHCP SERVER How to..(dhcpd)

(1/2) > >>

This How to is aimed to set the dhcpd server provided by isc.You can download the latest at

Intro: By using dhcpd u can assign ip address and other network information to ur clients. It is very useful in large neetworks.

Configuration. dhcpd server uses the /etc/dhcpd.conf file for its configuration. it is located in /etc/ directory.
/etc/dhcpd.conf file...

--- Code: ---

ddns-update-style ad-hoc;

 # Time used to set min. lease time ie. how long the assigned address is valid.
default-lease-time 800;
 # Maximum liease time allowed.
max-lease-time 7200;

 # Use this to set global subnet mask for your network
option subnet-mask;

 # Set the broadcast address used by clients. (usally its the last ip of the network ip range)
option broadcast-address;

 # Give your router address here..
option routers;

   #Set domain name servers for your network ie. give ip of the DNS server on your LAN
option domain-name-servers,;

  # Give domain name you want to get assigned to your network
option domain-name "";

 # Here set a range of ip used by ethernet of IP 192.168.1.x . ie. say your  
 # eth0 want to serve the network and has ip of Similarly add other subnet for other  of ip range.
subnet mask {
 #  Here use this to assign fixed ip to a client on your network with its hardware address provided.
host host_name {
                           hardware ethernet 00:c1:26:08:65:44;

--- End code ---

Before running dhcpd make sure /var/state/dhcp/dhcpd.leases file exist. if not then run the following command.

--- Code: ---touch /var/state/dhcp/dhcpd.leases
--- End code ---

Now start dhcpd by giving the follwoing command

--- Code: ---/usr/sbin/dhcpd
--- End code ---

Or by

--- Code: ---/etc/rc.d/init.d/dhcpd start

--- End code ---

Lastly :
Please correct me if you find any mistake or errors

little more explanation
did this work with only one lan card  eth0
or need two
and did this need some of this in squid.conf from dhcpd
before there is rc.nat as you show for sharing lan

This is nothing related to squid.conf

It is purely a dhcp server configuration using dhcpd in linux . It is used mostly in large network.. ie where there are many nodes .. I prefer to use dhcpd in more than 5 computer LAN.

So what you do is specify all your servers in dhcpd.conf file and then your clients get all information usind dhcp to configure themselves.

You here tell that which is your gateway , also specify what is your DNS servers, domain name and much more.

You can run NAT script with this also on static IP address LAN ie.  usually small LAN.

Hope you are cleared.

this is the reply
/etc/dhcpd.conf line 29: semicolon expected.
Configuration file errors encountered -- exiting

Ya there was semicolon missing .. now corrected!!


[0] Message Index

[#] Next page

Go to full version