1.编写一个oray.sh脚本
#!/bin/sh
USER="花生壳账户"
PASS="花生壳密码"
DOMAIN="花生壳域名"
IP=`ifconfig pppoe-wan|awk -F "[: ]+" '/inet addr/{print $4}'`
URL="http://${USER}:${PASS}@ddns.oray.com/ph/update?hostname=${DOMAIN}&myip=${IP}"
if [ -f /tmp/oray ]; then
old_ip=`cat /tmp/oray | awk '{ print $2}'`
if [ "${old_ip}" = "${IP}" ]; then
exit
fi
fi
wget -q -O /tmp/oray -q ${URL}
2.执行这个脚本,可以实现域名指向路由器的公网IP,正常使用中会把这个脚本加入到定时任务和开机启动项中