• DHCP is the abbreviation of Dynamic Host Configuration Protocol, mainly used to simplify network management in: The problem of “troublesome” in the configuration of workstation / host network configuration, commonly known as: “” dynamic allocation of IP “”.
  • Compared with the dynamic allocation mechanism, it uses manual and manual methods to set by one, which is called static setting.
  • The Static setting is quite inefficient.

Imagine: If there are hundreds of workstations in a network segment, manually set it manually, it is not strange to be tired, and, in the future, if you want to change the network configuration is also extremely inconvenient!

  • Therefore, in the Network Security Training your work on network management, DHCP Server is a very important installation service. In the past, most of the school ’s DHCP Server was installed on NT / W2K, but the performance and the stability are not very good,

therefore, the following introduces the installation of the DHCP Server on RedHat Linux.


dhcp-2.0-5.i386.rpm (RedHat 6.2)
dhcp-2.0-12.i186.rpm (RedHat 7.0)
dhcp-2.0-12.i386.rpm (CLE 1.0)
dhcp-2.0p15-4.i386.rpm ( RedHat 7.1)


Please choose the DHCP Server package according to your Linux version.

1) Installation:

(a) rpm -ivh dhcp-2.0-5.i386. After rpm

(b), check, what files does this package place on the host?

rpm -ql dhcp | more

will get the following list:

/ usr / doc / dhcp- 2.0
/ usr / man / man5 / dhcp-options.5.gz
/ usr / sbin / dhcpd
/ usr / sbin / dhcrelay
/ var / state / dhcp

One is, /etc/rc.d/init.d/dhcpd, which can be used to control the behavior of the dhcp server, such as:

start: /etc/rc.d/init.d/dhcpd start
stop: / etc / rc .d / init.d / dhcpd stop
restart: /etc/rc.d/init.d/dhcpd restart
Observe the operation status: /etc/rc.d/init.d/dhcpd

status The other is, / usr / doc /dhcp-2.0/dhcpd.conf.sample

(RedHat 7.0 in /usr/share/doc/dhcp-2.0)
As the name implies, this is a configuration file of the dhcp server, we will copy it to / etc , and named dhcpd.conf.

(C) cp /usr/doc/dhcp-2.0/dhcpd.conf.sample /etc/dhcpd.conf


Then, you can start the configuration file for dhcp server / etc / dhcpd.conf to do the setting work. The

following is the original content of the file:

subnet netmask {

# — default gateway

option routers;
option subnet-mask;

option nis-domain “” “”;
option domain-name “” “”;
option domain-name-servers;

option time-offset -5; # Eastern Standard Time

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

# — 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;

default-lease- time 21600;
max-lease-time 43200;

we want the nameserver to appear at a fixed address

host ns {

hardware ethernet 12: 34: 56: 78: AB: CD;


Junior High School as an example, the school is the first half of 1/2 C) subnet netmask {

# — default gateway
# router IP

option routers;

# network mask
option subnet -mask;

# Domain
option domain-name “” “”;

# Specify which DNS servers to dispatch to provide services?
option domain-name-servers, ,;

option time-offset -5; # Eastern Standard Time

Dynamic allocation of IP fence

range dynamic-bootp;

JIP lease time

default-lease-time 21600;
max-lease-time 43200;

Set your school’s DNS host to a fixed IP

# we want the nameserver to appear at a fixed address

host ns {
hardware ethernet 12: 34: 56: 78: AB: CD;

In the above settings, please follow Your school configuration, modify it by yourself. It should be noted that:

(a) host ns {
hardware ethernet 12: 34: 56: 78: AB: CD; — > This is the number of the DNS host network card (6 bytes), please use ifconfig to query, as follows:

ifconfig got:
eth0 Link encap: Ethernet HWaddr 48: 54: E8: 26: CC: C9
inet addr: Bcast: Mask:
RX packets: 762193 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 555401 errors: 0 dropped : 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 100
Interrupt: 11 Base address: 0x8000

take HWaddr 48: 54: E8: 26: CC: C9 48: 54: E8: 26: CC: C9
fill in the above the hardware ethernet setting is sufficient.

your school’s network card number (each card is unique globally) must not be the same as this one, please do not copy the settings here!

(b) This DHCP server can Co-exist with the original DHCP server on NT / W2K, but please note that the IP allocation segment should be staggered.

So, at the end, which DHCP server the workstation will get dynamic allocation?

Very simple, when the workstation sends a request (request ) Message, whoever grabs it first will provide it first.


/etc/rc.d/init.d/dhcpd start
will not succeed the first time,
If it is the dhcp-2.0-5 version, it will show a failed red string and warn you:
/var/state/dhcp/dhcpd.leases This file does not exist, so you must manually open a new file:
touch / var /state/dhcp/dhcpd.leases

These purpose archives are IP recording situation lease of each workstation.
if the DHCP-2.0-12 later version, it will not appear any message, you will find that it is not up and running.
this is Because: Once this version finds that you have not opened this file, it will jump out without running.

And the location of this file is slightly different:
it is located in /var/lib/dhcp/dhcpd.leases
OK, open it manually ?!
touch /var/lib/dhcp/dhcpd.leases

can now be started, and set it to run automatically upon booting (either linuxconf or ntsysv can be set)

/etc/rc.d/init.d/dhcpd start
Congratulations! Your school already has a very stable DHCP server!


If you have a Linux firewall, you want to allocate the DHCP server from a certain network card (one network card represents a network segment),

for example: Zhang network card interface eth1 dispensed, as long as the modifications to /etc/rc.d/init.d/dhcpd.


the start daemons place
by the:
daemon / usr / sbin / dhcpd

changed to:
daemon / usr / sbin / dhcpd eth1


DHCP Server is a very important weapon in network management work. It is also wise to set up more than two backups.

And, from then on, you can no longer rely on NT / W2K this poor and unstable performance (PE ratio is too low) of the system.

(not necessarily limited to a particular one closed the company, but does not have to cost a lot, is the primary and secondary schools network Build, the best PE ratio choice!)


Codec Networks provides IT Trainings from EC Council CEH ECSA, LPT, CHFI, Network Security, Penetration Testing, ISACA, ISC2, PECB ISO 27001LA LI, Cisco Networking CCNA CCNP, Linux Administration RHCE, Prog Languages JAVA, Advanced Java, android development. We also offer B2B Industry Solutions and Services in IT | Information|Cyber Security in Delhi NCR India.

View all posts by

Leave a Reply

Your email address will not be published. Required fields are marked *