JM (Jason Meridth)

I am a continuously learning software developer trying to not let best be the enemy of better.

Renew DHCP Lease on Ubuntu VM After Moving Between Wireless Networks

05 Feb 2013 » » ubuntu, networking, wireless


sudo dhclient -r [eth0] && sudo dhclient [eth0]

I add that command as an alias to my ~/.bashrc file

alias resetdhcp='sudo dhclient -r eth0 && sudo dhclient eth0'

then resourced it so I could use it in the bash session I was in

source ~/.bashrc

I constantly have my Ubuntu VM (VirtualBox) running on my Windows laptop and dock/undock it between work and home. Obviously those are two different wireless networks. Well, I was unable to find a dhcp renewal command that would work until today (look above).

This command releases and renews your DHCP IP Address.

I’m very happy about this.

dhclient man page

When run by itself, your instance will seek out a new ip lease.