Centos project instance 2-DHCP Configuration

Source: Internet
Author: User
1. DHCP configuration on zzsrv1 1.1. Installation
# 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 -Uvh dhcp-4.2.5-27.el7.centos.x86_64.rpmPreparing...                          ################################# [100%]Updating / installing...   1:dhcp-12:4.2.5-27.el7.centos      ################################# [100%]
1.2. Configuration


# Rpm-qc dhcp/etc/DHCP/DHCPD. conf/etc/DHCP/dhcpd6.conf/etc/OpenLDAP/Schema/DHCP. schema/etc/sysconfig/DHCPD/var/lib/DHCPD. leases/var/lib/DHCPD/dhcpd6.leases # cd/etc/DHCP/# cp DHCPD. conf DHCPD. conf. origin # Cat/etc/DHCP/DHCPD. conf ## DHCP server configuration file. # See/usr/share/doc/DHCP */DHCPD. conf. example # See DHCPD. conf (5) man page # view the sample file # vi/usr/share/doc/dhcp-4.2.5/DHCPD. conf. example

The IP address lease of vlan1 is three days, and the IP address lease of vlan2 is eight days.

[[email protected] dhcp]# echo  3*24*60*60 | bc259200[[email protected] dhcp]# echo  8*24*60*60 | bc691200



Background:

Default-lease-time;

Time shoshould be the length in seconds that will be assigned to a lease if the client requesting the lease does not ask for a specific expiration time. this is used for both dhcpv4 and dhcpv6 leases (it is also known as the "valid lifetime" in dhcpv6 ). the default is 43200 seconds.


Max-lease-time;

Time shocould be the maximum length in seconds that will be assigned to a lease. if not defined, the default maximum lease time is 86400. the only exception to this is that dynamic BOOTP lease lengths, which are not specified by the client, are not limited by this maximum.


# Vi/etc/DHCP/DHCPD. conf

Option domain-name "bigcloud. 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;

}


Start the service

# Service DHCPD start

Redirecting to/bin/systemctl start DHCPD. Service


View logs

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-Net



Configure DHCPD to auto start, which is a new change on centos 7

# chkconfig dhcpd onNote: Forwarding request to ‘systemctl enable dhcpd.service‘.ln -s ‘/usr/lib/systemd/system/dhcpd.service‘ ‘/etc/systemd/system/multi-user.target.wants/dhcpd.service‘# systemctl enable dhcpd# systemctl is-enabled dhcpdenabled


1.3. Test

Test on a Windows Client

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/03/wKiom1QntsnigOgPAAK5kVLLyAs402.jpg "Title =" .png "alt =" wkiom1qntsnigogpaak5kvllyas402.jpg "/>


When the client rents an IP address, it will see 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


# Tail/var/lib/DHCPD. Leases


This article from the "Liu Qiong @ Tiandao reward diligence" blog, please be sure to keep this source http://lqiong.blog.51cto.com/8170814/1559058

Centos project instance 2-DHCP Configuration

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.