1# dhclient 2 3 4## Command Function 5 6This command is used to set and query **dhclient** parameters. 7 8 9## Syntax 10 11- dhclient <*netif name*> 12 13- dhclient -x <*netif name*> 14 15 16## Parameters 17 18**Table 1** Parameter description 19 20| Parameter | Description | Value Range | 21| ------------------------------- | -------------------------------------------- | ---------------- | 22| -h \| --help | Displays parameters supported by the **dhclient** command and their usage.| N/A | 23| <netif name> | Enables Dynamic Host Configuration Protocol (DHCP) for a network interface card (NIC). | NIC name, **eth0**| 24| -x <netif name> | Disables DHCP for a NIC. | NIC name, **eth0**| 25 26 27## Usage Guidelines 28 29Run the following commands: 30 31- dhclient eth0 32 33- dhclient -x eth0 34 35## Note 36 37Currently, the shell does not support this command. 38 39## Example 40 41Example 1: Enable DHCP for eth0. 42 43 44``` 45OHOS:/$ dhclient eth0 46OHOS:/$ ifconfig 47lo ip:127.0.0.1 netmask:255.0.0.0 gateway:127.0.0.1 48 ip6: ::1/64 49 HWaddr 00 MTU:0 Running Link UP 50eth0 ip:192.168.1.10 netmask:255.255.255.0 gateway:192.168.1.1 51 HWaddr 42:da:81:bc:58:94 MTU:1500 Running Default Link UP 52OHOS:/$ 53``` 54 55 56Example 2: Disable DHCP for eth0. 57 58 59``` 60OHOS:/$ dhclient -x eth0 61NetifStatusCallback(eth0): nsc event: 0xf0 62OHOS:/$ ifconfig 63lo ip:127.0.0.1 netmask:255.0.0.0 gateway:127.0.0.1 64 ip6: ::1/64 65 HWaddr 00 MTU:0 Running Link UP 66eth0 ip:0.0.0.0 netmask:0.0.0.0 gateway:0.0.0.0 67 HWaddr 42:da:81:bc:58:94 MTU:1500 Running Default Link UP 68``` 69