Results 1 to 6 of 6

Thread: Renew the IP-adress from Terminal

  1. #1
    Join Date
    Jun 2010
    Location
    Nacka, Sweden
    Beans
    74
    Distro
    Ubuntu 13.04 Raring Ringtail

    Renew the IP-adress from Terminal

    Hello everyone,

    Thank you for looking into my thread.

    I have a problem with my router. The router is a Thomson TG789vn from my ISP. It is something funky with the WiFi. With Windows I use these two commands in the command prompt.
    Code:
    ipconfig /release ENTER
    ipconfig /renew Enter
    exit ENTER (because writing exit is so much more cool then clicking on the X :))
    Well, yes, I can troubleshot the router but it works most of the time so it is quite far down on my to-do-list.

    In Linux Ubuntu I know I should use the
    Code:
    ifconfig
    command, but my two favorite is not working, the release and renew. I know, it is a shot-gun method, but it works.

    So, I look around. Googled it. But I got mostly "my WiFi not working" or "Ubuntu is not seeing my WiFi". Nothing on my favorite method.

    Anyone have any idea of a shot-gun method of releasing IP-addresses and then renewing them in Ubuntu?

    Kind regards
    Leopold
    In search of knowledge
    Winky

  2. #2
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,079
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Renew the IP-adress from Terminal

    I think the command you are looking for is dhclient. Something like:
    Code:
    sudo dhclient -r wlan0
    sudo dhclient wlan0

  3. #3
    Join Date
    Feb 2009
    Location
    Cymru (Wales)
    Beans
    58
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Renew the IP-adress from Terminal

    Dunno if it helps, but the equivalent command in Linux for the Windows ipconfig is ifconfig. Try

    $> info ifconfig

  4. #4
    Join Date
    Jun 2010
    Location
    Nacka, Sweden
    Beans
    74
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Renew the IP-adress from Terminal

    These two commands are the beginning of the mystery of renewing IP-addresses in Ubuntu
    Code:
    sudo dhclient
    and
    Code:
    ifconfig
    . Onto more searching I found an interesting article. Unfortunately, it was from 2008 and thus outdated and caused my 13.04 to crash. So I won't be posting that as a solution.

    Another maybe solution was
    Code:
    ifconfig down ENTER 
    ifconfig up ENTER
    and
    Code:
    sudo ifconfig down ENTER 
    sudo ifconfig up ENTER
    but when entering the
    Code:
    ifconfig wlan0
    I still got the same IP-address. But at least I am making progress thanks to a wonderful community.
    Last edited by leopoldbirkholm; July 16th, 2013 at 09:37 AM. Reason: Grammatical errors.
    In search of knowledge
    Winky

  5. #5
    Join Date
    Mar 2010
    Location
    India
    Beans
    8,136

    Re: Renew the IP-adress from Terminal

    DHCP assigned IPs are leased for a definite amount of time. The ifconfig up/down or ifup/ifdown commands just disable or enable the interface, and get the same address again if the lease is not expired yet (and not taken by another device yet).

    The dhclient commands that The Cog suggested, explicitly requests for a new IP, so that's what you want.For details on this command, use -
    Code:
    man dhclient
    ..in terminal.
    • The 'man <some command>' is the best way to find details on the usage of a command (other than looking up internet, which is often even better).
    • For short description of usage, use - "<command> --help".
    • To get a list of possible commands for a task, use "apropos <keyword>". For example - "apropos network".



    PS:
    By the way, the correct usage of those ifconfig commands is - "sudo ifconfig <interface name> <action>". For example, for interface wlan0 -
    Code:
    sudo ifconfig wlan0 down
    sudo ifconfig wlan0 up
    Last edited by varunendra; July 16th, 2013 at 09:11 PM.
    Varun
    Help others by marking threads as [SOLVED], if they are. (See how)
    Wireless Script | Use Code Tags

  6. #6
    Join Date
    Sep 2012
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Renew the IP-adress from Terminal

    Quote Originally Posted by varunendra View Post
    DHCP assigned IPs are leased for a definite amount of time. The ifconfig up/down or ifup/ifdown commands just disable or enable the interface, and get the same address again if the lease is not expired yet (and not taken by another device yet).
    Not only is this statement true most decent DHCP servers will try to assign the same IP to a given device each time it connects. It's not guaranteed because there is a limited pool of IP addresses available but where its possible preserving connections makes things easier.

    It's normal even if you turn your computer off for several hours that you will get the same IP next time you turn back on even if the DHCP time-out has expired. At least in situations where you have relatively few devices.

    In a public place such as a university library however where lots of devices are connecting for relatively short periods of time however this is probably not true.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •