Tuesday, July 27, 2010


About DHCP.
DHCP (an acronym for Dynamic Host Configuration PROTOCOL resulting dynamic configuration protocol server) is a protocol which allows individual devices on a network IP address get your own network configuration information (IP address, subnet mask -network, gateway, etc.) from a DHCP server.
Without the help of a server DHCP, would have to manually configure each IP address of each host belonging to a Local Area Network. If a host is moved to another location where there is another Local Area Network, you will need to set up another different IP address in order to join this new Local Area Network. A serverDHCP then oversees and distributes the IP addresses of a Local Area Network assigning an IP address to each host to join Local Area Network. When, for one example, a laptop computer is configured to use DHCP, the latter will be assigned an IP address and other network parameters required to join each Local Area Network where he is located.
There are three allocation methods in the protocol DHCP:
Manual allocation: The allocation uses a table with addresses MAC (short for Media Access Control Address, which translates to address Media Access Control). Only hosts with an address MAC defined in this table will receive the IP assigned in the same table.This is done through the parameters ethernet hardware and fixed-address.
Automatic allocation: An IP address available within a certain range is permanently assigned to the host that requests it.
Dynamic assignment: Determine an arbitrary IP address range and each host connected to the network is configured to request its IP address to the server when you start the network device, using a controllable time interval (parameter default-lease-time andmax -lease-time) so that IP addresses are not permanent and reused dynamically.

Dhcp About Internet Software Consortium, Inc.

Founded in 1994, Internet Software Consortium, Inc., distributes a set of tools for the protocol DHCP, which include:
DHCP Server
DHCP Client
Relay Agent.
These tools use an API (Application ProgramminInterface or Application Programming Interface) module designed to be general enough to be used with ease in operating systems that meet the standard POSIX (Portable Operating System Interface for UNIX or Portable Operating System Interface for Unix) and non-POSIX, and Windows.

Software needed.

Installing via yum.

yum-y install dhcp


Configuration file / etc / dhcpd.conf.

Considering the example you have a local network with the following characteristics:
Number of network
Subnet mask:
Name Server:
Wins Server:
Time servers (NTP): 0.pool.ntp.org, and 2.pool.ntp.org 1.pool.ntp.org
IP address range to be assigned dynamically:
Two IP addresses are assigned as fixed ( and for network cards with addresses MAC (Media AccessControl or Media Access Control) 00:50: BF: 27:1 C: 1C and 00:01:03: DC: 67:23.
NOTE: It is essential to know and fully understand the above to continue with this document.
You can use the following sample content to adapt and create from scratch a new file / etc / dhcpd.conf that matches a set of network and systems in particular.
ddns-domainname "onemax.local"

ddns-update-style interim;  

option domain-name-servers,;

default-lease-time 18 000;  

max-lease-time 25 200;  

option routers;  

option subnet-mask;  

option domain-name "onemax.local"  

option ntp-servers;  

subnet netmask ( range;  )  


option domain-name-servers sends the DNS clients to be used for defects  

default-lease-time 18 000, is the default time that a client can stay with a 

ip address. Client frees this direction and try to buy a new one. 

Time is expressed in seconds. 
max-lease-time 25 200; This is the maximum time 

allowed by the server for the ip is released. It might be that the computer 

not turned on once it reaches the default-lease-time so the server gives another 

period of time before assigning it to another computer 

option routers; This is the default option gw sent to customers. 

option subnet-mask; This option is the default mask 
option ntp-servers; This is the synchronization server option 

the  time or ntp server 

subnet netmask ( 


) With this option, you declare the dhcp server range and network address pool 

ip to surrender. Start, stop and restart the dhcpd service.
To start the service first dhcpd, use:
/ Etc / init.d / dhcpd start
To make the configuration changes made to the service dhcpd take effect, use:
/ Etc / init.d / dhcpd restart
To stop the service dhcpd, use:
/ Etc / init.d / dhcpd stop

Add the dhcpd service to boot.

To make the service dhcpd is active with the next system boot in all run levels (2, 3, 4 and 5), use the following:
/ Sbin / chkconfig dhcpd on

Findings from the DHCP client.

Done above only need to configure as DHCP interfaces workstations that are necessary regardless of operating system used.
After configured and started the service, from a terminal as root on another system to be used as a client, given that you have a network interface called eth0, use the following commands to disable the interface eth0 and assign a new address IP through server dhcp.
/ Sbin / ifdown eth0 / sbin / dhclient eth0
This should return the message "Determining IP information for eth0 ..." and the command prompt. To confirm, use the command ifconfig to display active network devices in the system.

Additional Cases
It might be that at some point need a computer to always keep the same IP address, perhaps because it is running a special application where other clients connect. To do so we need to remove the address in the DHCP serividor. This is done using the MAC address of the computer and adding ADDRESS on our server as follows:
(host m253
 option host-name "m253.codigolibre.local" 

 hardware ethernet 00:50: BF: 27:1 C: 1C; 

 fixed-address; )
Each time the host is connected will get the same direction because by the mac address and the dhcp server address section is exclusively for that host.
Another situation is when you want to filter by MAC address, ie only want my dhcp server filters to a range of known addresses, so any stranger or visitor who arrives at the company may not connect to our network in a manner so easy.

subnet netmask (
deny unknown-clients;
bpena host (hardware ethernet 00:06:4 F: 4E: DA: DB;)
cvasquez host (hardware ethernet 00:19:5 B: FF: 31:04;)
Within the declaration of the pool of ips write the option "deny unknown-clients", this option allows you to send addresses only known hosts. Below are the teams cvasquez bpena and declared in the dhcp, therefore, our server only sent to these two addresses are the only known declared.
Thanks to Joel Barrios Duenas