Linux command
dhcpd 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Start DHCP server
sudo dhcpd
Start on specific interface
sudo dhcpd [eth0]
Start in foreground
sudo dhcpd -f -d
Test configuration file
sudo dhcpd -t
Use alternate config file
sudo dhcpd -cf [/path/to/dhcpd.conf]
Use alternate lease file
sudo dhcpd -lf [/path/to/dhcpd.leases]
说明
dhcpd is the Internet Systems Consortium (ISC) DHCP server daemon. It assigns IP addresses and network configuration to clients on local networks using the Dynamic Host Configuration Protocol. The server maintains a lease database tracking which addresses are assigned to which clients. Configuration defines address pools, lease durations, and options like gateway, DNS servers, and domain names. Static assignments can reserve specific addresses for known MAC addresses. The server can also provide PXE boot options, custom options for specific vendors, and failover configurations for high availability.
参数
- -f
- Run in foreground.
- -d
- Log to stderr (implies -f).
- -t
- Test configuration and exit.
- -T
- Test lease file and exit.
- -cf _file_
- Use alternate configuration file.
- -lf _file_
- Use alternate lease database.
- -pf _file_
- Use alternate PID file.
- -4 / -6
- Force IPv4 or IPv6 mode.
- -p _port_
- Listen on alternate UDP port (default 67).
- -s _address_
- Send replies to specified address instead of broadcast.
- -q
- Quiet startup (suppress copyright message).
- -user _user_
- Setuid to user after privileged operations.
- -group _group_
- Setgid to group after privileged operations.
- -chroot _dir_
- Chroot to directory.
- -tf _tracefile_
- Log startup state and transactions for debugging.
- --no-pid
- Don't write PID file.
- --version
- Display version and exit.
FAQ
What is the dhcpd command used for?
dhcpd is the Internet Systems Consortium (ISC) DHCP server daemon. It assigns IP addresses and network configuration to clients on local networks using the Dynamic Host Configuration Protocol. The server maintains a lease database tracking which addresses are assigned to which clients. Configuration defines address pools, lease durations, and options like gateway, DNS servers, and domain names. Static assignments can reserve specific addresses for known MAC addresses. The server can also provide PXE boot options, custom options for specific vendors, and failover configurations for high availability.
How do I run a basic dhcpd example?
Run `sudo dhcpd` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f do in dhcpd?
Run in foreground.