HOW TO SET UP DHCP SERVER IN REDHAT LINUX?

HOW TO SET UP DHCP SERVER IN REDHAT LINUX

INTRODUCTION

  • 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.

REQUIRED PACKAGES

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)

SETTING UP

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:

/etc/rc.d/init.d/dhcpd
/ usr / doc / dhcp- 2.0
/usr/doc/dhcp-2.0/CHANGES
/usr/doc/dhcp-2.0/README
/usr/doc/dhcp-2.0/RELNOTES
/usr/doc/dhcp-2.0/dhcpd.conf.sample
/ usr / man / man5 / dhcp-options.5.gz
/usr/man/man5/dhcpd.conf.5.gz
/usr/man/man5/dhcpd.leases.5.gz
/usr/man/man8/dhcpd.8.gz
/usr/man/man8/dhcrelay.8.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

CONFIGURATION

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 192.168.0.0 netmask 255.255.255.0 {

# — default gateway

option routers 192.168.0.1;
option subnet-mask 255.255.255.0;

option nis-domain “” domain.org “”;
option domain-name “” domain.org “”;
option domain-name-servers 192.168.1.1;

option time-offset -5; # 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.0.128 192.168.0.255;

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

we want the nameserver to appear at a fixed address

host ns {

next-server marvin.redhat.com;
hardware ethernet 12: 34: 56: 78: AB: CD;
fixed-address 207.175.42.254;

}

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

# — default gateway
# router IP

option routers 163.26.197.126;

# network mask
option subnet -mask 255.255.255.128;

# Domain
option domain-name “” jmjh.tnc.edu.tw “”;

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

option time-offset -5; # Eastern Standard Time

Dynamic allocation of IP fence

range dynamic-bootp 163.26.167.50 163.26.167.100;

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 {
next-server dns.jmjh.tnc.edu.tw;
hardware ethernet 12: 34: 56: 78: AB: CD;
fixed-address 163.26.167.1;
}
}

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

(a) host ns {
next-server dns.jmjh.tnc.edu.tw;
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:
fixed-address 163.26.167.1;
}

ifconfig got:
eth0 Link encap: Ethernet HWaddr 48: 54: E8: 26: CC: C9
inet addr: 163.26.167.1 Bcast: 163.26.167.127 Mask: 255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1
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.

EXECUTION

/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!

Note:

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.

FOLLOWS

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

changed to:
daemon / usr / sbin / dhcpd eth1

CONCLUSION

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!)

About

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 *