What's new

Drop data from NAS when VPN connection expires

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

warneh

New Around Here
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!
 
So I tried a couple more things and I think I at least figured out that wanout/wanin are Tomato specific if I got that right but still didn't really help me find a solution.

So if anyone knows how to set up iptables to only allow traffic between the NAS and the outside world when it is connected to my VPN (if that is possible at all), I'd really appreciate some help.

Was reasing up a lot on iptables today but everything I tried seemed to be the wrong solution anyway -.-
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top