Linux Force DHCP client (dhclient) to renew ip address

by Vivek Gite · 10 comments

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:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 10 comments… read them below or add one }

1 Rajesh 06.14.08 at 6:15 am

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

Great work

Thanks
Rajesh

2 synick 11.27.08 at 7:10 am

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!

3 thehuyvb 06.22.09 at 2:13 am

Thanks so much! it’s work ^^

4 anon 07.08.09 at 1:21 am

Thanks!

5 Thamizhannal 08.07.09 at 7:24 am

This command worked me..thanks a lot

6 David Balažic 09.01.09 at 5:52 pm

This does not work on Ubuntu 9.04

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

7 Schmid Hans-Peter 10.07.09 at 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

8 David Balažic 10.07.09 at 10:35 pm

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

9 How to Assign IP Address In DHCP in Linux 11.23.09 at 5:56 am

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

Thanks

10 Eduardo Calvillo 02.01.10 at 7:35 pm

Thank you for the recommendation, it works good.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All