RHEL7 Building DHCP

Source: Internet
Author: User

This experiment uses VMWARE12 environment, the network card is-custom VMnet3

Network environment:

One server (DHCP), two clients, one of which is used as a printer, fixed IP (based on MAC address)

Requirements Description:

The host name of the 1:DHCP server is dhcpsvr.mvp.com IP address: 172.35.35.1/24

2: Automatically assign IP to each host in the network, address range 172.35.35.20-172.35.35.240

3: The default gateway address for each host in LAN is 172.35.35.254

4: The DNS server address used by the LAN is the host name of the 172.35.35.5 and 172.35.35.6,dns servers, respectively, ns1.mvp.com ns2.mvp.com

5: Network printer device, host name print01, requires automatic assignment of fixed IP 172.35.35.10

01. Setting Up DHCP network card information

cd/etc/sysconfig/network-scripts/

Configure default NIC Information

02. Modify the network hostname/etc/sysconfig/network

03, modify the Machine hosts/etc/hosts

04. Restart the Network

Systemctl Restart Network

Install DHCP

Yum install-y DHCP

Refer to DHCP

Find/usr/share/doc-name *dhcpd.conf*

Vim/etc/dhcpd/dhcpd.conf

Authoritative;ddns-update-style interim;subnet172.35.35.0Netmask255.255.255.0{Range172.35.35.20 172.35.35.240; Option Domain-name-servers ns1.mvp.com,ns2.mvp.com; Option Domain-name"dhcpsvr.mvp.com"; Option Routers172.35.35.254;
Default-lease-time 86400; #1day
Max-lease-time 604800; #7day}host print01 {hardware Ethernetxx: -: About: 2D: on: -; fixed-address172.35.35.10;}

05. Setting Up DHCP service

Systemctl Enable DHCPD = = Chkconfig dhcpd on

Systemctl start DHCPD

Log query

Systemctl Status Dhcpd-l

/var/log/messages

The DHCP client information is logged in the/var/lib/dhcpd/dhcpd.leases

06. Test Results

Printer (XP)

Client

Configuration parameter meaning

Modify configuration File/etc/dhcp/dhcpd.conf
As follows:

Supported DHCP dynamic update modes (non: not supported;interim: Interactive update mode ; AD-HOC: Special update mode)
Ddns-update-style Interim;
#ignore client-updates;

#subnet < sub-network number > Netmask < subnet mask;:
Subnet 192.168.1.0 netmask 255.255.255.0 {
#指定地址池, the IP addresses within the 192.168.1.20~192.168.1.254 range are dynamically assigned to the client
range 192.168.1.20 192.168.1.254;

Option routers 192.168.1.1; #客户端默认网关为192.168.1.1
Option Subnet-mask 255.255.255.0; #指定客户端子网掩码

Option Domain-name "example.com"; #指定DNS后缀
Option Domain-name-servers *.*.*.*; #DNS服务器地址
Option broadcast-address 192.168.1.255; #指定广播地址

Default-lease-time 86400; #指定默认租约时间, Unit is seconds default 1 days
Max-lease-time 172800; #指定最长租赁时间, Unit is seconds

#为网络适配器的物理地址为00:0C:29:23:F5:A2 host retains the specified IP address
Host PC1 {
Hardware Ethernet 00:0c:29:d4:e7:58;
Fixed-address 192.168.1.50;
}
}

Set the default NIC IP to the same network segment
Modified:/etc/sysconfig/network-scripts/ifcfg-eth0 "file as follows:
Device= "Eth0"
Nm_controlled= "Yes"
Onboot=yes
Type=ethernet
bootproto= "Static"
ipaddr=192.168.1.1
Prefix=24
gateway=x.x.x.x

dns1=x.x.x.x
Defroute=yes
Ipv4_failure_fatal=yes
Ipv6init=no
Name= "System eth0"

Set parameters:
Default-lease-time Time: Lease time&NBSP;
Max-lease-time time: Longest lease time Option domain-name "domain name": Set the domain name   for DHCP client resolve.conf internal parsing;
Option Domain-name-servers IP1, IP2: Set Ip  for DHCP client Resolve.confneo;
 option Routers: Set Routing information &NBSP;
  Declare IP address pool and related configuration: &NBSP;
Subnet network_ip netmask netmask_ip { 
Range IP1 IP2; set IP range &NBSP;
Host hostname {//static IP settings &NBSP;
hardware Ethernert hardware address; &NBSP;
Fixed-address ip;&NBSP;
};&NBSP;
}

Summary: In fact, many examples of dhcpd.conf.example, it is worth learning more!

Reference article:

Http://www.linuxidc.com/Linux/2013-06/86531.htm

Http://www.linuxidc.com/Linux/2012-08/68884.htm

Http://www.linuxidc.com/Linux/2013-04/82244.htm

RHEL7 Building DHCP

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.