I am using modern versions of Ubuntu that use network-manager, and I would like release and renew my network settings through the commandline.
In the olden days when Ubuntu used the interfaces
file, I would simply do:
sudo /etc/init.d/networking restart
but now that no longer works.
I am looking for functionality similar to Windows' ipconfig /release
and ipconfig /renew
.
How can I release and renew network settings from the commandline interface?
To release and renew the IP address it is:
Or you can try a one-liner that grabs the default ethernet name from
netstat
(using -v switch to show verbose):From the
dhclient
manpage:Example:
Hope this helps!
One way to accomplish this is to tell network-manager to briefly disconnect the device and the connecting it again:
(replace
wlan0
with the correct device name on your system)