Releasing And Renewing Your IP Address In Ubuntu

Posted March 18, 2009 5:18 am by with 5 comments

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.

5 responses to Releasing And Renewing Your IP Address In Ubuntu

  1. Floyd Bufkin March 18th, 2009 at 11:21 am

    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

        Reply

  2. Debianero Rumbero March 19th, 2009 at 12:27 am

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

        Reply

  3. srhegde March 19th, 2009 at 7:27 am

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

        Reply

  4. megario March 22nd, 2009 at 5:54 pm

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

    Sometimes there are problems with the renew procedure.

        Reply

  5. Borgulas October 1st, 2010 at 8:16 am

    Thank you. Solved my internetz

        Reply

Leave a Reply