38

I wanted to update the DHCP lease of an Amazon EC2 instance, so I executed the following command:

user@host:~$ sudo dhclient

Following that, the system's DHCP lease is updated successfully updated. However, the command prints the following to the console:

RTNETLINK answers: File exists

What on earth does that mean? Is it a cause for concern?

For what it's worth, dhclient returned without any errors:

user@host:~$ echo $?
0
5
  • 1
  • 2
    The user in the post you reference gets the error Failed to bring up wlan0. I don't get any output besides RTNETLINK answers: File exists.
    – AlfaZulu
    Jun 3, 2014 at 13:23
  • yes and its the same reason why you get it. adding a route which is already in the table. simple test: disable your interface, enable your interface. first time dhclient run the message will not appear. just confirmed this locally on a debian system. Jun 3, 2014 at 13:29
  • This machine is an Amazon EC2 instance, I can't take down the interface for obvious reasons. I guess my question basically is, what is the right way to renew my DHCP leases given that I can't up/down my interfaces?
    – AlfaZulu
    Jun 3, 2014 at 13:32
  • then this might answers your "new" question: askubuntu.com/questions/151958/… if thats not "enough you can remove the old lease within /var/lib/dhcp/dhclient.leases (might be slightly different location on EC2) dhclient -r Jun 3, 2014 at 13:40

2 Answers 2

31

Basically what happens is that dhclient adds a route to the routing table.

It tries this while the route is already in the table.

Check

ip route

for a route which was added by the dhcp server.

For having the lease renewed do

dhclient -r

if thats not enough you can remove all leases by removing the file and getting a new lease

sudo rm /var/lib/dhcp/dhclient.leases; sudo dhclient eth0

Depending on your exact setup this might be an issue with having to type your password twice, so watch out for that.

3
  • 1
    Ah, I executed ip route and spotted the extra route it added. This all started because I wanted to renew DHCP client leases after having made changes to the DHCP server. The problem is I can't up/down my interfaces because the machine is an EC2 instance. Also, I want to avoid restarting the system. So how can I simply update my DHCP client leases without any unwanted side effects?
    – AlfaZulu
    Jun 3, 2014 at 13:41
  • 1
    @AlfaZulu added some info which should help your issue. Basically even on a remote system you can up/down the interfaces if you "chain command" it, but its prone to fail if you cannot test it properly so do not do this :) Jun 3, 2014 at 13:46
  • 1
    You might want to combine it with dhclient right after, e.g. dhclient -r; dhclient to make sure you don't lose connection to the machine if using it remotely
    – Wadih M.
    Nov 28, 2022 at 17:38
0

See I saw a lot of answers none of them see to work .. But here is how it can be done. See the router looks at the MAC address and assigns the same IP address every time. ...To change MAC address of the Wireless adapter ==> sudo ifconfig wlan0 down ==> sudo macchanger -r wlan0 ==> sudo ifconfig wlan0 up ==> dhclient -r wlan0 ==> dhclient -v wlan0

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    May 20, 2022 at 9:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .