Client VPN and VPN server in ASUS router at the same time. Route all traffic thru VPN service.

What we want:

Markering_596

 

I don’t think this will work with ASUS orginal firmware, I have not tested.
I use Merlin (https://asuswrt.lostrealm.ca/)

Check what TUN you have in the router via ssh
Command: route

Then you see what TUN you have on the vpn, in my case tun15
You can also use tun1+ but then all TUN will be affected

Command:
iptables -I POSTROUTING -t nat -s $(nvram get vpn_server1_sn)/24 -o tun15 -j MASQUERADE

Test if this works

Then add it to a script that will apply this automatic after renoot.

Script:
https://github.com/RMerl/asuswrt-merlin/wiki/User-scripts
1. Enable script in the gui
2. Create script

vi /jffs/scripts/firewall-start

#!/bin/sh
iptables -I POSTROUTING -t nat -s $(nvram get vpn_server1_sn)/24 -o tun15 -j MASQUERADE

chmod +x /jffs/scripts/firewall-start

reboot

Don’t forget to tick to start vpn client on boot in the gui

And

Redirect Internet traffic Any or selective routing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.