Dhcp
DHCP Dynamic Host Management protocol based on UDP Protocol and limited to network protocol for LAN
Purpose: Automatic distribution for internal network devices or Internet providers IP Address
Typically applied in a large LAN environment
Benefits: Centralized Management IP addresses to reduce management and maintenance costs and increase efficiency
Common terminology for DHCP service programs:
scope: A complete IP address segment,DHCP manages assigning IP addresses according to scope
superscope: Used to support multiple logic on the same physical network IP Address subnet segment, containing a list of scopes, including management of child scopes
Exclusion Range: set some IP addresses are excluded from the scope and are not obtained by the DHCP client
address pool: Defines a DHCP scope and applies an excluded address to be assigned to the DHCP client
Lease:DHCP client gets IP address usage time
Appointment: Ensure that specific devices in the subnet are always getting the same IP Address
Install the DHCPD service program:
[[email protected] ~]# yum-y Install DHCP
DHCPD Service Program and configuration file :
Master configuration file |
/etc/dhcp/dhcpd.conf |
Execute the program |
/usr/sbin/dhcpd /usr/sbin/dhcrelay |
a standard DHCP configuration file should include global configuration parameters, subnet segment declarations, address configuration options, address configuration parameters
Global configuration parameters are used to define global parameters for the entire configuration file, while the subnet segment declaration is used to configure the address properties of the entire subnet segment
Parameters |
Role |
Ddns-update-style Type |
Defines the type of dynamic update for the DNS service, including: None(dynamic update not supported),intermi(interactive update mode),Ad-hoc(Special update mode) |
Allow/ignore client-updates |
Allow / Ignore client update DNS records |
Default-lease-time 21600 |
Default Time-out |
Max-lease-time 43200 |
Maximum timeout time |
Option Domain-name-server Ip-addres |
Define DHS server addresses |
option Domain-name " name " |
Define DHS domain names |
Range |
Define an address pool for assigning IP |
Option Subnet-mask |
Defining subnet masks for clients |
Option routers |
Define the gateway for the client |
Broadcase-address Broadcast Address |
Define the broadcast address of the client |
Ntp-servers IP Address |
Define the client's network time server (NTP) |
Nis-servers IP Address |
Define the address of the NIS domain server |
Hardware hardware type MAC is in a hurry! |
Specify the type of NIC interface and mac address |
Server-name Host name |
Notifies the DHCP client server of the host name |
Fixed-address IP Address |
Assigning a fixed IP address to a specified host |
Time-offset Offset Difference |
Specify the offset difference between the client and Greenwich |
Simulation Experiment :
tomorrow, there are about six external colleges bring their own notebooks to our training, please ensure that students can correctly obtain IP address and normal Internet access
The computer room network segment parameters are as follows:
Parameter name |
Value |
Default Lease Time |
21600 |
Maximum lease time |
43200 |
IP address range |
192.168.200.20-192.168.200.100 |
Subnet mask |
255.255.255.0 |
Gateway |
192.168.200.1 |
DNS Server Address |
192.168.200.103 |
Search domain |
Linuxs.com |
To configure a DHCP configuration file:
[Email protected] ~]# vim/etc/dhcp/Dhcpd.confddns-update-style none; #设置dhcp服务不自动动态更新Ignore client-updates; #忽略客户机更新dns记录Subnet192.168.200.0Netmask255.255.255.0{#作用域为 192.168.200.0/ 24 Network segment range192.168.200.20 192.168.200.100;#地址池: 20-100option Subnet-mask255.255.255.0;#子网掩码:option Routers192.168.200.1;#网关: 192.168.200.1option Domain-name"linuxs.com"; #默认搜索域option domain-name-servers192.168.200.103; #dns地址default-lease-time21600; #默认租约Max-lease-time43200; #最大租约Host Print {hardware Ethernetxx: 0C: in: FC:FF:B8; #绑定MAC地址
fixed-address192.168.200.88; #静态IP地址}}
Restart DHCPD service Verification :
[Email protected] ~~'/usr/lib/systemd/system/dhcpd.service' ' /etc/systemd/system/multi-user.target.wants/dhcpd.service '
linux[Base]-34-[DHCP Server]-[Dynamic Host Management Protocol]-[01]