Q. 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?
A. 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.
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
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
# /etc/init.d/network restart
OR
# /etc/init.d/networking restart
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 21 comments… read them below or add one }
Resolution provided was short but very effective.
Helped me to resolve the issue.
Great work
Thanks
Rajesh
Hi,
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!
Thanks so much! it’s work ^^
Thanks!
This command worked me..thanks a lot
This does not work on Ubuntu 9.04
It seems that network manager runs it own copy of dhclient.
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
Nope. After sudo dhclient -r the interface still has the IP address. See details: http://pastebin.com/f8d2a4e2
Dear sir
Please Help Me
How t o Assign IP Address For DHCP Client Linux..
Thanks
Thank you for the recommendation, it works good.
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; dhclientIf 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 :)
briliant!
@ David Balažic
It wasn’t working for me for me with Ubuntu 10.04…[continued if this posts]
Thank for your solution, really help me.
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?
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.
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.
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 )
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)
Fantastic! Worked like a charm on Ubuntu 10.10! Thanx!
Just what i needed!