mkaand
Occasional Visitor
Hi Everyone,
This is my first post in this forum but I am actively developing some shell scripts for DD-WRT at their forum since 2006 with same username. I bought ASUS RT-AX86U a week ago and I flashed with Merlin's firmware. I have a little bit complex system first I will explain my network and I will share my experience about domain based (policy based) routing. I use following sources to achieve this. Many thanks for all community.
Sources:
My network has two routers:
Main Router ASUS RT-AX86U with Merlin's firmware and second router TP-Link WR1043ND V2. DDWRT (192.168.50.2 WAN) on it. DDWRT broadcasting VPN HUB and VPNBook [USA] SSIDs. If I connect to VPN HUB (192.168.1.1) only selective domains redirects to OpenVPN (Free VPNBook Service), If I connect to VPNBook [USA] (192.168.2.1) all traffic goes to VPNBook VPN Service. Let's talk about main router ASUS RT-AX86U:
Main router has 192.168.50.1 and JFFS enabled. I added some static routes like:
I followed above sources first DHCP clients should get main router IP as DNS (192.168.50.1). I created /jffs/configs/dnsmasq.conf.add file and of course I did chmod a+rx /jffs/configs/* dos2unix /jffs/configs/*
Here is the content of dnsmasq.conf.add
I added test.com just for testing purpose. I want to make sure dnsmasq working or not. As you can see I created ipset_V4 for all traffic I want to redirect to VPN. If dnsmasq is working correctly while you are pinging you should see 192.168.0.1
Second I added firewall script. I created /jffs/scripts/firewall-start file with following content:
After startup, ipset and dnsmasq is working perfectly. I had some minor issues about static DHCP clients. You should make sure all clients should get 192.168.50.1 as a DNS not 1.1.1.1 or other public DNS. I am sending this post via VPN. I need your advice for improvment:
I have another VPN Server in Scaleway Amsterdam. I can easily make connection with secret.key Point to Point. Server is 10.10.3.1 and ASUS Router will gets 10.10.3.2. They can ping each other. But I want to create another virtual WLAN and lets say VPN [Amsterdam]. If I connect this SSID all traffic should goes via 10.10.3.1. How can I do that? I already did that on DDWRT but I want to that at Asus Merlin. Thanks in advance.
This is my first post in this forum but I am actively developing some shell scripts for DD-WRT at their forum since 2006 with same username. I bought ASUS RT-AX86U a week ago and I flashed with Merlin's firmware. I have a little bit complex system first I will explain my network and I will share my experience about domain based (policy based) routing. I use following sources to achieve this. Many thanks for all community.
Sources:
- https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-domains-with-dnsmasq
- https://www.snbforums.com/threads/route-certain-domains-through-client-vpn.49451/#post-439430
- https://www.snbforums.com/threads/using-ipset-to-selectively-route-domains-to-a-vpn-client.41560/
- https://www.snbforums.com/threads/how-to-make-dnsmasq-and-ipset-affect-router.59872/
- https://www.snbforums.com/threads/s...affic-using-nginx-dnsmasq-and-iptables.67546/
My network has two routers:
Main Router ASUS RT-AX86U with Merlin's firmware and second router TP-Link WR1043ND V2. DDWRT (192.168.50.2 WAN) on it. DDWRT broadcasting VPN HUB and VPNBook [USA] SSIDs. If I connect to VPN HUB (192.168.1.1) only selective domains redirects to OpenVPN (Free VPNBook Service), If I connect to VPNBook [USA] (192.168.2.1) all traffic goes to VPNBook VPN Service. Let's talk about main router ASUS RT-AX86U:
Main router has 192.168.50.1 and JFFS enabled. I added some static routes like:
I followed above sources first DHCP clients should get main router IP as DNS (192.168.50.1). I created /jffs/configs/dnsmasq.conf.add file and of course I did chmod a+rx /jffs/configs/* dos2unix /jffs/configs/*
Here is the content of dnsmasq.conf.add
Bash:
ipset=/planetdp.org/whatismyip.org/pandora.com/paypal.com/pastebin.com/tunein.com/snbforums.com/ipset_V4
address=/test.com/192.168.0.1
I added test.com just for testing purpose. I want to make sure dnsmasq working or not. As you can see I created ipset_V4 for all traffic I want to redirect to VPN. If dnsmasq is working correctly while you are pinging you should see 192.168.0.1
Second I added firewall script. I created /jffs/scripts/firewall-start file with following content:
Bash:
#!/bin/sh
touch /tmp/000firewall-start
logger "Applying firewall-start rules."
ipset create ipset_V4 hash:net family inet hashsize 1024 maxelem 65536
iptables -I PREROUTING -t mangle -m set --match-set ipset_V4 dst -j MARK --set-mark 10012
ip rule add prio 100 fwmark 10012 lookup 100
ip route add table 100 default via 192.168.50.2
touch /tmp/000firewall-stop
After startup, ipset and dnsmasq is working perfectly. I had some minor issues about static DHCP clients. You should make sure all clients should get 192.168.50.1 as a DNS not 1.1.1.1 or other public DNS. I am sending this post via VPN. I need your advice for improvment:
I have another VPN Server in Scaleway Amsterdam. I can easily make connection with secret.key Point to Point. Server is 10.10.3.1 and ASUS Router will gets 10.10.3.2. They can ping each other. But I want to create another virtual WLAN and lets say VPN [Amsterdam]. If I connect this SSID all traffic should goes via 10.10.3.1. How can I do that? I already did that on DDWRT but I want to that at Asus Merlin. Thanks in advance.