我有一台具有激活的OpenVPN服务的DD-WRT路由器。我创建了以下启动脚本,希望将其从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
答案 0 :(得分: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