Set up a DHCP server under Linux

  
                              

For a network maintenance person, assigning and managing the IP address of the internal computer of the network is a very cumbersome task. This problem is more prominent when the number of hosts inside the network is large, especially when the number of hosts is greater than the number of available IP addresses. . In order to facilitate the management of future IP address resources, we need to establish a DHCP server to automatically manage the IP address allocation of the computers inside the LAN. The Dynamic Host Configuration Protocol (DHCP) allows network administrators to centrally manage a network system and automatically assign IP addresses to the network. For the common Windows system to configure the DHCP server, there have been quite a lot of introductions in the previous newspapers. This article will focus on how to install and configure a Linux server on a Linux server. For information about DHCP, please refer to its official address is http://www. Isc. Org/index. Pl t/sw/dhcp/. In addition, it should be noted that the system used in this article is the Redhat Linux 9.0 system installed by default.

Installation

The Redhat 9.0 system installed by default has only a DHCP client, no server, and needs to be downloaded and installed.
[root@rh9 test]# rpm -qa grep dhc Displays the name of the software containing the dhc string in the software already installed on the system.
dhcp-3.0pl1-23
dhclient-3.0pl1-23
dhcp-devel-3.0pl1-23
[root@rh9 test]#
Confirm the installation is complete.
If you want to install in the original code, please download the DHCP package
tar vxzf dhcp-3.X.tar.gz
cd dhcp-3.X
./configure
Make
make install
cp ./server/dhcpd.conf /etc
touch /var/state/dhcp/dhcpd.leases
Then edit the configuration file dhcpd.conf to configure
Configuration

1. Main File
The default installed DHCP software does not have the /etc/dhcpd.conf file.
[root@rh9 test]# rpm -ql dhcp
/etc/rc.d/init.d/dhcpd
/etc/rc.d/init.d/dhcrelay
/etc/Sysconfig/dhcpd
/etc/sysconfig/dhcrelay
/usr/bin/omshell
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp -3.0pl1
/usr/share/doc/dhcp-3.0pl1/CHANGES
/usr/share/doc/dhcp-3.0pl1/README
/usr/share/doc/dhcp-3.0pl1/RELNOTES
/usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/Dhcp-eval.5.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr /share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/var/lib/dhcp
/var/lib/dhcp/dhcpd. Leases
Careful readers will find that in the above example the dhcp package gives an example: /usr/
share/doc/dhcp-2.0pl5/dhcpd.conf.sample, this file needs us to manually copy come out. The command is as follows: [root@rh9 test]# cp /usr/share/doc/
dhcp-3.0pl1/dhcpd.conf.sample etc/dhcpd.conf. This way we have the most primitive dhcpd configuration file. Dhcpd saves the customer's lease information in the /var/lib/dhcp/dhcpd.leases file, which is continuously updated, from which the IP address assignment can be found.
2. Starting and stopping the DHCP service
In Redhat 9.0, the command to start/stop the DHCP service is as follows
/etc/rc.d/init.d/dhcpd start

Stop

/etc/rc.d/init.d/dhcpd stop
(Multiple NICs, if you want to start dhcpd on eth1 devices, #/usr/sbin/dhcpd eth1).
Summary
Through the above steps, we have completed the installation of the DHCP server. In the next issue, we will show you how to configure the DHCP server to make it more suitable for the unique needs of different office environments.

Copyright © Windows knowledge All Rights Reserved