This blog only demonstrates DNCP server installation and other practices, DHCP theory knowledge points are not described here in detail, want to know about Google, this article includes the installation of the configuration of the DHCP server, and set the DHCP reservation address
1. Install the DHCP package
yum list all | grep dhcp # View DHCP Packages       # DHCP: DHCP server-side packages yum -y install dhcp rpm -ql dhcp # See what files are generated     /USR/SBIN/DHCPD  # DHCP Server Programs  /USR/SBIN/DHCRELAY # DHCP Repeater # Generally DHCPD and dhcrelay cannot be used together /var/lib/dhcpd/dhcpd.leases # (lease) is used to record which MAC address the address is assigned to the host /etc/rc.d/init.d/dhcpd #  DHCP Service Scripts /etc/rc.d/init.d/dhcrelay /etc/sysconfig/dhcpd # Service script configuration file /etc/sysconfig/dhcrelay
2. Edit the DHCP configuration file
Description: After the DHCP installation is complete, DHCP provides a template for the configuration file, where only the template path hint information
A simple description of the DHCP configuration file:
Ddns-update-style interim: How Dynamic DNS is updated
Ignore Client-updates: Ignore client update
Subnet 192.168.134.0 netmask 255.255.255.0: Subnet information, define IP address pool, can allocate multiple
Option routers: Default gateway Address
Option Subnet-mask: Subnet mask
Option domain-name: Domain name, search domain
Option Domain-name-servers:dns server address, multiple uses "," separated, up to three for Linux
Range: Specify an address pool assignable address range
Default-lease-time: Default Lease length
Max-lease-time: Maximum lease length
Host: Define a reserved address
cat /etc/dhcpd.conf # View template path information cp /usr/ share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf # Copy Template vim / etc/dhcpd.cof # after editing the content as follows: ddns-update-style interim; ignore client-updates; (instruction type format) Option (Options type format) subnet 192.168.134.0 netmask 255.255.255.0 { # --- default gateway option routers 192.168.134.1; option subnet-mask 255.255.255.0; option nis-domain "domain.org"; option domain-name "tb.com"; option domain-name-servers 192.168.134.2; 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 192.168.134.30 192.168.134.40; default-lease-time 21600; max-lease-time 43200; # we want the nameserver to appear at a fixed address host ns { hardware ethernet 00:0c:20:bb:f2:85; fixed-address 192.168.134.36; } }
3. Enable DHCP service
Service DHCPD Start
4. Test the DHCP server
1. Set the IP address acquisition mode to dynamic acquisition and restart the network service in another virtual machine
2. View the test results in the DHCP server:
Author test results
Client:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/82/22/wKiom1dMPkDCTCyPAACv325Y2IM216.jpg-wh_500x0-wm_3 -wmp_4-s_549049947.jpg "title=" dhcpc.jpg "alt=" Wkiom1dmpkdctcypaacv325y2im216.jpg-wh_50 "/>
DHCP server side: It is important to note that there is no record of the use of the reserved address method to obtain IP address information
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/21/wKioL1dMPt6w72vCAAD_OsLvffU120.jpg-wh_500x0-wm_3 -wmp_4-s_1589195356.jpg "title=" dhcp.jpg "alt=" Wkiol1dmpt6w72vcaad_oslvffu120.jpg-wh_50 "/>
3. If the IP address obtained by the client is not an address in the specified range of DHCP address pool, the reserved address can be used.
Due to the high priority of the reservation address, the client that specifies the MAC address after the general setting can obtain the specified IP.
VIM/ETC/DHCPD.CONF # set reserved address instance: Host NS {hardware Ethernet 00:0c:29:f5:41:03; Fixed-address 192.168.134.37; }
5. View the process of client acquiring IP
Ifconfig eth0 down dhclient-d
Author execution results:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/82/22/wKiom1dMQSiimEWbAAEyFdhY2FA201.jpg-wh_500x0-wm_3 -wmp_4-s_3011353261.jpg "title=" dhclient.jpg "alt=" Wkiom1dmqsiimewbaaeyfdhy2fa201.jpg-wh_50 "/>
The above is a personal summary of the DHCP server knowledge points, the omission also hope to point out
This article from "Not Daze" blog, please make sure to keep this source http://tobeys.blog.51cto.com/10620284/1784612
Summary of DHCP server configuration under Linux