I would like to know if it’s possible to schedule a task to enable my VPN (Wireguard) server during lets midnight till 9am everyday. Basically what I want to achieve is to only accept connections in my vpn server during those hours. Thank you!
Yes but you’ll leave your WG Server running 24x7x365. WG’s default port is 51820. I’m working on adapting something from the OpenWrt Wiki for ‘Parental Controls’ for you. It should be possible to just cut access to :51820 for that timeframe via blocking it with the firewall.
- GL GUI → Applications → Parental Controls doesn’t look like it’ll do the job
- I am not skilled in firewall configuration
- You’ll need to install LuCI (GL GUI → System → Advanced Settings)
- You might ‘break’ your existing firewall config, therefore all connectivity, doing this. Backup your configuration first within LuCI via System → Backup / Flash firmware → Flash Operations → Backup → Generate achieve. Keep that .tar.gz file handy. You can restore it from the same page if you end up needing to reflash & start from scratch.
This closes WG connections during the inverted timeframe:
- Navigate to LuCI → Network → Firewall → Traffic Rules.
- Click Add and specify:
- Source zone:
wgserver if listed
- Source port:
- Destination zone:
- On the Time Restrictions tab specify:
- Week Days: (as you prefer)
- Start time:
- Stop time:
- Click Save, then Save & Apply.
I would test this by setting the start/stop timeframe to a 1 min window & try streaming a video to your remote WG client/‘guest’ & see if it’s cut after that minute. Maybe downloading a Linux distro’s ISO — or other mutli-GB file — directly from one of your computers in your LAN by your ‘guest’s’ device would be easier. Rymdport makes that trivial.
Assumes firmware 4.2.1-release4
(No warranties either expressed or implied; I’m not responsible if your devices become sentient & fight back from the abuse.)