Hi all,
I'm new to all of this and I've picked pieces from here and there trying to work out my script but it seems nothing works. So I have a RT-AC68U (T-mobile branded) loaded with the latest release from Merlin (380.65_2) I believe. I'm trying to route Netflix out of my VPN. VPN is setup to run on router level and it works just fine. Following the wiki for user script, I added firewall-start file in /jffs/scripts and chmod it so it can be executed. However, the script doesn't run when I reboot router. When I manually run it through CLI, the system log gave me this error
I came from Tomato Shibby and the script worked just fine. Below is the content of my script
I'd be really appreciated if someone can help me out on this.
I'm new to all of this and I've picked pieces from here and there trying to work out my script but it seems nothing works. So I have a RT-AC68U (T-mobile branded) loaded with the latest release from Merlin (380.65_2) I believe. I'm trying to route Netflix out of my VPN. VPN is setup to run on router level and it works just fine. Following the wiki for user script, I added firewall-start file in /jffs/scripts and chmod it so it can be executed. However, the script doesn't run when I reboot router. When I manually run it through CLI, the system log gave me this error
Code:
iptables v1.4.14: unknown option "--set-mark"
I came from Tomato Shibby and the script worked just fine. Below is the content of my script
Code:
# Put this in the Firewall portion of the script section in Administration
#!/bin/sh
set -x #uncomment/comment to enable/disable debug mode
(
TID="200"
FW_MARK="0x88"
IPSET="ovpn_split"
# cleanup from prior execution
(
# stop split tunnel
ip rule del fwmark $FW_MARK table $TID
# delete firewall rules
iptables -t mangle -F
# delete alternate routing table
ip route flush table $TID
# force routing system to recognize our changes
ip route flush cache
# enable reverse path filtering
for i in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 2 > $i; done
sleep 3
) > /dev/null 2>&1
# quit if neither OpenVPN client is active
! ip route show | egrep -qm1 'tun1[1-2]' && exit
# copy main routing table (exclude all default gateway routes)
ip route show | egrep -v '^default|^0.0.0.0/1|^128.0.0.0/1' \
| while read route; do
ip route add $route table $TID
done
# add WAN as default gateway
ip route add default via $(nvram get wan_gateway) table $TID
# force routing system to recognize our changes
ip route flush cache
# disable reverse path filtering
for i in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 > $i; done
# load required netfilter modules
(modprobe xt_set || modprobe ip_set) 2> /dev/null
# Add Netflix IP blocks
ipt() {
iptables -t mangle -A PREROUTING -i br0 -d "$1" -j MARK --set-mark $FW_MARK
}
ipt 208.75.79.0/24
ipt 208.75.76.0/24
ipt 208.75.73.0/24
ipt 208.75.72.0/24
ipt 108.175.32.0/20
ipt 108.175.32.0/24
ipt 108.175.33.0/24
ipt 108.175.34.0/24
ipt 108.175.35.0/24
ipt 108.175.38.0/24
ipt 108.175.39.0/24
ipt 108.175.40.0/24
ipt 108.175.41.0/24
ipt 108.175.42.0/24
ipt 108.175.43.0/24
ipt 108.175.44.0/24
ipt 108.175.46.0/24
ipt 108.175.47.0/24
ipt 185.2.220.0/22
ipt 185.2.222.0/24
ipt 185.2.223.0/24
ipt 185.9.188.0/22
ipt 185.9.188.0/24
ipt 192.173.112.0/20
ipt 192.173.64.0/18
ipt 192.173.64.0/20
ipt 192.173.64.0/24
ipt 192.173.65.0/24
ipt 192.173.66.0/24
ipt 192.173.67.0/24
ipt 192.173.68.0/24
ipt 192.173.80.0/20
ipt 192.173.96.0/20
ipt 198.38.100.0/24
ipt 198.38.101.0/24
ipt 198.38.102.0/23
ipt 198.38.102.0/24
ipt 198.38.108.0/24
ipt 198.38.109.0/24
ipt 198.38.110.0/24
ipt 198.38.111.0/24
ipt 198.38.112.0/24
ipt 198.38.113.0/24
ipt 198.38.114.0/24
ipt 198.38.115.0/24
ipt 198.38.116.0/24
ipt 198.38.117.0/24
ipt 198.38.118.0/24
ipt 198.38.119.0/24
ipt 198.38.120.0/24
ipt 198.38.121.0/24
ipt 198.38.124.0/24
ipt 198.38.125.0/24
ipt 198.38.126.0/24
ipt 198.38.127.0/24
ipt 198.38.96.0/19
ipt 198.38.96.0/24
ipt 198.38.97.0/24
ipt 198.38.98.0/24
ipt 198.38.99.0/24
ipt 198.45.48.0/20
ipt 198.45.48.0/24
ipt 198.45.49.0/24
ipt 198.45.50.0/23
ipt 198.45.50.0/24
ipt 198.45.52.0/24
ipt 198.45.53.0/24
ipt 198.45.54.0/24
ipt 198.45.55.0/24
ipt 198.45.56.0/24
ipt 198.45.57.0/24
ipt 198.45.61.0/24
ipt 198.45.62.0/24
ipt 198.45.63.0/24
ipt 23.246.0.0/18
ipt 23.246.12.0/24
ipt 23.246.13.0/24
ipt 23.246.14.0/24
ipt 23.246.15.0/24
ipt 23.246.16.0/24
ipt 23.246.17.0/24
ipt 23.246.18.0/24
ipt 23.246.2.0/24
ipt 23.246.20.0/24
ipt 23.246.21.0/24
ipt 23.246.22.0/24
ipt 23.246.23.0/24
ipt 23.246.24.0/24
ipt 23.246.25.0/24
ipt 23.246.26.0/24
ipt 23.246.27.0/24
ipt 23.246.28.0/22
ipt 23.246.28.0/24
ipt 23.246.29.0/24
ipt 23.246.3.0/24
ipt 23.246.30.0/24
ipt 23.246.31.0/24
ipt 23.246.32.0/20
ipt 23.246.36.0/24
ipt 23.246.37.0/24
ipt 23.246.38.0/24
ipt 23.246.39.0/24
ipt 23.246.4.0/24
ipt 23.246.42.0/24
ipt 23.246.43.0/24
ipt 23.246.44.0/24
ipt 23.246.45.0/24
ipt 23.246.46.0/24
ipt 23.246.47.0/24
ipt 23.246.48.0/24
ipt 23.246.49.0/24
ipt 23.246.5.0/24
ipt 23.246.50.0/24
ipt 23.246.51.0/24
ipt 23.246.52.0/24
ipt 23.246.54.0/24
ipt 23.246.55.0/24
ipt 23.246.56.0/24
ipt 23.246.57.0/24
ipt 23.246.58.0/24
ipt 23.246.59.0/24
ipt 23.246.6.0/24
ipt 23.246.7.0/24
ipt 23.246.8.0/24
ipt 23.246.9.0/24
ipt 37.77.184.0/21
ipt 37.77.186.0/24
ipt 37.77.187.0/24
ipt 37.77.188.0/24
ipt 37.77.189.0/24
ipt 37.77.190.0/24
ipt 37.77.191.0/24
ipt 45.57.0.0/17
ipt 45.57.0.0/24
ipt 45.57.1.0/24
ipt 45.57.10.0/23
ipt 45.57.10.0/24
ipt 45.57.12.0/24
ipt 45.57.13.0/24
ipt 45.57.14.0/24
ipt 45.57.15.0/24
ipt 45.57.16.0/24
ipt 45.57.17.0/24
ipt 45.57.18.0/24
ipt 45.57.19.0/24
ipt 45.57.2.0/24
ipt 45.57.20.0/24
ipt 45.57.21.0/24
ipt 45.57.22.0/24
ipt 45.57.23.0/24
ipt 45.57.28.0/24
ipt 45.57.29.0/24
ipt 45.57.3.0/24
ipt 45.57.30.0/24
ipt 45.57.31.0/24
ipt 45.57.36.0/24
ipt 45.57.37.0/24
ipt 45.57.38.0/24
ipt 45.57.39.0/24
ipt 45.57.4.0/24
ipt 45.57.40.0/24
ipt 45.57.42.0/24
ipt 45.57.44.0/24
ipt 45.57.45.0/24
ipt 45.57.5.0/24
ipt 45.57.6.0/24
ipt 45.57.7.0/24
ipt 45.57.8.0/23
ipt 45.57.8.0/24
ipt 45.57.9.0/24
ipt 64.120.128.0/17
ipt 66.197.128.0/17
ipt 69.53.230.0/24
ipt 69.53.231.0/24
ipt 69.53.232.0/23
ipt 69.53.234.0/24
ipt 69.53.235.0/24
ipt 69.53.240.0/24
ipt 69.53.242.0/24
ipt 69.53.245.0/24
ipt 69.53.246.0/24
ipt 69.53.255.0/24
ipt 107.20.0.0/16
ipt 107.21.0.0/18
ipt 107.21.128.0/17
ipt 107.21.64.0/18
ipt 107.22.0.0/16
ipt 107.23.0.0/17
ipt 107.23.128.0/17
ipt 174.129.0.0/16
ipt 184.72.128.0/17
ipt 184.72.64.0/19
ipt 184.72.96.0/19
ipt 184.73.0.0/16
ipt 204.236.192.0/18
ipt 204.236.224.0/19
ipt 216.182.224.0/21
ipt 216.182.232.0/21
ipt 23.20.0.0/15
ipt 23.22.0.0/15
ipt 23.23.189.144/28
ipt 34.192.0.0/12
ipt 34.195.253.0/25
ipt 50.16.0.0/16
ipt 50.17.0.0/16
ipt 50.19.0.0/17
ipt 50.19.128.0/17
ipt 52.0.0.0/15
ipt 52.2.0.0/15
ipt 52.20.0.0/14
ipt 52.200.0.0/13
ipt 52.4.0.0/14
ipt 52.44.0.0/15
ipt 52.54.0.0/15
ipt 52.70.0.0/15
ipt 52.72.0.0/15
ipt 52.86.0.0/15
ipt 52.90.0.0/15
ipt 52.95.245.0/24
ipt 54.144.0.0/14
ipt 54.152.0.0/16
ipt 54.156.0.0/14
ipt 54.160.0.0/14
ipt 54.164.0.0/15
ipt 54.166.0.0/15
ipt 54.172.0.0/15
ipt 54.174.0.0/15
ipt 54.196.0.0/15
ipt 54.198.0.0/16
ipt 54.204.0.0/15
ipt 54.208.0.0/15
ipt 54.210.0.0/16
ipt 54.211.0.0/16
ipt 54.221.0.0/16
ipt 54.224.0.0/15
ipt 54.226.0.0/15
ipt 54.234.0.0/15
ipt 54.236.0.0/18
ipt 54.236.128.0/17
ipt 54.236.64.0/18
ipt 54.237.0.0/16
ipt 54.240.30.0/23
ipt 54.240.32.0/20
ipt 54.240.48.0/23
ipt 54.240.8.0/21
ipt 54.242.0.0/15
ipt 54.80.0.0/14
ipt 54.84.0.0/15
ipt 54.86.0.0/16
ipt 54.87.0.0/16
ipt 54.88.0.0/16
ipt 54.89.0.0/16
ipt 54.90.0.0/15
ipt 54.92.128.0/17
ipt 54.204.25.0/28
ipt 67.202.0.0/18
ipt 72.44.32.0/19
ipt 75.101.128.0/17
# create ipset hash table
modprobe ip_set_hash_ip
ipset create $IPSET iphash
ipset flush $IPSET
# add firewall rule
#iptables -t mangle -A PREROUTING -i br0 -m iprange --src-range 192.168.1.2-192.168.1.51 -j MARK --set-mark $FW_MARK
iptables -t mangle -A PREROUTING -m set --match-set $IPSET dst -j MARK --set-mark $FW_MARK
iptables -I FORWARD -i tun11 -p udp -d 192.168.255.254 --dport 32400 -j ACCEPT
iptables -I FORWARD -i tun11 -p tcp -d 192.168.255.254 --dport 32400 -j ACCEPT
iptables -t nat -I PREROUTING -i tun11 -p tcp --dport 32400 -j DNAT --to-destination 192.168.255.254
iptables -t nat -I PREROUTING -i tun11 -p udp --dport 32400 -j DNAT --to-destination 192.168.255.254
# start split tunnel
ip rule add fwmark $FW_MARK table $TID
) 2>&1 | logger -t "ovpn_split[$$]"
I'd be really appreciated if someone can help me out on this.