What's new

Detecting WAN IP change

  • Thread starter Deleted member 62525
  • Start date
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

D

Deleted member 62525

Guest
I am wondering if there is a way to use service-event to trap WAN IP change? I am asking since the only way to update DDNS IP I can find is using some sort of schedules scripts. I am currently using ddns-start but wonder if there is a better way - through event based programming.
 
When my router renewed its WAN lease the other day there was no service-event associated with it. YMMV I don't know whether there would be if the IP address had changed. Mine never does.
 
Maybe WAN-EVENT script? I use the wan event script to email me when my wan drops or reconnects in order to get the new ip address and monitor wan issues. I don't get a connected wan event on a lease renewal with the same ip address, but if the ip changes, that might be considered a "connected" event. Worth a shot.
 
Maybe WAN-EVENT script? I use the wan event script to email me when my wan drops or reconnects in order to get the new ip address and monitor wan issues. I don't get a connected wan event on a lease renewal with the same ip address, but if the ip changes, that might be considered a "connected" event. Worth a shot.

Definitely worth investigating. I will follow up and see if that’s the case. If anyone has done it lets find out.
 
Im still learning shell coding and wrote myself a WAN IP change email notification script, thanks to all those who contribute here, your scripts on github are great resources for ideas/techniques. I got bored one day and created a user config entry bit and basically rewrote the whole thing... If I can get some time Ill test it out some more and will post it up for others who want an automated email immediately when your WAN IP changes. Its executed by a cron job and doesnt rely on a wan-event.

But you could always write your own and use the built in sendmail to email you when it changes.
 
Im still learning shell coding and wrote myself a WAN IP change email notification script,

Its executed by a cron job and doesnt rely on a wan-event.
Why would you prefer to use a scheduled cron job rather than wan-event?
 
Why would you prefer to use a scheduled cron job rather than wan-event?
Hey Martineau
Honestly... I think I put about 30 secs of thought into making it work with that
It boiled down to testing, I didnt want to wait for a renewed ip or wan up/down to see if it was generating any errors running autonomously. And with IP changes when you're not using a ddns it can be frustrating so theres the peace of mind knowing its checking it every x minutes haha

Ive run the core of the commands (getrealip.sh and sendmail) for a long time and it worked well, when I upgraded I incorrectly added it back to cron (my bonehead moment of recent upgrade) and my ip changed, go figure, oh the stories of incorrect cron entries

I started by adding functions to check/add cron(cru) entries then got carried away adding userinput functions for all the variables and adding different sendmail formats etc... I suppose I could have it executed by both a wan-event and reduce the cron run interval to 20 mins or something. I made the cron between 1-60 mins, and I currently run it on 5 min intervals right now
 
Last edited:
@Markster , any success?

Sorry but I was not able to reproduce since my WAN IP never changes. All I can suggest is that you create your wan-event script and log input parameters and WAN IP on every invocation. When you notice that WAN IP has changed examine the log file and figure out what input values were passed to the script. From there it should be fairly simple to edit the script and catch the condition when this is occurring.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top