Linux in General > Linux Tutorials & How To's

DHCP SERVER How to..(dhcpd)

(1/2) > >>

Ricky:
This How to is aimed to set the dhcpd server provided by isc.You can download the latest at ftp://ftp.isc.org/isc/dhcp/dhcp-latest.tar.gz

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 255.255.255.0;


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

 # Give your router address here..
option routers 192.168.1.1;


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

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

 
 # 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 192.168.1.2. Similarly add other subnet for other  of ip range.
subnet 192.168.1.0 mask 255.255.255.0 {
                       192.168.1.10 192.168.1.90;
                        192.168.1.100 192.168.1.200;
   
                     }
 
 #  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;
                           fixed-address 192.168.1.15;
                       }


--- 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
Thankyou!

tomamodi:
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

Ricky:
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.

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

Ricky:
Ya there was semicolon missing .. now corrected!!

Navigation

[0] Message Index

[#] Next page

Go to full version