当前位置:网站首页>DHCP review
DHCP review
2022-06-25 23:59:00 【XUPT-BDAL-LAB-ML&OP】
(centos7)
brief introduction
Dynamic Host Configuration Protocol (DHCP) It's a kind of be based on UDP agreement And only in LAN Network protocol used internally , It is mainly used in large LAN environment or LAN environment with many mobile office devices , The purpose is to automatically allocate data for equipment or network suppliers within the LAN IP Address and other parameters , Provides information about network configuration “ Family bucket ” service .
dhcpd yes Linux Used in the system to provide DHCP The service procedure of . The package name is dhcp-server
DHCP Common terms involved
- Scope : A complete IP Address segment ,DHCP Manage the distribution of the network according to the scope 、IP Address assignment and other configuration parameters .
- Superscope : Used to manage multiple logical subnet segments in the same physical network , It contains a list of scopes that can be managed uniformly .
- Exclusion range : Put some... In scope IP Address exclusion , Make sure these IP The address will not be assigned to DHCP client .
- Address pool : Is defined. DHCP After the exclusion scope is applied , The rest is used to dynamically allocate to the client IP Address range .
- lease :DHCP The client can use dynamically allocated IP Time of address .
- make an appointment : Ensure that specific devices in the network always get the same IP Address .
working principle
One . Four steps to lease
2.1 DHCP Client to IP request
2.2 DHCP Server responds to requests
2.3 DHCP Client selection IP
2.4 DHCP Server confirms lease
Two . Renewal
/etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
dhcpd Common parameters and functions used in the service program configuration file
Parameters effect
ddns-update-style type Definition DNS The type of service dynamic update , Types include :
none( Dynamic update not supported )、interim( Interactive update mode ) And ad-hoc( Special update mode )
allow/ignore client-updates allow / Ignore client updates DNS Record
default-lease-time 21600 Default timeout
max-lease-time 43200 Maximum timeout
option domain-name-servers 8.8.8.8 Definition DNS Server address
option domain-name "domain.org" Definition DNS domain name
range Define the IP Address pool
option subnet-mask Define the subnet mask for the client
option routers Define the gateway address of the client
broadcast-address Broadcast address Define the broadcast address of the client
ntp-server IP Address Define the client's network time server (NTP)
nis-servers IP Address Define client's NIS Address of domain server
hardware Hardware type MAC Address Specify the type of network card interface and MAC Address
server-name Host name towards DHCP Client notification DHCP The hostname of the server
fixed-address IP Address To fix something IP Address assigned to the specified host
time-offset Offset difference Specifies the offset difference between the client and Greenwich mean time
[[email protected] ~]# vim /etc/dhcp/dhcpd.conf
ddns-update-style none; Set up DNS The service does not automatically update dynamically
ignore client-updates; Ignore client updates DNS Record
subnet 192.168.10.0 netmask 255.255.255.0 {
The scope is 192.168.10.0/24 Network segment
range 192.168.10.50 192.168.10.150; IP The address pool is 192.168.10.50-150( about 100 individual IP Address )
option subnet-mask 255.255.255.0; Define the client's default subnet mask
option routers 192.168.10.1; Define the gateway address of the client
option domain-name "linuxprobe.com"; Define default search fields
option domain-name-servers 192.168.10.1; Define client's DNS Address
default-lease-time 21600; Define the default lease time ( Company : second )
max-lease-time 43200; Define the maximum appointment time ( Company : second )
}
firewall-cmd --zone=public --permanent --add-service=dhcp
firewall-cmd --reload
experiment
1. Basic experiments
server
yum install -y dhcp
vim /etc/dhcp/dhcpd.conf
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.50 192.168.10.150;
option subnet-mask 255.255.255.0;
# option routers 192.168.10.1;
# option domain-name "linuxprobe.com";
# option domain-name-servers 192.168.10.1;
default-lease-time 21600;
max-lease-time 43200;
service dhcpd restart
tail /var/log/message
Jun 20 07:20:11 localhost systemd: Started DHCPv4 Server Daemon.
Jun 20 07:20:13 localhost dhcpd: DHCPDISCOVER from 00:0c:29:d9:5e:93 via ens33
Jun 20 07:20:14 localhost dhcpd: DHCPOFFER on 192.168.10.50 to 00:0c:29:d9:5e:93 via ens33
Jun 20 07:20:14 localhost dhcpd: DHCPREQUEST for 192.168.10.50 (192.168.10.10) from 00:0c:29:d9:5e:93 via ens33
Jun 20 07:20:14 localhost dhcpd: DHCPACK on 192.168.10.50 to 00:0c:29:d9:5e:93 via ens33
2. Fixed address assignment
client
arp -a # obtain mac
server
host test {
hardware ethernet 00:0c:29:e3:2d:08
fixed-address 192.168.10.160
}
3. Superscope
Can solve ip Not enough address , One arm router
server
cp -a /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-ens33:1
Change devcive,ipaddr
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p
cp -a /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
:1,88d
shared-network 10-20 {
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.10;
range 192.168.10.200 192.168.10.200;
}
subnet 192.168.20.0 netmask 255.255.255.0 {
option routers 192.168.20.10;
range 192.168.20.100 192.168.20.200;
}
}
4. dhcp Relay server
dhcp The server vm10 192.168.10.10
vim /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR=192.168.10.10
NETMASK=255.255.255.0
DNS1=8.8.8.8
GATEWAY=192.168.10.20
service network restart
yum install dhcp -y
vim /etc/dhcp/dhcpd.conf
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.100 192.168.10.110;
option routers 192.168.10.20;
}
subnet 100.100.100.0 netmask 255.255.255.0 {
range 100.100.100.100 100.100.100.110;
option routers 100.100.100.20;
}
dhcp relay vm10 192.168.10.20 vm11 100.100.100.20
vim /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR=192.168.10.20
NETMASK=255.255.255.0
DNS1=8.8.8.8
GATEWAY=192.168.10.20
vim /etc/sysconfig/network-scripts/ifcfg-ens34
IPADDR=100.100.100.10
NETMASK=255.255.255.0
DNS1=8.8.8.8
GATEWAY=100.100.100.20
service network restart
yum install dhcp -y
cp /lib/systemd/system/dhcrelay.service /etc/systemd/system # take dhcp Relay master configuration file replication
vim /etc/systemd/system/dhcrelay.service # edit dhcp Relay master configuration file
[Service]
Type=notify
ExecStart=/usr/sbin/dhcrelay -d --no-pid -i ens33 -i ens35 192.168.10.10
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p
topic
https://www.linuxprobe.com/basic-learning-14.html
边栏推荐
- keil编译运行错误,缺少error:#5:#includecore_cm3.h_过路老熊_新浪博客
- InputStream流已经关闭了,但是依旧无法delete文件或者文件夹,提示被JVM占用等
- Common problems encountered when creating and publishing packages using NPM
- 文献调研(三):数据驱动的建筑能耗预测模型综述
- 解析產品開發失敗的5個根本原因
- 剑指 Offer 48. 最长不含重复字符的子字符串
- Analyse des cinq causes profondes de l'échec du développement de produits
- 兆欧表电压档位选择_过路老熊_新浪博客
- 6.常用指令(上)v-cloak,v-once,v-pre
- Compiling protobuf protocol files using makefile in PHP
猜你喜欢
如何进行流程创新,以最经济的方式提升产品体验?
Wireshark对IMAP抓包分析
Search rotation array ii[Abstract dichotomy exercise]
ValueError: color kwarg must have one color per data set. 9 data sets and 1 colors were provided解决
猕猴桃酵素的功效_过路老熊_新浪博客
Establishment of multiple background blocks in botu software_ Old bear passing by_ Sina blog
One article explains R & D efficiency! Your concerns are
今天说说String相关知识点
博图软件中多重背景块的建立_过路老熊_新浪博客
Building cloud computers with FRP
随机推荐
Talk about how to hot restart a spoole or PHP cli process
Common methods of object class
Unable to start debugging. Unexpected GDB output from command “-environment -cd xxx“ No such file or
sqlServer2008中float类型数据与datetime类型数据互转
php进程间传递文件描述符
使用百度地图API在地图中设置一个覆盖物(InfoWindow),可自定义窗口内容
Stop eating vitamin C tablets. These six fruits have the highest vitamin C content
Analyse des cinq causes profondes de l'échec du développement de produits
STEP7 master station and remote i/o networking_ Old bear passing by_ Sina blog
Can I upload pictures without deploying the server?
Common knowledge points in JS
Keil compilation run error, missing error: # 5: # includecore_ cm3.h_ Old bear passing by_ Sina blog
在step7中实现模拟量数值与工程量数值之间的转换_过路老熊_新浪博客
网络协议之:redis protocol详解
7.常用指令(下)v-on,v-bind,v-model的常见操作
SSM整合学习笔记(主要是思路)
final和static
手工制作 pl-2303hx 的USB转TTL电平串口的电路_过路老熊_新浪博客
static关键字详解
unsigned与signed之大白话