Releasing And Renewing Your IP Address In Ubuntu

With Ubuntu it is important (as it is in XP) to know certain network command functions. When most people have a problem with their router, cablemodem or DSL modem, they simply reboot the computer to renew the IP address. You do not have to do this. Instead you can simply shut down the network interface and restart it.

ifconfig

ifconfig is the command used in Ubuntu at the command line (better known as the terminal in GNOME) to not only find out what your IP address is, but also to disable/enable network interfaces if need be.

To see your current IP, just type ifconfig and press enter. You will see a list of network interfaces. On a wired connection, the first (and probably only) network card listed is usually eth0 (that’s a zero at the end, not letter O).

We’ll say for the moment your router had a screw-up and you had to restart it, so you need your computer to request its IP address back.

Releasing (down) and Renewing (up)

The release/renew commands from ifconfig are simply down and up.

We put a sudo in front of ifconfig to grant administrator privileges, and it all comes together like this:

sudo ifconfig eth0 down (shuts down the eth0 interface, releases the IP)

sudo ifconfig eth0 up (enables the eth0 interface, renews the IP)

And yes, you do have to use sudo both times.

Why know this? It saves time. Downing the network interface and "upping" it again is quicker than a reboot – especially for those of you out there with not-so good routers.

Comments

  1. You can also do it with one command:

    sudo /etc/init.d/networking restart

    This will restart the network using the values in /etc/network/interfaces

  2. Debianero Rumbero says:

    I don’t know in Ubuntu but in Debian you can use ifup and ifdown commands.

  3. How about “dhclient wlan0″ or “dhclient eth0″.

  4. Make sure that you verify your IP on a site like http://www.ip-adress.com

    Sometimes there are problems with the renew procedure.

  5. Thank you. Solved my internetz

Leave a Reply