Quantcast
Channel: SmallNetBuilder Forums
Viewing all articles
Browse latest Browse all 6885

Drop data from NAS when VPN connection expires

$
0
0
Hello,

I tried to find a good solution to this but haven't got it working so far. Hopefully someone can help me find a proper way to do this.

What I am trying to accomplish is to get my router (AC66U) to drop outgoing connections coming from my NAS and ingoing to my NAS when my NAS' VPN connection is lost.

I use my NAS to establish an OpenVPN connection but unfortunately the NAS' downloadstation can't be tied to the VPN connection.
I would love for the router to block any traffic going either way when the VPN connection is not established. Goal is for the NAS to only download files when the VPN connection is up.

I found some bits to configure iptables to achieve this, unfortunately this didn't seem to work (or I put it into the wrong script?):
Code:

iptables -t filter -A wanout -s 192.168.1.51 -d ! xxx.xxx.xxx.xx -j DROP
iptables -t filter -A wanin -s ! xxx.xxx.xxx.xxx -d 192.168.1.51 -j DROP

with 192.168.1.51 being my NAS local IP and xxx.xxx.xxx.xx my VPN servers.

Where did I go wrong :confused::D?

Thanks for the help!

Viewing all articles
Browse latest Browse all 6885

Trending Articles