Linux command
dhclient 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Obtain IP address
dhclient [eth0]
Release current lease
dhclient -r [eth0]
Release and obtain
dhclient -r [eth0] && dhclient [eth0]
Run in foreground
dhclient -d -v [eth0]
Use specific configuration
dhclient -cf [/etc/dhcp/dhclient.conf] [eth0]
Contact specific DHCP server
dhclient -s [192.168.1.1] [eth0]
说明
dhclient is the Internet Systems Consortium DHCP client. It dynamically configures network interfaces by obtaining IP addresses, subnet masks, gateways, and DNS servers from DHCP servers. The client implements the DHCP protocol, handling lease negotiation, renewal, and release. Configuration options in dhclient.conf allow customizing requests, including requesting specific options or addresses. dhclient maintains lease information in lease files, allowing it to request the same address on reconnection. It can manage multiple interfaces simultaneously and supports both DHCPv4 and DHCPv6.
参数
- -r
- Release the current lease.
- -d
- Run in foreground (debug mode).
- -v
- Verbose output.
- -cf _FILE_
- Use specified configuration file.
- -lf _FILE_
- Use specified lease file.
- -s _ADDRESS_
- Specify DHCP server address to contact.
- -4
- Use DHCPv4 only.
- -6
- Use DHCPv6 only.
- --help
- Display help information.
FAQ
What is the dhclient command used for?
dhclient is the Internet Systems Consortium DHCP client. It dynamically configures network interfaces by obtaining IP addresses, subnet masks, gateways, and DNS servers from DHCP servers. The client implements the DHCP protocol, handling lease negotiation, renewal, and release. Configuration options in dhclient.conf allow customizing requests, including requesting specific options or addresses. dhclient maintains lease information in lease files, allowing it to request the same address on reconnection. It can manage multiple interfaces simultaneously and supports both DHCPv4 and DHCPv6.
How do I run a basic dhclient example?
Run `dhclient [eth0]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r do in dhclient?
Release the current lease.