≡ Menu

Linux Force DHCP Client (dhclient) to Renew IP Address

I‘m using Ubuntu Linux. How to force Linux to reacquire a new IP address from the DHCP server? What is the command in Linux equivalent to Windows’ “ipconfig /renew” command?

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

The -r flag explicitly releases the current lease, and once the lease has been released, the client exits. For example, open terminal and type the command:
$ sudo dhclient -r
Now obtain fresh IP:
$ sudo dhclient

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

Sample outputs:

Fig.01: Renew DHCP address example

Fig.01: Renew DHCP address example

The -v option shows information on screen about dhcp server and obtained lease.

Other options in Linux to renew dhcp

There is no need to restart network service. Above command should work with any Linux distro such as RHEL, Fedora, CentOS, Ubuntu and others. On a related note you can also try out the following commands:
# ifdown eth0
# ifup eth0
### RHEL/CentOS/Fedora specific command ###
# /etc/init.d/network restart

### Debian / Ubuntu Linux specific command ###
# /etc/init.d/networking restart

nmcli command (NetworkManager) to renew IP address in Linux

The NetworkManager daemon attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices command-line tool for controlling NetworkManager. The nmcli is a command-line tool for controlling NetworkManager and getting its status. To renew IP address using nmcli for connection named ‘nixcraft_5G’ (use ‘nmcli con‘ command to get list of all connections):

nmcli con
nmcli con down id 'nixcraft_5G'
nmcli con up id 'nixcraft_5G'

Sample outputs:

Fig.02: nmcli command in action

Fig.02: nmcli command in action

See also
Share this tutorial on:
{ 38 comments… add one }
  • Rajesh June 14, 2008, 6:15 am

    Resolution provided was short but very effective.
    Helped me to resolve the issue.

    Great work


  • synick November 27, 2008, 7:10 am


    This worked great, I was having a bit of problems thought worked them out in the end, thought I would share.

    I unplugged the network cable, then plugged back in a couple minutes later. Couldn’t access network, tried dhclient -r command and didn’t work. Found that dhcpcd was still running, so done a killall -9 dhcpcd then executed dhclient…worked!

  • thehuyvb June 22, 2009, 2:13 am

    Thanks so much! it’s work ^^

  • anon July 8, 2009, 1:21 am


  • Thamizhannal August 7, 2009, 7:24 am

    This command worked me..thanks a lot

  • David Balažic September 1, 2009, 5:52 pm

    This does not work on Ubuntu 9.04

    It seems that network manager runs it own copy of dhclient.

  • Schmid Hans-Peter October 7, 2009, 3:19 pm

    Works for me on Ubuntu 9.04. It seems to me, that the network-manager does not notice the change. After sudo dhclient -r the command ifconfig eth0 shows no ip address at the interface. After sudo dhclient the command ifconfig eth0 shows an ip address again.

    Thank you

  • David Balažic October 7, 2009, 10:35 pm

    Nope. After sudo dhclient -r the interface still has the IP address. See details: http://pastebin.com/f8d2a4e2

    • me September 15, 2013, 9:05 pm

      Sure it has, depending on your dhcp server configuration. You can define how long one IP will be served to the same MAC address. Since you did not “change” your MAC address, the dhcp server might give you the same ip.

  • How to Assign IP Address In DHCP in Linux November 23, 2009, 5:56 am

    Dear sir
    Please Help Me
    How t o Assign IP Address For DHCP Client Linux..


  • Eduardo Calvillo February 1, 2010, 7:35 pm

    Thank you for the recommendation, it works good.

  • Flyte February 18, 2010, 2:27 am

    I set up static DHCP assignments and then needed to switch my server over to DHCP. To do this remotely I simply put the two commands on a single line:

    dhclient -r; dhclient

    If you’ve set up the static DHCP to use the IP address that you’ve already given it then you shouldn’t become disconnected from your SSH session :)

  • PCG May 27, 2010, 9:22 am


  • jeffory November 17, 2010, 4:17 am

    @ David Balažic

    It wasn’t working for me for me with Ubuntu 10.04…[continued if this posts]

  • Christian January 19, 2011, 6:45 pm

    Thank for your solution, really help me.

  • jamkomo February 4, 2011, 3:06 am

    Well, it releases them, but when I renew it, it gives me the same ip back. I wanted a new IP. Is there way to force a NEW one?

    • Philip October 30, 2011, 6:15 pm

      You need to tell the dhcp server to issue a different one, typically I dhcp server will if it can issue the same address.

      You may be able to tell it to forget what it last issued, or you can usually make a mapping between the mac address of your nic and the ip you want, but generally unless you do something on the server it wil reissue the same address.

      • Dale October 2, 2012, 4:33 pm

        Usually a DHCP server maintains a list of the leases by assigned IP and the MAC (unique identifier) of the device who has the lease.

        If you don’t have access to the DHCP server in question, then the simplest way to get a new IP would be to change your device’s MAC somehow, as a DHCP server will usually give you your IP back since its still leased to you.

        If you have access to the server than you can simply delete the entry, however, if its the first IP unassiged on the list, you’ll get it again unless another device takes it or if you exlude the IP address.

        Hope this helps.

        • Andrew P. November 8, 2012, 7:22 pm

          With some wireless routers and network modems it is possible to assign a “soft” MAC address that is different from the actual hardware MAC address. This information is usually stored in nonvolatile Flash memory, so it will survive a power-down and restart of the device. The pool of MAC addresses is finite, and there’s a slim chance if you just make one up, you could duplicate another one somewhere on the network. The best way to avoid it is rummage through your junk pile for an old network interface card (NIC) or cast-off computer with built-in NIC and “borrow” its MAC address. Blocks of MAC addresses are assigned by manufacturer and a given manufacturer normally won’t use the same MAC address twice. (However, I ran across a post within the last year by a network administrator who discovered to his horror that ALL the cheap NICs his organization had bought, made by some nameless ChiCom manufacturer, used the same identical MAC address, so confusion reigned on his organization’s intranet and nothing worked! All the NICs had to be scrapped and replaced.)

  • Mike Bethany February 19, 2011, 4:45 pm

    If you’re having problems getting your Linux distro to get a new IP the easiest thing to do is to just reboot your router (assuming you can do that). If that doesn’t work you can add the old address as a statically assigned DHCP address to a bogus MAC address. This will lock the Linux box out of it’s old address and force it to get the new address.

  • David Balažic March 19, 2011, 7:14 pm

    More detail, about this not working on Ubuntu:
    sudo dhclient -r -pf /var/run/dhclient-eth1.pid -lf /var/lib/dhcp3/dhclient-eth1.lease eth1

    This kill the running dhcp daemon which is noticed by Network Manager which then immediately downs the interface, so the dhclient can not send the DHCPRELEASE packet.

    The solution is to disable NM (right clik on its icon and uncheck the first option “Enable Netwroking” – this is so on Ubuntu 10.10, other version might look a bit different), kill existing dhclient processes, then establish the connection manually, run dhclient eth0 , then run the above dhclient command to release the IP.

    For connection to WPA protected WLAN networks follow the description on http://linux.icydog.net/wpa.php

    (In windows this is justa matter of running “ipconfig /release wirelless*” :P )

  • David Balažic March 19, 2011, 7:16 pm

    Oh, webmaster please fix the typos in my previous post… :-)
    (for network device names, use the same one of course, above I used ince eth0, then eth1)

  • kOz April 5, 2011, 12:42 pm

    Fantastic! Worked like a charm on Ubuntu 10.10! Thanx!

  • Danilo September 7, 2011, 10:21 pm

    Just what i needed!

  • Helio March 14, 2012, 8:15 pm

    Hey, is there anyway to do this command at system start?

  • Anon April 9, 2012, 9:36 pm

    After typing sudo dhclient -r, I lost my SSH connection…

    • David January 28, 2016, 4:18 am


  • codvali April 27, 2012, 8:10 am

    Thank for your solution, really help me.

  • Leox July 2, 2012, 4:13 pm

    Thank guy!

  • David July 13, 2012, 4:05 pm

    I have Ubuntu 12.04 and dhclient did not work. I simply used ‘sudo ifconfig eth0 down’ then ‘sudo ifconfig eth0 up’. Worked for me.

    [Good old ‘ifconfig’, didn’t think I would still be using it but there you go. CLI rules]

  • Kato July 26, 2012, 12:27 am

    How do you open up the terminal

  • Andrew P. November 8, 2012, 7:30 pm

    It should be noted that the methods discussed in this post may enable one to get a new IP address lease for one’s computer or workstation, but if the computer is connected to a wide-area network (WAN) through a DSL modem or cable modem with its own built-in DHCP server, this will not necessarily result in a new IP address as seen by the outside world. Unless one has a way to remotely take control of the modem and cause it to issue a request to the Internet service provider’s DHCP server for a new IP address, one will still have the same address until the IP lease expires or until one physically disconnects the modem from the WAN, waits a while, then reconnects in the hope that the ISP’s DHCP sees it as a “new” connection.

  • Rizal Rahman April 7, 2013, 11:57 am

    i usually try this command : sudo dhclient (interface name) -> sudo dhclient eth0

  • Warning July 22, 2013, 8:05 pm

    WARNING: On Ubuntu 12.04 and on my most recent Raspbian the command
    sudo dhclient
    does NOT renew the IP-Address! You must specify the interface!

    If you want to get a new IP-Address for eth0, then type
    sudo dhclient eth0
    It is not necessary to run “sudo dhclient -r” in advance. If you are using an SSH-connection and run “sudo dhclient -r”, you will lose the connection to your server and you will not be able to reconnect.
    @NIXCRAFT: please add this information to your post!

  • pepe October 2, 2013, 9:10 pm

    ifconfig eth0 down
    ifconfig eth0 up

    assuming you’re working with your ethernet adapter0

  • Kuldeep Kulkarni November 5, 2015, 12:18 pm

    It worked! Thanks.


  • Harry December 9, 2015, 5:24 am

    I have a habit of resetting my router before I go to sleep. Occasionally this means that I reset while the VPN is on, then turn off my computer. The result is that the connection no longer works without the VPN.

    In the past, I’ve fixed it by fiddling around with restarting my computer, resetting my router, and variations of that with the VPN on, or off, or on for part of the process, etc.

    This is a much easier way to fix it.

  • user1 April 13, 2016, 9:34 am

    Very informative!

Leave a Comment

   Tagged with: , , , , , , ,