dhcpd命令来自英文词组“DHCP daemon”的缩写,其功能是用于管理DHCP服务程序。执行dhcpd命令会读取加载dhcpd.conf配置文件并启动服务器上的DHCP服务程序,随后用户便可以获取到如IP地址、子网掩码、网关地址等网卡信息了。

语法格式:dhcpd [参数] [网络接口]

常用参数:

-4 基于IPv4网络协议
-6 基于IPv6网络协议
-d 使用调试模式
-f 作为前台进程运行
-p 设置监听端口
-q 静默执行模式
-s 设置发送回复的服务器
-t 测试配置文件的语法是否正确
-T 测试租约数据库文件是否正确
-cf 设置配置文件路径
-lf 设置租约文件
-pf 设置服务PID文件

参考示例

启动DHCP服务程序:

[root@linuxcool ~]# dhcpd
Internet Systems Consortium DHCP Server 4.3.6
Copyright 2004-2017 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
ldap_gssapi_principal is not set,GSSAPI Authentication for LDAP will not be used
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcpd/dhcpd.leases
PID file: /var/run/dhcpd.pid
Source compiled to use binary-leases
Wrote 0 leases to leases file.
Listening on LPF/ens160/00:0c:29:60:cd:ee/192.168.10.0/24
Sending on   LPF/ens160/00:0c:29:60:cd:ee/192.168.10.0/24
Sending on   Socket/fallback/fallback-net

指定发送回复的DHCP服务器地址,并启动服务程序:

[root@linuxcool ~]# dhcpd -s 192.168.10.10

以调试模式启动DHCP服务程序:

[root@linuxcool ~]# dhcpd -d

指定监听端口号后启动DHCP服务程序:

[root@linuxcool ~]# dhcpd -p 53
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。