Linux : how to force DHCP IP address renewal with dhclient?
Table of Contents
I. Introduction
In this tutorial, we'll learn how to use the "dhclient" command to manage the dynamic IP configuration of a Linux machine. We'll take the example of a machine running Ubuntu, but the same applies to other distributions.
A computer's network card can be configured for static addressing, i.e. with a fixed IP address defined in the machine's configuration, or for dynamic addressing, where the configuration is obtained via a DHCP server.
These parameters received from the DHCP server are associated with what is known as a DHCP lease. The "dhclient" command is used to manage this lease, in particular by releasing it and renewing a new lease, i.e. a new IP configuration, with the DHCP server.
II. Using the dhclient command
A. Before you start
For the dhclient command to be used, the network card must be configured for DHCP (dynamic configuration). This can be configured from the "/etc/network/interfaces" file or from a Netplan configuration file, depending on how the network is managed on the machine.
For your information, here is the configuration of the "/etc/netplan/01-network-manager-all.yaml" file for Netplan on Ubuntu :
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
ens33:
dhcp4: yes
Also for your information, if you go through the "/etc/network/interfaces" file, here's the expected configuration:
auto ens33
iface ens33 inet dhcp
Restart the network service on your machine (the command is different, depending on whether you're using Netplan or not).
You also need to be careful with remotely-administered machines: releasing the DHCP lease will disconnect the machine from the network. So if you're working on a remote server via SSH, for example, you run the risk of losing control.
B. Releasing the DHCP lease under Linux
If your Linux machine already has an IP address obtained via DHCP, you can release the lease and therefore remove the IP address from the network card via this command:
sudo dhclient -r
You must have "sudo" access (elevation of privileges) or direct root access to run this command. This command returns no result in the console.
If you need to specify a specific network card, which can be useful if you have several on your machine, use this command (here, we target the "ens33" card):
sudo dhclient -r ens33
C. Renewing the DHCP lease under Linux
If you then wish to request a new DHCP lease, simply execute this command:
sudo dhclient
You don't need to specify any options. The machine will immediately send packets over the network in an attempt to locate a DHCP server and obtain a new IP address.

III. Conclusion
Thanks to the "dhclient" command, you can renew the DHCP lease of a Debian or Ubuntu machine very easily! An alternative would be to use "nmcli" (NetworkManager) instead of "dhclient", but the method described in this article is easier to remember.
Finally, if you're using a Linux machine with a graphical interface, you can simply disable and re-enable the network interface in the network settings. This will allow you to renew the DHCP lease from the desktop environment.
