1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

display current wan ip

Discussion in 'Tomato Firmware' started by petm, Feb 16, 2011.

  1. petm

    petm Networkin' Nut Member

    hi. to renew my ip (in order to circumvent certain bandwidth limitations) i run this script via plink on my tomato WRT54GL:


    nvram get wan_ipaddr
    service wan restart
    nvram get wan_ipaddr


    the problem is that it doesnt show the new ip but the old one twice. it seems that nvram update is a bit delayed.
    is there another way to get that ip, without asking the nvram? or how else would you solve this issue?
     
  2. rhester72

    rhester72 Network Guru Member

    ifconfig `nvram get wan_iface` | grep "inet addr" | awk '{print $2}' | cut -d: -f2

    Rodney
     
  3. petm

    petm Networkin' Nut Member

    thanks for the reply.

    what an impressive list of parameters. what exactly does that do? it shows the ip correctly if run just like that, but in my scenario it says

    ifconfig: ppp0: error fetching interface information: Device not found
     
  4. shibby20

    shibby20 Network Guru Member

    have you connect WAN in this moment? i have pppoe connection type and
    show my current ip correct.
     
  5. petm

    petm Networkin' Nut Member

    as i said, just plain calling it works.
    but i am looking for a solution to show ip, restart wan (to obtain new ip) and then show new ip.

    it seems like "service wan restart" displays its 'done' a bit too early, because nvram still holds the old ip while ifconfig says
    ifconfig: ppp0: error fetching interface information: Device not found

    any ideas on that?
     
  6. Toastman

    Toastman Super Moderator Staff Member Member

    If you think it's too early, add a delay - "sleep 10" or similar might do the trick.
     

Share This Page