Posted: Sat Dec 21, 2013 0:26 Post subject: Delay script running?
I have managed to load "v24-21061_NEWD-2_K2.6-openvpn-small" onto my Netgear WNR2000v2 router. It runs great and I have two wireless networks setup and running as well as the OpenVPN server for remote connections. It is running well, using only 46% of the RAM in the device.
Now, I have one tiny problem that bugged me when I was running the mini build that still bugs me. When I reboot the router or if the power flickers, my guest wireless cannot access the Internet. I enter the command below to solve the issue, but upon a reboot it is lost.
If I put this into the startup commands it executes before the WAN interface has an IP address from my ISP and does not work. Is there a way to bind this command to the WAN interface coming up? There was a way to bind scripts to interfaces coming up back in Debian Lenny that I used, but that was years ago and a lot has changed since then. Also, this isn't Debian. Thanks for the help!
Save that as startup and it will wait two minutes before applying the iptables rule. This works on my router, but other routers may be faster or slower. Also, if you are having trouble with your ISP and the router cannot grab an IP address before the script runs, such as during an outage, the script will fail. If your ISP comes up an hour later you will have to reboot your router or run the script manually.
I was hoping that somebody would make a post about tying a script to when the WAN interface came up. In a full-blown Linux OS on a PC you can copy scripts to /etc/network/if-up.d/ or similar, edit /etc/network/interfaces, and add post-up /etc/network/if-up.d/scriptname.sh to the interface you want. Then the script runs each time the interface comes up.
Now, is it possible to do this with DD-WRT in some way? That would be the best solution until we have a way to make it just work from the GUI.
Look at my second post. I put in a 120 second (2 minute) sleep so the WAN interface has time to come up before the command executes. I am now trying to tie this command into the WAN interface coming up.