自动重拨脚本
sleep 10
pubip=$(wget -qO - members.3322.org/dyndns/getip)
#从网络获取公网IP
wanip=$(nvram get wan0_ipaddr)
#获取wan口ip
echo "PUBLIC IP:" $pubip
logger "出口IP:$pubip"
echo "WAN IP:" $wanip
logger "WAN口IP:$wanip"
#显示IP
if [[ "$wanip" = "" ]] || [[ "$wanip" = "0.0.0.0" ]]; then
#如果获取的IP是无效,记为错误
echo "Waitting 10 seconds"
logger "等待10秒"
sleep 10
elif [[ "$wanip" == 10.* ]]; then
#如果WAN口IP为10开头的IP,则重拨
echo "WAN IP is in 10.x.x.x range, redialing..."
logger "WAN口IP为10.x.x.x范围,正在重拨"
restart_wan
sleep 10
elif [[ "$pubip" = "$wanip" ]]; then
#如果外网IP和本地IP相同,则保留IP
echo "Dial success"
logger "拨号成功,当前ip:$wanip"
break
else
#如果获取的是内网IP,重拨
echo "Intranet IP:" $wanip
logger "获取到内网ip:$wanip,重拨"
echo "Redial ..."
restart_wan
sleep 10
fi
获取外网IP
checkip.dyndns.org
checkip.dyndns.org:8245
echo.tzo.com
ip.dnsexit.com
ip.changeip.com
myip.dnsomatic.com
ip1.dynupdate.no-ip.com
checkip.dns.he.net
checkip.zerigo.com
checkip.two-dns.de
ipv4.wtfismyip.com/text
ipv4.nsupdate.info/myip
myip.dtdns.com
members.3322.org/dyndns/getip
IPv6防火墙设置
开放特定端口(以80端口为例)
ip6tables -A INPUT -p tcp --dport 80 -j ACCEPT
ip6tables -A OUTPUT -p tcp --sport 80 -j ACCEPT
开放所有端口
ip6tables -F ip6tables -X
ip6tables -P INPUT ACCEPT
ip6tables -P OUTPUT ACCEPT
ip6tables -P FORWARD ACCEPT
固件官网
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
- 最新
- 最热
只看作者