linux dhcp服务器搭建_如何自己搭建服务器

linux dhcp服务器搭建_如何自己搭建服务器本篇是关于在Linux服务器上安装并配置DHCP服务器的配置教程!

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定


实验环境说明

主机系统 系统版本 获取IP地址方式 IP地址
服务端 Linux RHEL 7.0 静态IP 192.168.43.128/24
客户端 Linux RHEL 7.4 DHCP分配固定IP 192.168.43.15/24
客户端 Windows Windows 11 DHCP自动随机分配 x.x.x.x

注意事项

  • 在使用两台Linux主机时,一定要保证两台设备之间可以互相连通,可以先配置静态IP,测试两台主机之间是否是连通的
  • 虚拟网络编辑器中,不要使用使用本地DHCP服务将IP地址分配给虚拟机
  • 两台设备都是使用仅主机模式,或者使用相同的VMnet接口

请添加图片描述请添加图片描述请添加图片描述请添加图片描述

服务器配置

配置服务器的IP地址

  • 为服务器配置IP地址,并重启网卡,使配置生效
[root@Server ~]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736 
[root@Server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777736 
TYPE=Ethernet
BOOTPROTO=static
NAME=eno16777736
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.43.128
NETMASK=255.255.255.0
GATEWAY=192.168.43.1
DNS1=8.8.8.8
[root@Server ~]# systemctl restart network

Jetbrains全家桶1年46,售后保障稳定

  • 分配的IP地址必须和配置的静态IP地址在同一个网段
  • 这里的ifcfg-ens33为我的网卡名,不同版本的系统,网卡名会存在差异,具体的根据自己的网卡名进行配置,NAMEDEVICE与网卡名都要保持一致

配置本地YUM仓库

  • 首先需要使用RHEL的ISO镜像,并连接到连接虚拟机
    请添加图片描述请添加图片描述
  • 将镜像文件进行挂载
[root@Server ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@Server ~]# 
  • 配置YUM仓库,使用本地的ISO镜像文件进行安装。如果虚拟机已经连接网络,也可以使用网络源进行软件包的安装
[root@Server ~]# cd /etc/yum.repos.d/
[root@Server yum.repos.d]# rm -rf * //删除此目录下的所有其他源配置
[root@Server yum.repos.d]# vim rhel.repo //配置新的源文件
[root@Server yum.repos.d]# ls
rhel.repo
[root@Server yum.repos.d]# cat rhel.repo 
[Base]
name=RHEL                //仓库名
baseurl=file:///mnt      //使用的仓库源,file://为固定格式,/mnt表示本地软件包所在的目录
gpgcheck=0               //是否进行检查验证
enabled=1                //是否启用本仓库
  • 如果/etc/yum.repos.d/目录下还有其他的.repo文件,则使用rm -rf *全部删除。避免使用了其他的源文件。
  • 清除软件包缓存
[root@Server yum.repos.d]# yum clean all 
已加载插件:langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
正在清理软件源: Base
Cleaning up everything
[root@Server yum.repos.d]# 
  • 重新加载软件包
[root@Server yum.repos.d]# yum repolist all 
已加载插件:langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Base                                            | 4.1 kB     00:00     
(1/2): Base/group_gz                              | 137 kB   00:00     
(2/2): Base/primary_db                            | 4.0 MB   00:00     
源标识                         源名称                       状态
Base                           RHEL                         启用: 4,986
repolist: 4,986
[root@Server yum.repos.d]# 
  • repolist:4,986:表示有可用的软件包数量,如果没有,则检查本地源文件的配置。

安装DHCP软件包

  • 使用YUM工具安装DHCP软件包
[root@Server ~]# yum -y install dhcp
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package dhcp.x86_64 12:4.2.5-58.el7 will be installed

...

Installed:
  dhcp.x86_64 12:4.2.5-58.el7                                                   

Dependency Updated:
  dhclient.x86_64 12:4.2.5-58.el7       dhcp-common.x86_64 12:4.2.5-58.el7     
  dhcp-libs.x86_64 12:4.2.5-58.el7     

Complete!
[root@Server ~]# 
  • 复制DHCP的默认配置文件到DHCP的配置目录中
[root@Server ~]# cd /etc/dhcp/
[root@Server dhcp]# ls
dhclient.d  dhclient-exit-hooks.d  dhcpd6.conf  dhcpd.conf  scripts
[root@Server dhcp]# cat dhcpd.conf 
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
[root@Server dhcp]# cat /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example | grep -v "#" >> dhcpd.conf
[root@Server dhcp]# ls
dhclient.d  dhclient-exit-hooks.d  dhcpd6.conf  dhcpd.conf  scripts
[root@Server dhcp]# 
  • /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example:为DHCP的默认配置文件,根据不同的DHCP软件包的版本不同,需要修改/usr/share/doc/下的DHCP版本
  • grep -v "#" >> dhcpd.conf:表示将默认配置文件中的注释行删除,然后重新追加到dhcpd.conf文件中
  • 修改DHCP的配置文件,根据需求进行相关的配置
[root@Server dhcp]# vim dhcpd.conf
[root@Server dhcp]# cat dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
subnet 192.168.43.0  netmask 255.255.255.0 { 
        //配置DHCP服务器可以分配的地址网段以及子网掩码
  range 192.168.43.20 192.168.43.40;             //配置DHCP服务器可以分配的地址范围
  option domain-name-servers 192.168.43.128;     //配置DNS服务器的IP地址
  option routers 192.168.43.1;                   //配置默认网关
  default-lease-time 600;                        //配置默认租期,单位是秒
  max-lease-time 7200;                           //配置最大租期,单位是秒
}

host RHEL_Client_7.4 { 
                              //为特殊的主机单独配置
  hardware ethernet 00:0c:29:9e:9b:29;           //需要绑定固定IP的主机MAC地址
  fixed-address 192.168.43.15;                   //为主机绑定固定IP地址
}
  • 对于配置文件的修改,尽量不在源文件上进行修改,先进行复制,将源内容进行注释,做好备份,以免配置错误无法回滚。
  • 如果不需要对特殊的主机分配固定的IP地址,则不需要配置host

配置防火墙和SELinux

  • 防火墙放行DHCP服务
[root@Server ~]# systemctl status firewalld.service 
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
   Active: active (running) since 四 2021-12-09 10:10:32 CST; 6min ago
 Main PID: 4060 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─4060 /usr/bin/python -Es /usr/sbin/firewalld --nofork...

12月 09 10:10:32 Server systemd[1]: Started firewalld - dynamic ....
Hint: Some lines were ellipsized, use -l to show in full.
[root@Server ~]# firewall-cmd --permanent --add-service="dhcp" //防火墙放行DHCP服务
success
[root@Server ~]# firewall-cmd --reload //重新加载防火墙放行规则
success
[root@Server ~]# firewall-cmd --list-all //列出防火墙放行的所有服务
public (default, active)
  interfaces: eno16777736
  sources: 
  services: dhcp dhcpv6-client ssh
  ports: 
  masquerade: no
  forward-ports: 
  icmp-blocks: 
  rich rules: 
	
[root@Server ~]# 
  • Active: inactive (dead):表示防火墙已经关闭
  • Active: active (running):表示防火墙已经开启
  • 关闭SELinux
[root@Server ~]# vim /etc/selinux/config 
[root@Server ~]# cat !$ | grep -v "#" | grep -v "^$"
SELINUX=disabled 
SELINUXTYPE=targeted 
[root@Server ~]#
  • !$:表示上一条命令的最后一个参数
  • grep -v "#" | grep -v "^$":表示过滤注释行和空行

启动DHCP服务

  • 启动DHCP服务
[root@Server ~]# systemctl restart dhcpd.service //重新启动DHCP服务
[root@Server ~]# systemctl enable dhcpd.service //设置开机自启动
[root@Server ~]# systemctl status dhcpd.service //查看DHCP的运行状态
dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; disabled)
   Active: active (running) since 四 2021-12-09 11:09:00 CST; 8s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 8274 (dhcpd)
   Status: "Dispatching packets..."
   CGroup: /system.slice/dhcpd.service
           └─8274 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -gr...

客户端配置

  • 将客户端的IP地址获取方式修改为通过DHCP动态获取,并重新启动网卡
[root@Client ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 
[root@Client ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 
TYPE=Ethernet
BOOTPROTO=dhcp             //配置为通过DHCP获取IP地址
NAME=ens33
DEVICE=ens33
ONBOOT=yes                 //配置开机自启动

# 配置静态IP地址
#IPADDR=192.168.43.131
#NETMASK=255.255.255.0
#GATEWAY=192.168.43.254
#DNS1=8.8.8.8
[root@Client ~]# systemctl restart network

查看客户端的IP地址

  • 使用ifconfig或者ip a查看本机的IP地址
[root@Client ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.43.15  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 fe80::20c:29ff:fe9e:9b29  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:9e:9b:29  txqueuelen 1000  (Ethernet)
        RX packets 2961  bytes 275996 (269.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1347  bytes 169005 (165.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 420  bytes 34416 (33.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 420  bytes 34416 (33.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@Client ~]# 
  • ether 00:0c:29:9e:9b:29:表示本机网卡的MAC地址,在服务器配置主机与IP绑定时,则需要查看本机网卡的MAC地址
  • 可以看到本机的IP地址为192.168.43.15,即为DHCP服务器分配的IP地址

查看Windows客户端IP地址

  • 配置Windows客户端的VMnet 1网卡的IP地址获取方式为DHCP
    请添加图片描述

  • 查看IP地址信息
    请添加图片描述

服务端查看DHCP的日志文件

  • 在服务端查看DHCP的日志文件,查看具体的地址分配信息
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5

lease 192.168.43.20 { 
   
  starts 4 2021/12/09 02:46:58;
  ends 4 2021/12/09 02:56:58;
  tstp 4 2021/12/09 02:56:58;
  cltt 4 2021/12/09 02:46:58;
  binding state free;
  hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 
   
  starts 5 2021/12/10 06:57:31;
  ends 5 2021/12/10 07:07:31;
  cltt 5 2021/12/10 06:57:31;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:50:56:c0:00:01;
  uid "[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
1">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
1[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 0">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
0
PV0[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 0">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
0
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 1">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
1
"; client-hostname "Hasee-Bad"; } server-duid "[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 0">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
0
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 1">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
1
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 0">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
0
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 1">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
1
)D45[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.2.5 lease 192.168.43.20 { starts 4 2021/12/09 02:46:58; ends 4 2021/12/09 02:56:58; tstp 4 2021/12/09 02:56:58; cltt 4 2021/12/09 02:46:58; binding state free; hardware ethernet 00:0c:29:9e:9b:29; } lease 192.168.43.21 { starts 5 2021/12/10 06:57:31; ends 5 2021/12/10 07:07:31; cltt 5 2021/12/10 06:57:31; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:c0:00:01; uid "\001\000PV\300\000\001"; client-hostname "Hasee-Bad"; } server-duid "\000\001\000\001)D\034\305\000\014)I\346\331"; [root@Server ~]# 0">
[root@Server ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
lease 192.168.43.20 { 

starts 4 2021/12/09 02:46:58;
ends 4 2021/12/09 02:56:58;
tstp 4 2021/12/09 02:56:58;
cltt 4 2021/12/09 02:46:58;
binding state free;
hardware ethernet 00:0c:29:9e:9b:29;
}
lease 192.168.43.21 { 

starts 5 2021/12/10 06:57:31;
ends 5 2021/12/10 07:07:31;
cltt 5 2021/12/10 06:57:31;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Hasee-Bad";
}
server-duid "\000\001\000\001)D\034\305\000\014)I\346\331";
[root@Server ~]# 
0
4)I61"
; [root@Server ~]#
  • /var/lib/dhcpd/dhcpd.leases:为DHCP的日志文件

以上内容均属原创,如有不详或错误,敬请指出。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/210134.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • 谈谈5G的信道编码方法

    谈谈5G的信道编码方法最近因为联想的投票引发了轩然大波,让我们不得不审视一下投票的对象:5G的信道编码方式。信道编码是通信技术中非常关键的技术,用于对抗信道上的噪声以及干扰,提高传输的效率。我在通信技术的四大金刚一文中,按重要性将编码技术归为第二位,其中就包含了信道编码。不过,信道编码的效果是有极限的,这就是香农定理所指出的编码极限。在GSM系统中,采用了卷积以及交织等信道编码方式,离编码极限还有一段距…

  • Windows.h 常用API函数【转】[通俗易懂]

    转自:https://blog.csdn.net/farmwang/article/details/50603608http://www.vbgood.com/api.htmlhttp://hi.baidu.com/3582077/item/9cc3483b581f53c5392ffae3第一个:FindWindow根据窗口类名或窗口标题名来获得窗口的句柄,该函数返回窗口的句柄,这…

  • SHFileOperation使用

    SHFileOperation使用总结一下SHFileOperation的用法,希望对大家有用//删除文件或者文件夹boolDeleteFile(char*lpszPath){SHFILEOPSTRUCTFileOp={0};FileOp.fFlags=FOF_ALLOWUNDO|//允许放回回收站FOF_NOCONFIRMATION;//不出现确认对话框…

  • python基础语法个人笔记_python基础题库

    python基础语法个人笔记_python基础题库python语法规范python的语法规范非常重要,简洁明了是python的特性,以下是python语法的一些说明python3的编码格式是unicode(utf-8)标识符的规则:由字母、数字

  • centos7 输入 ifconfig 不显示 ip 地址 连接不上的解决方法(亲测成功)「建议收藏」

    centos7 输入 ifconfig 不显示 ip 地址 连接不上的解决方法(亲测成功)「建议收藏」最近又把自己的虚拟机打开了玩玩集群,遇到一个小问题,我发现虚拟机的内存不够了,就把虚拟机关机加大了内存,谁知道开机后,ifconfig或者ipaddr显示没有ip地址,只显示一个lo,没有ens33,没有ip地址就没法用xshell连接,很蛋疼,网上也有很多解决方案,但都写的乱七八糟的,而且很多都不好使,今天就来介绍一下我最后解决的方法.我说一下我的虚拟机的情况,我三台虚拟机,之前是mas………

    2022年10月23日
  • 半正定矩阵小计

    半正定矩阵小计抄录自百度百科定义:设A是n阶方阵,如果对任何非零向量X,都有X'AX>=0,就称A为半正定矩阵性质:1.半正定矩阵的行列式是非负的。2.半正定矩阵+半正定矩阵还是半正定矩阵

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号