Help Center> Virtual Private Cloud> FAQ> VPC and Subnet> How Do I Make the Changed DHCP Lease Time of a Subnet Take Effect Immediately?

How Do I Make the Changed DHCP Lease Time of a Subnet Take Effect Immediately?

Scenarios

After you change the DHCP lease time on the console, the existing ECSs will not use the new DHCP lease until the current lease needs to be renewed. A release is renewed when half of the lease time has passed. For example, if the lease is 30 days set on January 1, the lease will be renewed on January 15.

If you need to make the new DHCP lease time take effect immediately for ECSs in the subnet, refer to the following operations.

Precautions

If you renew the DHCP lease manually, the current IP addresses of ECSs will be released and they have no IP addresses until the new release takes effect and they are assigned with new IP addresses, which may cause service interruption.

You can also directly restart the ECSs to make the new DHCP release take effect immediately.

For a Windows ECS:

1. After you changed the DHCP lease time on the console, log in to the ECS whose lease is to be renewed.

2. Choose Start > Run. Type cmd to open the DOS operation GUI.

3. Run the ipconfig /all command to view the expiration time of the current DHCP lease.

4. Run the ipconfig /release && ipconfig /renew command to renew the lease. Run the ipconfig /all command again to view the result.

For a Linux ECS:

1. After you changed the DHCP lease time on the console, log in to the ECS whose lease is to be renewed.

2. Run the ps -ef | grep dhclient command to check whether the client that provides the DHCP service is dhclient. If the process in the following figure exists, the client is dhclient. The lease file whose path is next to the -lf parameter contains the lease information. If the dhclient process does not exist, this document may not be applicable. In this case, you need to search for the operation commands of the corresponding DHCP client.

3. Run the dhclient -r command to release the current IP address.

4. Run the dhclient command to obtain the new DHCP lease. View the lease file mentioned in the preceding step. You can view the latest DHCP lease. The lease file also stores the historical lease. The last lease in the file is the latest lease.