What's new

Auto Script to Reconnect WAN Until Certain IP Range is Obtained

  • 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!

OKLY

Occasional Visitor
Hi, can anyone provide me an auto script that will reconnect WAN until it is connected with a certain IP address range? My ISP has different routing for different IP range so some is indeed better when connecting a to a server abroad. Many thanks in advance.
 
Hi, can anyone provide me an auto script that will reconnect WAN until it is connected with a certain IP address range? My ISP has different routing for different IP range so some is indeed better when connecting a to a server abroad. Many thanks in advance.
I tot there is a lease period set by ISP. If lease period not over, sometime ip will remain the same or stay within the subnet which still follow same route. Heard some isp may even ban for too frequent reconnection. Isn’t it disruptive when using the script and router still unable to connect to the ip range set after multiple tries?
 
I tot there is a lease period set by ISP. If lease period not over, sometime ip will remain the same or stay within the subnet which still follow same route. Heard some isp may even ban for too frequent reconnection. Isn’t it disruptive when using the script and router still unable to connect to the ip range set after multiple tries?
Not for my ISP though, the moment I disconnect the IP changes right away when I reconnect. Have been doing this manually and so far no issues. Hope there is some sort of script that can automatically do it for me instead.
 
What DonnyJohnny wrote is important ant should not be ignored and must be kept in mind. If you can get desired range within few tries, you should not be banned, but what if you need hudnerd tries? Yo umay be for hours without a connection while trying for a desired range, too.

That said: script is simple:
- get the current WAN IP
- check if it is within desired range
- if not reboot the modem or break connection and reestablish it (second way would be much faster but is less likely to change IP assigned)

A script for manual DDNS updating for Double NAT modem would be quite easy to adapt to your needs.
if You have Single NAT modem, it will be simple. If you have a Double NAT modem, you will have to cron your script and check periodically if your WAN IP has changed and if changed test it.
 
So can anybody be kind enough to write this script as I do not know how.

Basically I need a script to:

1) Check wan0_ipaddr if it is within a certain IP range, example I want "115.x.x.x", it needs to check if my current WAN IP address is this range or not.

2) If yes, then nothing else to do. If no, restart WAN and then recheck the the IP address range again in another 15 seconds.

And it will continue to do the same thing until the desired IP range is obtained.
 
That kind of abusive behaviour can lead to your router/modem getting blacklisted by the ISP. Bad idea.
 

Similar threads

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