33

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
AlfaZulu
  • 545
  • 1
  • 5
  • 9
  • 1
    duplicate of http://serverfault.com/questions/403969/failed-to-bring-up-wlan0 – Dennis Nolte Jun 03 '14 at 13:21
  • 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 03 '14 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. – Dennis Nolte Jun 03 '14 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 03 '14 at 13:32
  • then this might answers your "new" question: http://askubuntu.com/questions/151958/how-to-make-dhclient-forget-its-last-dhcp-lease 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 – Dennis Nolte Jun 03 '14 at 13:40

2 Answers2

27

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.

Dennis Nolte
  • 2,848
  • 4
  • 26
  • 36
  • 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 03 '14 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 :) – Dennis Nolte Jun 03 '14 at 13:46
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

  • 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](/help/how-to-answer). – Community May 20 '22 at 09:25