Friday, February 1, 2013

[Ubuntu] How to release/renew IP when dhclient doesn't work.

I have encountered a very weird issue with Ubuntu 12.10 wireless networking where dhclient -r and dhclient cannot work as expected. The wireless device lock to the same IP, and unable to connect to internet or any other shared resources in the network.

Any other methods such as:
  1. Delete the profile in network manager
  2. restart networking service
  3. ifdown and ifup the interface
  4. Manually set IP address & DNS server
  5. Restart the router
Do not work as well. So what's the real fix for this problem? If you ever encounter the same problem as I did, you might try delete all the DHCP lease file located in /var/lib/dhcp/. New one will be generated automatically. Here's how my DHCP folder look alike:


If delete doesn't work for you, give me five because we are having the same issue. When I open the folder, there are multiple files inside, I deleted all (make sure you have turn off you wireless device before doing so) and let the system generates a new one.

After that, open up the new files with root privilege leafpad (or any other text editor), you will see the following:
 lease {  
  interface "eth1";  
  fixed-address 192.168.1.122;  
  option subnet-mask 255.255.255.0;  
  option routers 192.168.1.1;  
  option dhcp-lease-time 50400;  
  option dhcp-message-type 5;  
  option domain-name-servers 202.188.0.133,202.188.1.5;  
  option dhcp-server-identifier 192.168.1.1;  
  option dhcp-renewal-time 25200;  
  option dhcp-rebinding-time 44100;  
  renew 5 2013/02/01 22:24:39;  
  rebind 6 2013/02/02 04:55:53;  
  expire 6 2013/02/02 06:40:53;  
 }  
It's very simple here, modify the 10.0.0.122 192.168.1.122 (Updated: 25 Nov 2014) to some other available IP address, save it and turn on your wireless device. Wait for a few seconds and voila!

Most probably you are now able to online and start surfing. And if this does help, please leave me a comment so at least I know my blog help others. Cheers~!

3 comments:

  1. Your instruction to "modify the 10.0.0.122 to some other available IP address" doesn't make sense as I do not see 10.0.0.122 in your example. Please clarify

    ReplyDelete
    Replies
    1. Thanks for pointing out. You're right, the lease file is the one I've changed so it did not show the missing 10.0.0.122. Will amend now.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete