DHCP server configuration and testing

1 the DHCP Server Introduction

DHCP (Dynamic Host Configuration Protocol), dynamic host configuration protocol, DHCP protocol is mainly used to automatically assign network protocol TCP / IP information for the LAN client and complete the TCP / IP protocol configuration of each client. When we LAN client IP address to dynamic acquisition mode, DHCP server will automatically assign IP addresses to clients based on the DHCP protocol, so that the client can use this IP address.

The predecessor of DHCP protocol BOOTP (Bootstrap Protocol), BOOTP is created in the network device to connect to automatically assign an address, it was later replaced by the DHCP, DHCP more complex than BOOTP, and more powerful. All IP network parameters (including IP address, gateway and DNS server address, etc.) by the DHCP server centralized management, and is responsible for handling claims DHCP client; and the client will use the assigned IP network parameters from the server.

In the works of DHCP, DHCP server provides three IP allocation: Automatic allocation (Automatic allocation), manual allocation and dynamic allocation (Dynamic Allocation).

  • Automatically assigned when DHCP client for the first time successfully obtain an IP address from a DHCP server, use this on a permanent IP address.

  • Manually assigned by the DHCP server administrator specially designated IP address

  • Dynamic allocation is the first time when a client from the DHCP server to obtain an IP address , the address is not the permanent use, after each use, DHCP client needs to release the IP, for other clients.
    2 the DHCP server is installed

[root@cloud ~]# rpm -q dhcp
未安装软件包 dhcp 
[root@cloud ~]# yum -y install dhcp*

3 DHCP server configuration file (experimental environment: centos6 client centos7 server)

On centos7

The default location /etc/dhcpd.conf (If you do not need to be copied template configuration file)
[root @ Cloud dhcp] /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example # cp / etc / dhcp / dhcpd.conf
configuration centos7 static IP
configuration DHCP file, writes the following:
configure DHCP file, writes the following:

动态IP实验
subnet 192.168.155.0 netmask 255.255.255.0{
       range 192.168.155.60   192.168.155.240;
       option routers 192.168.155.1;
}
人工固定IP实验
group{
      host centos6{
      hardware ethernet   00:0c:29:306c:aa;
      fixed-address 192.168.155.111;
                    }
       }

Dynamic allocation

On the client (centos6) configuration is as follows:
1 in the virtual editor will uncheck:

2 editor centos6 IP as a way to obtain DHCP, and add the default gateway (Gateway is the DHCP option routers)


3 to restart the client, within the range found in the IP configuration of the

artificial distribution

The content group under uncommented add the following to restart the DHCP server

to restart the client (centos6)

used to explain the configuration file parameters:

dhcp.conf portion 1 includes three parameters (parameters) 2 Statement (delarations) 3 options (option)

Common parameters :

parameter Detailed
ddns-update-style Configuring DHCP-DNS interaction update mode
default-lease-time Specify a default lease time, default is seconds
max-lease-time Specifies the maximum lease time, default in seconds
hardware Specifies the network interface type and Mac address
server-name DHCP client to inform the server name
fixed-address IP Assigned to the client fixed IP address

Common statement :

statement Explanation
subent Describes an IP address belongs to the subnet
range start IP termination IP Specify dynamic IP Dividing Range
host CPU name
group It provides a set of parameters declared

Common options:

选项 详解
netmask 子网掩码
domain-name 为客户端指明DNS名字
domain-name-servers 为客户端指明DNS服务器IP地址
routers 为客户端设定默认网关

Guess you like

Origin www.cnblogs.com/cloudyy/p/12315724.html