Linux Force DHCP Client (dhclient) to Renew IP Address

I am using Ubuntu Linux. How to force Linux to reacquire a new IP address from the DHCP server? What is the command of Linux equivalent to Windows’s “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.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux with a terminal app
Est. reading time 3 minutes

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

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

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

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:
ip a
ip a s eth0

dhclient -v -r eth0
OR use the systemctl command to restart network service on a CentOS 7:
systemctl restart network.service
systemctl status network.service

Linux Force DHCP Client to renew IP address


Linux force DHCP client to release and renew an IP address

Command Command to release/renew a DHCP IP address in Linux
ip a Get ip address and interface information on Linux
ip a s eth0 Find the current ip address for the eth0 interface in Linux
Method #1
dhclient -v -r eth0 Force Linux to renew IP address using a DHCP for eth0 interface
Method #2
systemctl restart network.service Restart networking service and obtain a new IP address via DHCP on Ubuntu/Debian Linux
systemctl restart networking.service Restart networking service and obtain a new IP address via DHCP on a CentOS/RHEL/Fedora Linux
Method #3
nmcli con Use NetworkManager to obtain info about Linux IP address and interfaces
nmcli con down id 'enp6s0' Take down Linux interface enp6s0 and release IP address in Linux
nmcli con up id 'enp6s0' Obtian a new IP address for Linux interface enp6s0 and release IP address using DHCP
  • Man pages: dhclient(8)

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 40 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
40 comments… add one
  • Rajesh Jun 14, 2008 @ 6:15

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

    Great work


  • synick Nov 27, 2008 @ 7:10


    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 Jun 22, 2009 @ 2:13

    Thanks so much! it’s work ^^

  • anon Jul 8, 2009 @ 1:21


  • Thamizhannal Aug 7, 2009 @ 7:24

    This command worked me..thanks a lot

  • David Balažic Sep 1, 2009 @ 17:52

    This does not work on Ubuntu 9.04

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

  • Schmid Hans-Peter Oct 7, 2009 @ 15:19

    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 Oct 7, 2009 @ 22:35

    Nope. After sudo dhclient -r the interface still has the IP address. See details:

    • me Sep 15, 2013 @ 21:05

      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 Nov 23, 2009 @ 5:56

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


  • Eduardo Calvillo Feb 1, 2010 @ 19:35

    Thank you for the recommendation, it works good.

  • Flyte Feb 18, 2010 @ 2:27

    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


  • jeffory Nov 17, 2010 @ 4:17

    @ David Balažic

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

  • Christian Jan 19, 2011 @ 18:45

    Thank for your solution, really help me.

  • jamkomo Feb 4, 2011 @ 3:06

    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 Oct 30, 2011 @ 18:15

      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 Oct 2, 2012 @ 16:33

        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. Nov 8, 2012 @ 19:22

          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 Feb 19, 2011 @ 16:45

    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 Mar 19, 2011 @ 19:14

    More detail, about this not working on Ubuntu:
    sudo dhclient -r -pf /var/run/ -lf /var/lib/dhcp3/ 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

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

  • David Balažic Mar 19, 2011 @ 19:16

    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 Apr 5, 2011 @ 12:42

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

  • Danilo Sep 7, 2011 @ 22:21

    Just what i needed!

  • Helio Mar 14, 2012 @ 20:15

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

  • Anon Apr 9, 2012 @ 21:36

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

    • David Jan 28, 2016 @ 4:18


    • amit Nov 29, 2016 @ 7:08


  • codvali Apr 27, 2012 @ 8:10

    Thank for your solution, really help me.

  • Leox Jul 2, 2012 @ 16:13

    Thank guy!

  • David Jul 13, 2012 @ 16:05

    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 Jul 26, 2012 @ 0:27

    How do you open up the terminal

  • Andrew P. Nov 8, 2012 @ 19:30

    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 Apr 7, 2013 @ 11:57

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

  • Warning Jul 22, 2013 @ 20:05

    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 Oct 2, 2013 @ 21:10

    ifconfig eth0 down
    ifconfig eth0 up

    assuming you’re working with your ethernet adapter0

  • Kuldeep Kulkarni Nov 5, 2015 @ 12:18

    It worked! Thanks.

  • Harry Dec 9, 2015 @ 5:24

    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 Apr 13, 2016 @ 9:34

    Very informative!

  • LOKENDRA RATHOUR Sep 12, 2016 @ 5:13

    VERY HELPFULL , thanks for the inputs ,
    my vm was not taking the IP i just have to run two commands shared above
    sudo dhclient -r
    $ sudo dhclient

    thank you

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum