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

Automated script to email out my DHCP WAN port IP?

Discussion in 'Sveasoft Firmware' started by Mael, Jul 28, 2005.

  1. Mael

    Mael Guest

    I'm currently a cable customer with a dynamic IP address. I wanted to know if there was any way I could run a script that would email out what my current dynamic address is twice /day? I'm pretty sure I could set up the cron job, I just don't know if the WRT54G could run such a script, or how to write it. Any help would be appreciated.

    WRT54G running Alchemy-V1.0 v3.37.6.8sv
     
  2. Ofloo

    Ofloo Network Guru Member

    doesn't the WRT54G have snmp?? if so use snmpget check with MIB u need by using snmpwalk
     
  3. _Shorty

    _Shorty Network Guru Member

    well, if it were able to send email you'd just need something like this:

    ifconfig | mail you@isp.com

    but I don't think the router can email anything. Any reason you can't run a dyndns client on one of the machines behind the router using the webcheck method? Then your dyndns domain would always point to your current IP.
     
  4. redlynx

    redlynx Network Guru Member

    is there any reason you can't run DDNS on your WRT54G router?
     
  5. _Shorty

    _Shorty Network Guru Member

    because the dyndns support on the router doesn't work properly? There's a reason I asked about running a dyndns client on one of the machines behind the router...
     
  6. redlynx

    redlynx Network Guru Member

    hmm...not working properly? can u give me an exemple?
     
  7. _Shorty

    _Shorty Network Guru Member

    I enter my info, it updates dyndns's database once, ~28 days later I get an email from dyndns saying my account hasn't been updated in ~28 and after 35 days or whatever their limit is the account/domain will be deleted automatically unless it is 'touched' before then. The router does nothing. The account/domain expires. Yeah, works great. Perhaps it works properly if your IP changes all the time, but it definitely doesn't work properly if your IP changes infrequently, while still being dynamic in some respects. My IP rarely changes, so I wouldn't know how it behaves if the IP is changing all the time. But when it changes infrequently the feature is useless. With a client running on one of the machines behind the router, it will automatically get touched at the 30 day point so the account/domain won't expire.
     
  8. redlynx

    redlynx Network Guru Member

    yeap, i think you are right, my ip chages every 24h (PPPoE) and it works fine. no problems for me...
     
  9. Disman_ca

    Disman_ca Super Moderator Staff Member Member

    Telnet in and run it as a daemon (-d option) or use the example below that was posted in the sveasoft forum a while back.

    rc_startup:
    Code:
    echo '/usr/sbin/ez-ipupdate -h mydns.dyndns.org -i eth0 -S dyndns -u username:password -e logger "This is the current IP : " ' >>/tmp/ez-script.sh 
    /bin/chmod +x /tmp/ez-script.sh 
    rc_firewall :
    Code:
    /tmp/ex-script.sh 
    Woud probably be easier to use cron or something so that it do an check every X days (need to specify seconds). Alas, I do not have the knowledge to use crontab. Perhaps someone else knows of a way to keep it running? There is a switch for it but I haven't been successful in getting it to work.
     
  10. mstombs

    mstombs Network Guru Member

    I can confirm exacly the same behaviour, so I use a Javascript dyndns client run from a dos bat file under windows xp "scheduled tasks" once a day!

    I did find this info in the GPL sourcecode for v4.50.6

    example-dyndns.conf

    and the max-interval quoted appears to be 24 days - so why doesn't it work?

    Code:
    #!/usr/local/bin/ez-ipupdate -c
    #
    # example config file for ez-ipupdate
    #
    # this file is actually executable!
    #
    
    service-type=dyndns
    #service-type=dyndns-static
    user=myuserid:mypassword
    host=mydomain.whatever.com
    interface=eth1
    max-interval=2073600
    
    # please create this file and ensure that the user that ez-ipupdate is running
    # as has write permissions to it then uncomment this line, if you don't your
    # dyndns account will probably get banned. if you run ez-ipupdate as root (bad
    # idea, use "run-as-user") then you can just uncomment this line.
    #cache-file=/etc/ez-ipupdate.cache.eth1
    
    # for the mean time we'll just use a cache file in the temp directory
    cache-file=/tmp/ez-ipupdate.cache
    
    # uncomment this once you have everything working how you want and you are
    # ready to have ez-ipupdate running in the background all the time. to stop it
    # you can use "killall -QUIT ez-ipupdate" under linux.
    #daemon
     

Share This Page