Linux ip address release

Force DHCP Client to Renew IP Address – How to do

by Sushali Dasan | Mar 23, 2021

Wondering how to force DHCP Client to renew IP address? We can help you.

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.

Here at Bobcares, we handle DHCP Client on servers of our customers as a part of our Server Management Services.

Today let’s see to force DHCP clients to renew IP addresses along with the steps that our Support Techs follow to do this.

Linux force DHCP client to release IP address and renew the IP address

The following are two methods to force DHCP client to release IP address:

Method 1

Using the below command to force Linux to renew IP address using a DHCP for eth0 interface

Method 2

For Ubuntu/Debian servers we can use the following command to restart the networking service and obtain an IP address via DHCP:

For CentOS/RHEL/Fedora we can use the following command to restart the networking service and obtain an IP address via DHCP:

Method 3

Use the following NetworkManager command to obtain info about Linux IP address and interfaces

To take down Linux interface enp6s0 and release IP address in Linux we can use the following command:

For obtaining a new IP address for Linux interface enp6s0 and release IP address using DHCP we can use the following command:

Some other basic commands to release IP address or renew the IP address

1. In Windows, we can release IP address using the command:

2. In Windows, we can renew IP address using the command:

3. To Linux renew IP command using DHCP

4. To obtain a fresh IP address using DHCP on Linux:

How to renew or release an IP in Linux for eth0

To renew or release an IP address for the eth0 interface, enter:

Other options in Linux to renew DHCP

We can also execute the following commands:

nmcli command (NetworkManager) to renew IP address in Linux

The nmcli is a command-line tool for controlling NetworkManager and getting its status. To renew IP address using nmcli for connection named ‘bobcares_5G’:

Linux Force dhclient to renew the IP address on a CentOS 7/Ubuntu/Debian and other Linux-based servers

Most modern Linux-based system uses the systemd as a init system and here is how to force Linux to renew IP address using DHCP. Use the IP command to find out the current IP address:

OR use the systemctl command to restart network service on a CentOS 7:

[Need Assistance? We are available 24*7]


In short, we saw the steps that our Support Engineers follow to force DHCP client to renew IP address


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

Читайте также:  Какие контакты заклеивать на принтере


How to renew or release a dynamic IP address in Linux

The DHCP client in Linux is called dhclient. It requests dynamic IP addresses from the DHCP server, which «leases» addresses to clients for a set amount of time. dhclient can be invoked manually to «release» the client’s currently assigned IP address, and get another address from the DHCP server.

Normally, dhclient produces no output, to see what it’s doing, we need to give it the -v (verbose) option. We need to run dhclient as root with the sudo command, because changing the system networking configuration requires escalated privileges.

Let’s start by running dhclient verbosely, without any other options. It should reach out and say «hello» to our DHCP server, which, in our example is home router.

The above output tells us that dhclient requested an address from the DHCP server (DHCPREQUEST). It sent this request from our wireless Internet interface (wlan0). The DHCP server responded with a simple acknowledgement of our request (DHCPACK). That’s because we already had an IP address assigned to us, so the DHCP server didn’t have anything to do. Note that the DHCP server also told us how long our dynamic IP address will last: 42516 seconds (about 12 hours from now, at which point it will be renewed automatically).

So let’s manually release our address with -r. Let’s keep the -v option in there so we can see what’s going on:

In the above example, the command tells the DHCP server to release the IP address.

On some variants of Linux or Unix, releasing your IP address this way may also inherently bring down your network interface. In this case, use your network manager to re-connect to your network. This process varies from OS to OS; if you’re not sure how to connect to your network, consult the documentation of your specific OS. If you’re using the X Window System, you can usually reconnect by clicking the network icon in your system tray, and selecting the Connect option.


How do I force Linux to reacquire a new IP address from the DHCP server?

The environment is Debian, although the answer will apply to all distributions.

6 Answers 6

You can also use this command:

Where interface is the device you want to get a new address for.

The -r flag forces dhclient to first release any leases you have, you can then use this command to request a new lease:

From man dhclient :

Either of the following should get it to renew.

I wouldn’t recommend running either over an SSH connection, although you’ll probably get away with the first one if it doesn’t come back with a new ip address.

Would comment p.campbell, but I have only 1 reputation and therefore cannot, first I review installed interfaces:

release IP from selected interface (e.g. eth0, eth1, enp1s0, sit0, wlan0. ):

request new IP from DHCP server (alert on error):

Ubuntu 16.04 LTS confirmed

If you’re using the dhcpcd tool then:

The first says to release and deconfigure the interface, and the second says to reload configuration and rebind the interface again.

If the MAC address of the interface isn’t changed, the DHCP server may assign it the same address when renewing. Therefore, a simple release and renew with dhclient may not acquire a new address. Change the MAC address and acquire a new IP address with the following commands. Don’t forget to write the original down if you need to revert back to it at a later time.


How to Release old IP or force Renew DHCP lease IP in Linux

Table of Contents

In this article, we will see how to release old IP or force renew DHCP lease IP in Linux. Dynamically allocated IP is an IP leased out from a DHCP server for a particular amount of time over a network. If you are using a lease IP then you always have to renew your ip before the lease period expires. Usually, when a lease reaches 50% of its validity time period, the DHCP client unicasts a DHCP Request message to the DHCP server to request lease renewal. The same can be forced manually through a dhcp client tool in Linux Systems.

What is DHCP

The Dynamic Host Configuration Protocol is a network management protocol used on Internet Protocol networks for automatically assigning IP addresses and other communication parameters to devices connected to the network using a client–server architecture.

Читайте также:  Panasonic kx 1500mb картридж

How to Release old IP or force Renew DHCP Lease IP in Linux

If you have any DHCP lease IP allocated to an interface which you want to release due to certain reasons then you always have the option to release it by using DHCP client tool called dhclient. For example, in my case I have two interfaces attached to my system — enp0s3 and enp0s8 .

To release the IP attached to both the above interfaces, we need to use sudo dhclient -r -v command. But sometimes what happens is that the IP does not get released as you can see below.

If we try to check again the IP got released or not using ip addr sh command then we can notice that nothing happened. The assigned IP did not got released.

If you try to release IP from specific interface by choosing the interface using sudo dhclient -r -v enp0s3 command then also you can notice that the IP did not got released. This is a very common scenario faced by lot of folks hence I purposefully chosen this one while trying to explain how to release the DHCP lease IP so that you will understand what needs to be done here.

command then you will notice that it is getting started every time you kill this process and the IP is not getting changed. To check the process ID of currently running dhclient program, you can use ps -ef | grep dhclient command as shown below.

In my case process ID(PID) is 2167 , so to kill this one we are using kill -9 2167 command as shown below.

Now if I try to check the process again, I can see that a new dhclient command is launched with process ID(PID) 2169 . So now you must be wondering how did this happen.

Well, this happened because the network interfaces are currently controlled by Network Manager. You can verify this on Debian/Ubuntu systems by checking one of the below netplan configuration file depending on Ubuntu installation you are currently having.

  • 01-netcfg.yaml
  • 01-network-manager-all.yaml
  • 50-cloud-init.yaml

You can check the running status of Network Manager by using sudo systemctl status NetworkManager command as shown below.

If you are also facing problems like above, then you can try below solutions that works for you.

Solution 1: Restart Network Manager

First solution you can try is that you can restart Network Manager by running sudo systemctl restart NetworkManager command as shown below.

Solution 2: Using nmcli command

If the first solution does not work then next you can try restarting your connection using nmcli command. Here you need to first check the current connection using nmcli con command as shown below.

Then first take down the connection for the interface where you need to renew the IP. In our case, let’s say we want to renew the IP of enp0s3 interface, then we need to run nmcli con down id «Wired Connection 1» command after releasing the IP as shown below.

Then bring up the connection using nmcli con up id «Wired connection 1» command as shown below.

Solution 3: Restart systemd-networkd

If second solution also did not worked out, then you can try restarting systemd-networkd once by using sudo systemctl restart systemd-networkd command as shown below.

After applying above solution, you can see that you will be able to release the IP as shown below.

You can verify the same by checking the status of ip assigned to network interfaces using ip addr sh command as shown below. From the output, you can see that none of the IP is assigned to both the interfaces — enp0s3 and enp0s8 . This confirms that IP release was successful.

Once the IP is released, you will be able to get the new ip by running sudo dhclient -v command as shown below.


Release and Renew IP Address (2022 Tutorial)

Release and Renew IP address to repair connectivity issues

Release/Renew IP address is an operation that will help you to fix different connection issues. In Windows, you can do this action through the command prompt, while MacOS offers a graphical interface for this operation. Wiping out the old IP address can easily fix the connection problems. The first command for Windows that will be explained in the text – ipconfig /release – will force the system to forget your “old” IP and mark it as vacant on the DHCP server. The second one – ipconfig /renew – asks the DHCP server for a new IP for your device.

“Any workarounds to logging into Fortnite right now? Been trying non-stop, but haven’t been able to login since the event. Still really looking forward to trying out those lightsabers!!”, — writes Twitter user @NickEh30.

These commands are used widely for fixing the networking issues since they are working despite all changes in Windows done since Windows XP was released.

Читайте также:  Hp струйные принтеры ресурс картриджа страниц

Release/Renew IP commands are usually finalized by the Flush DNS command, which releases the DNS cache and submits requests to apply new IP address data.

Refer to the tutorial below for releasing and renewing the IP address on Windows 10, 8, 8.1, 7, Vista, XP, Mac, and Linux. Also, be sure that your network adapter is tuned correctly to obtain an IP address automatically. Otherwise, the above-said commands won’t function well.

It is better to prevent, than repair and repent!

Subscribe to our Telegram channel to be the first to know about news and our exclusive materials on information security.

Guidelines to Release and Renew IP Address on Windows, Mac, Linux

Windows 10, 8.1 and 8

For releasing and renewing the IP address on Windows 10, 8.1 or 8, refer to the steps reviewed below.

  1. In Windows 10, 8 or 8.1, apply Windows search to locate Command Prompt.
  2. Right-click on Command Prompt and choose Run as Administrator mode.
  3. In User Account Control alert, select Yes.
  4. In CMD, type ipconfig /release and hit Enter.
  5. Then, specify ipconfig /renew and hit Enter.
  6. Take time until the DHCP server sets a new IP address to you.

Windows 7 and Vista

Refer to these steps to apply ipconfig /release and ipconfig/renew commands on Windows 7 or Vista.

  1. Click on Windows menu, then specify cmd in Windows search bar.
  2. Right-click the Command Prompt option and select Run as Administrator via the menu.
  3. In User Account Window, select Yes.
  4. Then, specify the following command in the Command Prompt: ipconfig /release and hit Enter.
  5. Indicate ipconfig /renew and hit Enter.

Mac OS

  1. Refer to the Apple logo in the top-left area of the display and choose System Preferences.
  2. Proceed to Network.
  3. In the left section, choose Wi-Fi or Ethernet (based on which one you use by default). Next, choose Advanced… button on the right part of the Network menu.
  4. Choose TCP/IP tab. At this point, you will notice that Configure IPv4 is tuned to Using DHCP. Choose the Renew DHCP Lease button.
  5. Take time until you encounter an amendment in IPv4 address. The procedure is completed now.


The tutorial below gives an equivalent of ipconfig /release and ipconfig /renew commands on Linux. Refer to these steps to force DHCP Client to Renew IP Address.

  1. Use the CTRL+ALT+T hotkey command to start the Terminal on Linux.
  2. In Terminal, specify sudo dhclient – r and hit Enter for releasing the present IP.
  3. Next, specify sudo dhclient and hit Enter to obtain a new IP address via the DHCP server.

Helpful DNS Resolver Commands for Windows

A part from the Renew and Release IP commands, you might decide or have to apply some of the commands set forth below.

  • ipconfig /flushdns. This command aids in clearing the DNS Resolver cache so that the new IP data would be delivered right away.
  • ipconfig /registerdns. This command refreshes all DHCP leases and assigns DNS names initially.
  • ipconfig /displaydns. Displays present contents located in DNS Resolver Cache.

Repair IPconfig release renew not functioning

IPConfig /Release and /Renew commands functions only when your network adapter is tuned to obtain the IP address automatically. To say it in a different manner, you ought to have DHCP activated. You can set these parameters by means of Windows Network and Sharing Center.

  1. Proceed to Network and Sharing Center, then choose Change adapter settings.
  2. Right-click your network adapter and select Properties.
  3. Locate Internet Protocol Version 4 ( TCP /IPv4) and select Properties.
  4. Choose Obtain IP Address automatically and hit OK for confirmation.


Поделиться с друзьями