Friday, November 6, 2009

Setting up a DHCP server

assuming the Network you want to add a DHCP server to is the

192.168.1.0/24 network

your router IP Address is 192.168.1.1

Your ISP's DNS servers IP Address is 194.158.2.2

the leases that you want to give out are 192.168.1.128 to 192.168.1.254

first install the DHCP server software.

yum install dhcp.i386

once installed

edit /etc/dhcpd.conf (if it doesn't exist create it)

vi /etc/dhcpd.conf

add in the following lines

ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.128 192.168.1.254;

default-lease-time 21600;
max-lease-time 43200;
option routers 192.168.1.1;
option ip-forwarding off;
option domain-name-servers 194.158.2.2;
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;

save the file :wq

next, configure the dhcpd service to start at start up

chkconfig dhcpd on

to make sure it is running either reboot or type
/etc/init.d/dhcpd start

that's it , your done. Your DHCP server will give out IP addresses to any clients that connect to your network.
there are many other options that you can add to your DHCP server, like reserving an IP address for a specific mac-address etc

to see all of these option just check out the man pages of dhcpd
type
man dhcpd

1 comment:

liam said...

COOL BUT VERY CONFUSING