Van Router – Auto Connect to Home Network

1413825786_thumb.jpegSo I’ve been wrestling with a way to have the van router automagically connect to the home wifi network when ever its turned in at home.

Obviously I could simply setup the router as both a client to connect to the home network and access point to enable devices to connect to the van router. This works fine whilst I’m at home. The minute the router cant find the home network (For example when traveling) and it simply kills wifi from ever starting up meaning devices cant connect to router.

After searching the web, I’ve managed to find a very clever solution that i dont understand why I didnt think of myself. So elegant and yet so simple.  Now I didn’t come up with the script.  I simply plagerised it from here

On startup… Have the router try and download the page, if of course this works it means we’re at home and the home network is obviously avaiable. Therefor leave it enabled.

If we try the download and it fails – Obviously the home network is not available and as such it should be disabled. Its this disabling of the home network settings that then enables the router to continue start up wifi.

so heres what we do:

1st we create our file

vi /usr/bin/

in this file we paste the following

# test both networks.

logger “Enabling home wifi network for uplink test”

uci set wireless.@wifi-iface[1].disabled=0;
uci commit wireless;

# wait some time and test
sleep 15
rm index.html
logger “Testing uplink state….”
if wget; then

logger “You have uplink, Leaving network alone.”

# disable uplink wifi and restart if no connection is available

uci set wireless.@wifi-iface[1].disabled=1;
logger “No uplink available, Disabled home network
uci commit wireless;

save this file.

now we change the file permissions.. being i’m lazy i did it this way as the router doesn’t need to be super secure. I mean come on I use it for camping.. lol

chmod 777 /usr/bin/

next we edit rc.local to enable the script to run on bootup

vi /etc/rc.local

add the following line before the exit 0 statement &

Save the file and reboot.

You should have access to your home network. Now turn off the home wifi router and reboot your van router. You should find that after an extra 15 seconds than normal, you will have wifi available.

This is super awesome as it means we now have way to automate backup of home files to the van router when it becomes available at home. On successful uplink test we could theoretically then start an rbackup of say a movie folder. The skys the limit.


Actually I’ve just had a thought.  If we start the connection at home, and then drive away do things mess up.  Rather than rebooting – What if the wps button could toggle the home wifi network on and off, that might be even easier…

I’ll do some fudging around and see what I come up with….. Stay tuned