CentOS 7 to build DHCP

Source: Internet
Author: User
Tags ldap
statement AH: The first post, rookie one, forget Daniel more pointing twos ah.


1.1. Installation article

# mkdir/mnt/cdrom/

# Mount/dev/cdrom/mnt/cdrom

# cd/mnt/cdrom/packages/

# ls dhcp*

dhcp-4.2.5-27.el7.centos.x86_64.rpm

dhcp-common-4.2.5-27.el7.centos.x86_64.rpm

dhcp-libs-4.2.5-27.el7.centos.x86_64.rpm

# rpm-uvhdhcp-4.2.5-27.el7.centos.x86_64.rpm

Preparing ... ################################# [100%]

Updating/installing ...

1:dhcp-12:4.2.5-27.el7.centos ################################# [100%]

Tips: If you are a master or computer can be networked, it is recommended to use Yum installation, especially convenient Ah! # yum-y Install DHCPD
1.2. Configure

# RPM-QC DHCP//query and DHCP-related configuration files

/etc/dhcp/dhcpd.conf

/etc/dhcp/dhcpd6.conf

/etc/openldap/schema/dhcp.schema

/etc/sysconfig/dhcpd

/var/lib/dhcpd/dhcpd.leases

/var/lib/dhcpd/dhcpd6.leases

# cd/etc/dhcp/

# CP dhcpd.conf dhcpd.conf.origin//change before new backup for contingency,

# cat/etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

# See/usr/share/doc/dhcp*/dhcpd.conf.example

# dhcpd.conf (5) man page

#

 

View sample files//We can quickly generate a configuration file based on this example, and it's not easy to make a mistake

# more/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example

According to the example file we can generate a configuration file, you can configure two network segments, a network segment is a subnet


# vi/etc/dhcp/dhcpd.conf

Option Domain-name "Lee.local";

Option Domain-name-servers 192.168.188.11, 192.168.188.12;

Default-lease-time 691200;

Max-lease-time 691200;

Subnet 192.168.188.0 netmask 255.255.255.0 {

Range 192.168.188.100 192.168.188.159;

Range 192.168.188.170 192.168.188.253;

Default-lease-time 259200;

Max-lease-time 259200;

Option routers 192.168.188.2;

}

Subnet 192.168.189.0 netmask 255.255.255.0 {

Range 192.168.189.100 192.168.189.253;

Option routers 192.168.189.2;

}

Host Printer1 {

Hardware Ethernet 00:12:34:56:78:90;

Fixed-address 192.168.188.111;

}

Tips: Default-lease-timetime;

Time should is the length in seconds Thatwill is assigned to a lease if the client requesting the Leasedoes does ask Fora  Specific expiration time.  This is used to both DHCPV4 and dhcpv6leases (it is also known as the "valid lifetime" in DHCPV6). The default is 43200 seconds.

Max-lease-timetime;  Time should is the maximum length in seconds that would beassigned to a lease.  If not Defined,thedefault maximum lease the time is 86400. Theonly exception to this are that Dynamic BOOTP lease Lengths,which are notspecified by the client, are not limited by thi S maximum.


# Systemctl Start dhcpd.service/start service, the same effect as the previous service DHCPD start

Viewing log files

Internet Systems Consortium DHCP Server 4.2.5

Copyright 2004-2013 Internet Systems Consortium.

All rights reserved.

For info, please visit https://www.isc.org/software/dhcp/

Not searching LDAP since Ldap-server, Ldap-port and LDAP-BASE-DN were not specified in the config file

Wrote 0 deleted host Decls to leases file.

Wrote 0 new Dynamic host Decls to leases file.

Wrote 0 leases to leases file.

Listening on LPF/ENO16777728/00:0C:29:A4:2E:39/192.168.188.0/24

Sending on LPF/ENO16777728/00:0C:29:A4:2E:39/192.168.188.0/24

Sending on Socket/fallback/fallback-net


Configure DHCPD to start automatically, this new change on CentOS 7 #systemctl Enable Dhcpd.service//Original is Chkconfig dhcpd on

# systemctlis-enabled DHCPD

Enabled//appears this word, the proof has been set to boot up.


1.3. Test

Testing on a single Windows client




Tips: This DNS is my previous settings, easy access to the Internet.


# tail/var/lib/dhcpd/dhcpd.leases///When the client leases the IP address, it is seen in the log

DHCPInform from 192.168.188.100 via eno16777728:not authoritative for subnet 192.168.188.0

DHCPRequest for 192.168.188.100 from 00:0c:29:b3:a2:60 (TOMSRV1) via eno16777728

DHCPACK on 192.168.188.100 to 00:0c:29:b3:a2:60 (TOMSRV1) via eno16777728

DHCPRequest for 192.168.188.100 from 00:0c:29:b3:a2:60 (TOMSRV1) via eno16777728

DHCPACK on 192.168.188.100 to 00:0c:29:b3:a2:60 (TOMSRV1) via eno16777728

DHCPRequest for 192.168.188.100 from 00:0c:29:b3:a2:60 (TOMSRV1) via eno16777728

DHCPACK on 192.168.188.100 to 00:0c:29:b3:a2:60 (TOMSRV1) via eno16777728


1.4. Summarizing the installation of DHCP is not so complicated, but be aware that if you install it on a virtual machine, remember to stop the virtual machine's DHCP service, or you will see a different result than expected.
DHCP server is a relatively special server, if you do experiments in units, you must be careful Ah, because you start this server, the unit of the interactive machine will be very angry yo.
Well, not long-winded, so much, welcome to leave a message, reprint, together discuss ~_~ ~_~












Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.