Hi all, I'm enjoying experimenting with Merlin's firmware (donation on its way, thanks for such a great resource). I'm having some problems setting up policy routing with 2 VPN connections, although I can get it working with 1 VPN connection. If anyone can point me in the right direction that'd be really great.
I've got two VPN connections established (clients 1 and 2). I want to use each of those for certain traffic and use the WAN connection for everything else.
I've set up dnsmasq.conf.add like this and I know it's executing because I can list the ipsets later and see their entries being added to over time:
I've set up services-start like this and I know it's executing:
I've set up nat-start like this and I know it's executing:
I'm sure I must have missed something basic but if someone can help me out I'd sure appreciate it. Thanks!
EDIT: I should have added that all traffic is still going through the WAN so the rules I've set up maybe aren't even being used.
I've got two VPN connections established (clients 1 and 2). I want to use each of those for certain traffic and use the WAN connection for everything else.
I've set up dnsmasq.conf.add like this and I know it's executing because I can list the ipsets later and see their entries being added to over time:
Code:
ipset=/abc.com/www.abc.com/abc
ipset=/def.com/www.def.com/def
ipset=/xyz.com/www.xyz.com/xyz
I've set up services-start like this and I know it's executing:
Code:
#!/bin/sh
service restart_dnsmasq
modprobe xt_set
ipset create abc hash:net family inet hashsize 1024 maxelem 65536
ipset create def hash:ip,port
ipset create xyz hash:net family inet hashsize 1024 maxelem 65536
I've set up nat-start like this and I know it's executing:
Code:
#!/bin/sh
ipset add def 104.25.113.26,80
ipset add def 104.25.112.26,80
# Set up the routing rules
# Rule for VPN client 1
ip rule del fwmark 0x1000
ip rule add fwmark 0x1000 table ovpnc1 prio 9991
# Rule for VPN client 2
ip rule del fwmark 0x2000
ip rule add fwmark 0x2000 table ovpnc2 prio 9992
ip route flush cache
# By default all traffic goes through the WAN
# Set up routes for the ipsets
iptables -t mangle -A PREROUTING -i br0 -p tcp -m set --match-set abc src,dst -j MARK --set-mark 0x1000/0x1000
iptables -t mangle -A PREROUTING -i br0 -p tcp -m set --match-set def src,dst -j MARK --set-mark 0x1000/0x1000
iptables -t mangle -A PREROUTING -i br0 -p tcp -m set --match-set xyz src,dst -j MARK --set-mark 0x2000/0x2000
I'm sure I must have missed something basic but if someone can help me out I'd sure appreciate it. Thanks!
EDIT: I should have added that all traffic is still going through the WAN so the rules I've set up maybe aren't even being used.