Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Settingup router vpn while exluding Netflix

Tags:

openvpn

dd-wrt

I have an DD-WRT router with an activated OpenVPN service. I have created the following startup script which I was hoping would exclude Netflix from the VPN tunnel. However, I havent succeeded just yet. When I lookup the ip at whatsmyip.org I still get the ip of the VPN server, not my own. Can you see what is wrong?

SCRIPT_DIR="/tmp/etc/config" 
SCRIPT="$SCRIPT_DIR/add-routes.wanup" 
mkdir -p $SCRIPT_DIR 

cat << "EOF" > $SCRIPT 
#!/bin/sh 

# dd-wrt selective domain routing 
WAN_GWAY="0.0.0.0"
while [ $WAN_GWAY == "0.0.0.0" ]; do
sleep 3
WAN_GWAY=`nvram get wan_gateway`
done 

# list domains for selective routing 
for domain in \ 
"netflix.com" \ 
"ichnaea.netflix.com" \ 
"movies.netflix.com" \ 
"www.netflix.com" \ 
"nflxext.com" \ 
"cdn1.nflxext.com" \ 
"nflximg.com" \ 
"nflxvideo.net" \ 
"ipv4_1.cxl0.c145.sjc002.ix.nflxvideo.net" \ 
"amazonaws.com" \ 
"whatsmyip.org" 
do 
  # extract ip addresses 
  for ip in $(nslookup $domain | awk '/^Name:/,0{if (/^Addr/)print $3}'); do 
    # add class c route for each ip address to wan gateway 
    ip route add `echo $ip | cut -d . -f 1,2`.0.0/16 via $WAN_GW 
  done 
done 

# flush cache 
ip route flush cache 
EOF 

chmod +x $SCRIPT 
sleep 60 
$SCRIPT
like image 854
7heViking Avatar asked Nov 07 '22 03:11

7heViking


1 Answers

Try using this. Instead of using that list directly specify the routes.

#!/bin/sh 
# specify your own route(s), then place this script in the startup script 
( 
set -x # comment/uncomment to disable/enable debug mode 
WANUP_DIR="/tmp/etc/config" 
WANUP_SCRIPT="$WANUP_DIR/add-routes.wanup" 
mkdir -p $WANUP_DIR 
cat << "EOF" > $WANUP_SCRIPT 
#!/bin/sh 
ip route add 199.199.199.199 via $(nvram get wan_gateway) 
ip route add 177.177.177.0/24 via $(nvram get wan_gateway) <-- Change ips to what you want
EOF 
chmod +x $WANUP_SCRIPT 
) 2>&1 | logger -t $(basename $0)[$$]

for more information and where i found this https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=313324&sid=c64a45234a73595b6e912a7e35f484ea

like image 198
Incisor Avatar answered Dec 05 '22 06:12

Incisor