LeSilverFox
New Around Here
Hello SmalnetBuilder community. I’m a first poster and would like to begin staying thank you to everyone for the great firmware (thank you Merlin) and outstanding community support. I have a little challenge around rule based routing and hopping to receive some guidance.
I have an ASUS RT-AC66U with Merlin 374.42.
I read this entire post to learn the technique and I have implemented the ‘optimized’ script as listed below. My problem is that while the correct machines are routed through the VPN tunnel I still can’t connect back to my router . As soon as I turn off the VPN client in the router, connection back to the router is restored.
Two additional observation: when I first setup this script, I could only access internet via the VPN tunnel through the two listed clients. The rest, had no internet access via the wan at all. I managed to overcome this problem by inserting a second line to disable reverse filtering on eth0 ( echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter ). Once I added this line, selective routing started and it has been working for weeks. But I can not connect back from Internet ( the machine I’m trying to connect to has a manually assigned fixed IP addess and the port is forwarded correctly to that machine - actually, I’m trying to reach my plex server from outside).
Two questions: does anyone have any experience/success with connecting back to services running in the local network and what that solution is ? Whether I include ‘route-nopull’ in custom configuration or not, makes zero difference - everything still works the same - is this an indication of me doing something wrong ?
Thank you for any suggestions !!
here’s my script
#!/bin/sh
ip route flush table 10
ip route del default table 10
ip rule del fwmark 10 table 10
ip route flush table 12
ip route del default table 12
ip rule del fwmark 12 table 12
ip route flush cache
iptables -t mangle -F PREROUTING
tun_if="tun11"
tun_ip=$(ifconfig $tun_if | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}')
ip route add default via $tun_ip dev $tun_if table 10
ip rule add fwmark 10 table 10
ip route add default via $(nvram get wan0_gateway) dev eth0 table 12
ip rule add fwmark 12 table 12
echo 0 > /proc/sys/net/ipv4/conf/$tun_if/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
iptables -t mangle -A PREROUTING -i br0 -j MARK --set-mark 12
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range 192.168.1.71 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range 192.168.1.85 -j MARK --set-mark 10
exit 0
I have an ASUS RT-AC66U with Merlin 374.42.
I read this entire post to learn the technique and I have implemented the ‘optimized’ script as listed below. My problem is that while the correct machines are routed through the VPN tunnel I still can’t connect back to my router . As soon as I turn off the VPN client in the router, connection back to the router is restored.
Two additional observation: when I first setup this script, I could only access internet via the VPN tunnel through the two listed clients. The rest, had no internet access via the wan at all. I managed to overcome this problem by inserting a second line to disable reverse filtering on eth0 ( echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter ). Once I added this line, selective routing started and it has been working for weeks. But I can not connect back from Internet ( the machine I’m trying to connect to has a manually assigned fixed IP addess and the port is forwarded correctly to that machine - actually, I’m trying to reach my plex server from outside).
Two questions: does anyone have any experience/success with connecting back to services running in the local network and what that solution is ? Whether I include ‘route-nopull’ in custom configuration or not, makes zero difference - everything still works the same - is this an indication of me doing something wrong ?
Thank you for any suggestions !!
here’s my script
#!/bin/sh
ip route flush table 10
ip route del default table 10
ip rule del fwmark 10 table 10
ip route flush table 12
ip route del default table 12
ip rule del fwmark 12 table 12
ip route flush cache
iptables -t mangle -F PREROUTING
tun_if="tun11"
tun_ip=$(ifconfig $tun_if | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}')
ip route add default via $tun_ip dev $tun_if table 10
ip rule add fwmark 10 table 10
ip route add default via $(nvram get wan0_gateway) dev eth0 table 12
ip rule add fwmark 12 table 12
echo 0 > /proc/sys/net/ipv4/conf/$tun_if/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
iptables -t mangle -A PREROUTING -i br0 -j MARK --set-mark 12
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range 192.168.1.71 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range 192.168.1.85 -j MARK --set-mark 10
exit 0