Monday, March 12, 2012

Installing and Configuring DHCP server

DHCP is a protocol that can provide the service to assign an ip address automatically. Many articles that explain about the dhcp. Click here to directly drop into landing page.

Now, let's get start.

I impltemented it in CentOS release 5.3 (Final) x86_64 architecture.

Well, install dhcpd first, follow the step below,
yum install -y dhcp
If you successfully install it, now let's configure dhcpd.conf file, follow the configuration below,
nano /etc/dhcpd.conf
and fill the configuration file with the configuration below,
# usual configuration
default-lease-time 86400;
max-lease-time 172800;
authoritative;
ddns-update-style ad-hoc;
log-facility local7;

# option DNS
option domain-name "YourDomainName";
option domain-name-servers aaa.bbb.ccc.ddd, eee.fff.ggg.hhh;

# option ntp-servers WINS
option netbios-name-servers 192.168.1.131;

# INTERNAL SCOOPE

        subnet 192.168.1.128 netmask 255.255.255.128 {
                range 192.168.1.150 192.168.1.250;

        # --- default gateway
                option routers 192.168.1.129;
                option subnet-mask 255.255.255.128;
        }
Example : option domain-name "myDomain.go", option domain-name-server "222.333.233.111, 222.222.333.444".

Then save it by pressing 'CTRL+x' then press 'y' and press 'ENTER' to confirm saving the file. Now, restart your dhcpd server using the command below,
service dhcpd start
That's it.

There's a tip from me, if you want to assign a specific ip address on a host, you can add this configuration at last line of  dhcpd.conf, take a look at the piece of configuration below,

# specific host with specific ip address

host edd {
       hardware ethernet 00:11:22:33:44:55;
       fixed-address 192.168.1.159;
       option host-name "Freddy";
}
note : wondering what is the hardware ethernet? it was your mac address, you can check yours by typing the command "ifconfig" without quote on linux machine or "ipconfig /all" without quote if you are in windowsX machine.

At last, set dhcpd service run on boot, follow the command below, 
echo service dhcpd start >> /etc/rc.local
Well, if you guys have any question, you my add the comments. That's all from me, thanks for visiting, and see you on the next tutorial ^^

Keep Learning ^^

No comments:

Post a Comment