This article covers how to force DHCP client to renew IP address. You need to use Dynamic Host Configuration Protocol Client i.e., dhclient command.
The client normally doesn't release the current lease as it is not required by the DHCP protocol. Some cable ISPs require their clients to notify the server if they wish to release an assigned IP address.
The dhclient command, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol, BOOTP protocol, or if these protocols fail, by statically assigning an address.
Linux renew ip command using dhcp:
The -r flag explicitly releases the current lease, and once the lease has been released, the client exits.
For example, open terminal application and type the command:
$ sudo dhclient -r
Now obtain fresh IP address using DHCP on Linux:
$ sudo dhclient
To start DHCP client in Linux:
1. To start the DHCP service, type the following command: # /etc/init.d/dhcp start.
2. To stop the DHCP service, type the following command: # /etc/init.d/dhcp stop.
The DHCP daemon stops until it is manually started again, or the system reboots.
How can I renew or release an IP in Linux for eth0?
To renew or release an IP address for the eth0 interface, enter:
$ sudo dhclient -r eth0
$ sudo dhclient eth0
In this example, I am renewing an IP address for my wireless interface:
sudo dhclient -v -r eth0
sudo dhclient -v eth0
Command to release/renew a DHCP IP address in Linux:
1. ip a - Get ip address and interface information on Linux
2. ip a s eth0 - Find the current ip address for the eth0 interface in Linux
3. dhclient -v -r eth0 - Force Linux to renew IP address using a DHCP for eth0 interface
4. systemctl restart network.service - Restart networking service and obtain a new IP address via DHCP on Ubuntu/Debian Linux
5. systemctl restart networking.service - Restart networking service and obtain a new IP address via DHCP on a CentOS/RHEL/Fedora Linux
6. nmcli con - Use NetworkManager to obtain info about Linux IP address and interfaces
7. nmcli con down id 'enp6s0' - Take down Linux interface enp6s0 and release IP address in Linux
8. nmcli con up id 'enp6s0' - Obtian a new IP address for Linux interface enp6s0 and release IP address using DHCP