5

我有一个激活了 OpenVPN 服务的 DD-WRT 路由器。我创建了以下启动脚本,希望将 Netflix 从 VPN 隧道中排除。但是,我还没有成功。当我在 whatsmyip.org 上查找 ip 时,我仍然得到 VPN 服务器的 ip,而不是我自己的。你能看出有什么问题吗?

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
4

1 回答 1

1

尝试使用这个。而不是使用该列表直接指定路线。

#!/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)[$$]

有关更多信息以及我在哪里找到这个 https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=313324&sid=c64a45234a73595b6e912a7e35f484ea

于 2018-08-14T19:59:28.193 回答