Hi,
This topic covers my needs pretty well, and though there are a lot of really helpful posts, I cannot get ‘it’ to work.
What is my situation? I have:
- A Synology 413J NAS, with a fixed LAN IP 192.168.1.40, behind…:
- An Asus RT-N66U router, with Merlin 378.55 firmware
- An active AirVPN account
What is my desired end-state?
1. Send all WAN – NAS traffic through a (Air-) VPN tunnel, while at the same time…
2. Accept non-VPN traffic on specific ports, for example ‘FTP-ports’.
3. Block all 1. traffic if the VPN connection goes down, while at the same time still allow 2. traffic. If this is somehow impossible, blocking 1. traffic has priority.
What have I done so far?
1. Before ‘trying this VPN stuff’, I used to have port forwarding rules om my router via the GUI: 21 and 55536-55543. This worked OK, I was able to reach my server from a WAN.
2. I used the AirVPN config generator, and installed it in the Merlin GUI.
3. I changed 'policy routing' and 'start with WAN'. See this screenshot for all settings:
http://puu.sh/o8roe/71b567df93.png
4. I created (with notepad++) a nat-start.sh file, uploaded in jffs/scripts/, chmod-ded it to 777, rebooted. Contents of this file:
Code:
#!/bin/sh
touch /tmp/000wanstarted
TAG_MARK=8
ip rule del fwmark $TAG_MARK 2> /dev/null > /dev/null
ip rule add fwmark $TAG_MARK table main prio 1100
ip route flush cache
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range xxx.xxx.xxx.xxx -p tcp --dport 21 -j MARK --set-mark $TAG_MARK
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range xxx.xxx.xxx.xxx -p udp --dport 21 -j MARK --set-mark $TAG_MARK
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range xxx.xxx.xxx.xxx -p tcp --dport 55536:55543 -j MARK --set-mark $TAG_MARK
(Thanks to Martineau, post #423)
What are the results?
1. All WAN-NAS traffic seems to go through the tunnel just fine. I haven’t found a way to really check this, but while downloading a file (both nzb and torrent), I can see the numbers on the VPN Status screen go up. Besides, I have a test torrent, that (correctly) displays my VPN IP as the tracker IP. So, this part of my desired end-state seems to be covered.
2. I cannot reach my NAS through FTP, using my public (i.e. non-VPN) IP
3. I doubt if the ‘kill switch’ really works. If I disable the VPN client, the torrent client immediately continues sending & receiving traffic, using my public IP. However, I can imagine that by disabling the VPN client, I also disable the policy routing rules that goes along with it. If so, is there another way to test the kill switch/policy routing? If not, something else goes wrong…
4. No 000wanstarted is created
What have I done to fix items 2. and 3.?
1. I removed the port forwarding rules in my GUI, unfortunately to no avail…
2. Nothing else… Although I don’t consider myself a complete PC/network newbie, I must admit that I am well out of my comfort/knowledge zone with this stuff. I am not afraid to try stuff, but as I don’t (really) understand what I am doing, ‘trial and error’ is not the way ahead I guess… Furthermore, #423 had some testing commands, but the output makes no sense to me at all.
Some additional questions:
1. Do I need port forwarding to the FTP server on my NAS or not? I guess I do, because with or without VPN, the router needs to know where the server is...
2. In #423, Martinau suggests naming the file VPN_PortSelect.sh. Howevver, if you do so, how does it get started during boot?
As always, I am sure the problem is something really simple, I hope you can give me some pointers in the right direction!
Kind regards,
Martijn