暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Centos的DHCP服务配置与地址池查看

云自由 2022-12-13
1463


一、DHCP服务配置

[root@localhost ~]# vi etc/dhcp/dhcpd.conf

ddns-update-style none;
ignore client-updates;
subnet 10.136.176.0 netmask 255.255.255.128{
range 10.136.176.25 10.136.176.124;
option subnet-mask 255.255.255.128;
option routers 10.136.176.126;
option domain-name-servers 59.206.249.1,114.114.114.114;
default-lease-time 21600;
max-lease-time 43200;
}
复制

ddns-update-style none; 设置DNS服务不自动进行动态更新

ignore client-updates; 忽略客户端更新DNS记录

subnet 192.168.10.0 netmask 255.255.255.0 { 作用域为192.168.10.0/24网段

range 192.168.10.50 192.168.10.150; IP地址池为192.168.10.50-150(约100个IP地址)

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; 定义客户端的DNS地址

default-lease-time 21600; 定义默认租约时间(单位:秒)

max-lease-time 43200; 定义最大预约时间(单位:秒)

} 结束符

二、系统服务与防火墙配置

#将服务加入开机启动项
[root@linuxprobe ~]# systemctl start dhcpd

[root@linuxprobe ~]# systemctl enable dhcpd

#关闭防火墙
[root@linuxprobe ~]# systemctl disable firewalld.service
复制

三、查看linux的dhcpd地址池分配使用情况

[root@localhost ~]# vi var/lib/dhcpd/dhcpd.leases

lease 10.136.176.119 {
starts 2 2022/12/06 03:21:22;
ends 2 2022/12/06 09:21:22;
cltt 2 2022/12/06 03:21:22;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet b2:92:c0:ec:f6:e9;
uid "\001\262\222\300\354\366\351";
client-hostname "HUAWEI_Mate_30_Pro_5G-492";
}
复制

starts date;租约的开始时间

ends date;租约的结束时间

cltt:客户端最后一次续约时间

binding state state;声明租约的绑定状态,可能为活动(active)、可用(free)、放弃(abandoned)。

next binding state state;当前状态到期时租约将移动到的状态。当前状态过期的时间在ends语句中指定。

hardwarehardware-type mac-address;使用ip的客户端网络接口的mac地址

uid client-identifier;记录用于获取租约的客户端标识符。

client-hostname hostname;客户端发送其主机名。


文章转载自云自由,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论