Disconnect WLAN Uplink if Not Needed

I am trying to figure out a way to disable a WLAN interface that I use for an uplink when there is no requirement for it to be connected…

Let me explain. I am using a RB to connect wirelessly to an open WIFI, but I want it to disconnect from this free open wifi when there is nothing that requires data connectivity.

The issue is that it is at a cabin, in the middle of no where, and I have a VoIP phone set up there too, but this phone doesn’t need connectivity if no one is there. I was thinking of using a script to check for a DHCP entry or ping a reserved IP assigned to a cell phone on the LAN side, and if the phone can be pinged, it will reset a countdown timer of say 36 hours, if the phone cant be pinged in 36 hours, it disables the WLAN Uplink interface. The thinking behind the 36 hours is that the people that stay there would be back to sleep at the cabin within 36 hours, so it should reset the timer.

Now the monkey wrench… That cell phone idea works, but its not guaranteed to be at the cabin when someone is there. So, a IP based occupancy sensor would be ideal :slight_smile: but I don’t think they make these, yet.

A “Dial on Demand” or “connect on demand” based on data traffic requirement will not work, since the VoIP phone will be re-registering every 3 minutes. I do not care if the phone cannot get internet connectivity if no one is at the cabin.

A couple of other ideas was to use external input to enable or disable the WLAN uplink interface, this might be able to be done with the external input from a power source, IE the well pump and hot water tank (electric) are shut off when no one is there. Yes, I could just hook up the power from the RB to one of these, but I want to have the RB connect at specific times, set by a schedule back to a VPN site. This is the in case I need access to that remote lan for some reason, it will connect automatically, say at 11:00pm every day or two.

I would also like to have a script that would change the wireless radio name and MAC address to something random, or from a list, at different times.

The purpose of this setup is to minimize the exposure and connected time to the free wifi, and to do it automatically. No one wants to see a device connected for 35 days to a free wifi, and I am not there to abuse it, I just need minor amounts of data, such as for the voip phone…

I just thought of a idea, I can use a POE injector for the phone, and have that power down with the well pump or water heater, and have the RB ping the static IP of the voip phone, if it is not on, it doesn’t respond, and then will disable the WLAN Uplink. And this way, the routerboard is still on, and can continue to run scripts to connect at a specified time of day.

What are your thoughts?

I would implement simple power switch. When someone arrives, he switches it on and powers the client and phone. And switch off when leaving.

one quick thought on how to do this via scripting:

Use a script that checks for address list entries in a list called “internet-access”; have a firewall rule like
/ip firewall filter in-interface=ether1 chain=forward src-address=!192.168.1.10 dst-address=!192.168.1.0/24 action=add-dst-to-address-list timeout=30min

Where ether1 is your LAN interface, 192.168.1.10 is the voip phone and 192.168.1.0/24 is the LAN subnet.

The script would then check and if there was no addresses in the list, it would disable the wireless interface, inversely if there was items in the list it would enable the wireless interface. You could have the script run every 10 seconds meaning as soon as your computer tried to connect to something there would be a 10 second delay then after the wireless connected it would stay that way until a period of 30 minutes of “silence” from your machine.