DHCP howto's

Share your expert knowledge and show off your skills.
Post Reply
CyberBob
Cadet
Posts: 8
Joined: Wed Mar 12, 2008 11:44 am
Location: End of Road. . . .
Contact:

DHCP howto's

Post by CyberBob »

First of all thx to all LP members who made this website a platform to learn and discuss ideas in a better way. Usually all the system admins like to get rid of long documentation to perform a task. As long and unnecessary documentation really sucks. So i decided to put some howto's for configuring different servers. DHCP is the first that belongs to that series of howto's. I hope you would like this. . .Please contact me cyberbob.thedarklord@gmail.com so that i can improve this document.



Package name: dhcpd
Service name: dhcpd

path: /etc/dhcpd.conf
Log file: /var/log/messages

when dhcp is installed there is no config file present in etc,we have to copy
the config file from /usr/share/doc/dhcp.x.x.x/dhcpd.conf.sample to /etc/dhcpd.conf

This file is by default designed for subnet 192.168.0.0 with netmask 255.255.255.0
now change this file to your desired subnet like in my case 192.168.3.0

The next line router means our gateway, like in my case 192.168.3.1

We are not using nis domain so just comment that,as nis is used when you use network
information services as centerlized authentication method.


option domain is different from the nis domain and it is the dns domain name in my
case it is cyberdyne.net.

In the next line we will tell the client about the DNS server in my case it is
192.168.3.1

just comment ntp-servers and netbois servers.


range dynamic-bootp is the range of ip's you can set it by your desire.like

range dynamic-bootp 192.168.3.1 192.168.3.10;

default-lease-time 21600; #it is the time after which a client will go to server for the renewel of IP address.It is in seconds.

max-lease-time 43200; #It is the time after which a server will automatically change the ip address of the client.It is in seconds.


If you want to give static ip to a client than use the host ns line like this

#host ns(name of the client )

host dumb{

comment the next-server line like this:
# next-server marvin.redhat.com;


hardware ethernet #it is the MAC of the client to which static ip is given

hardware ethernet 00:02:55:50:5A:BA;

fixed-address give desired static ip like this:

fixed-address 192.168.3.12;

#######Configuring a Client to Use Your DHCP server.

To configure a linux client edit this file

/etc/sysconfig/network-scripts/ifcfg-eth0

for DHCP only three lines are enough like

DEVICE=eth0
BOOTPROTO=DHCP
ONBOOT=YES

While in case of static ip it shoud be like this

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.3.23
NETMASK=255.255.255.0
ONBOOT=YES

To configure a microshit client(ooh i was supposed to say micrsoft windows client) just go to

Control panel--->>Network Connections-->>Right click the desired connection
and than click properties,select Internet Protocol(TCP/IP) and click properties
button,now select Obtain IP address automatically and select obtain DNS server
address automatically.

now, restart the dhcpd service
Done.


A sample dhcpd.conf file


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

subnet 192.168.3.0 netmask 255.255.255.0 {

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

# option nis-domain "domain.org";
option domain-name "cyberdyne.net";
option domain-name-servers 192.168.3.1;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- 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 192.168.3.1 192.168.3.10;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host dumb{
# next-server marvin.redhat.com;
hardware ethernet 00:02:55:50:5A:BA;
fixed-address 192.168.3.12;
}
}
Last edited by CyberBob on Fri Apr 17, 2009 9:47 pm, edited 1 time in total.
Muhammad Saad
Battalion Havaldaar Major
Posts: 273
Joined: Sat Jan 27, 2007 11:07 pm
Location: Dera Ismail Khan, Pakistan
Contact:

Post by Muhammad Saad »

You should not post useful information in "Gup Shup" section since it is automatically deleted after a few days.
This will be a more appropriate place:
http://www.linuxpakistan.net/forum2x/viewforum.php?f=30
x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Post by x2oxen »

Yup. You should use how to page!
Muhammad Usman
+92-321-6640501
Chemonics International
http://usmanpk.com
CyberBob
Cadet
Posts: 8
Joined: Wed Mar 12, 2008 11:44 am
Location: End of Road. . . .
Contact:

Thx. .

Post by CyberBob »

Any how posted those howto's to Howto's & Tip n' Tricks section :)
Post Reply