-
Notifications
You must be signed in to change notification settings - Fork 289
路由器时间同步
Haruhi edited this page Sep 23, 2016
·
1 revision
使用端口扫描软件对学校内网进行扫描(192、10、172、以及你学校的教育网网段),找到123端口,然后在系统管理界面填入地址即可。
参考这里,使用curl访问一个内网网页,获取到服务器地址,这样就可以时间同步
timesyn.sh
#!/bin/sh
uci set network.timesyn='interface'
uci set network.timesyn.proto='pppoe'
uci set network.timesyn.ifname='eth0.2'
uci set network.timesyn.username='wuhan'
uci set network.timesyn.password='wuhan'
uci set network.timesyn.metric='0'
uci commit timesyn
ifup timesyn
uci set firewall.@zone[1].network='wan wan6 netkeeper timesyn'
uci commit firewall
/etc/init.d/firewall restart
date -u "`curl -sI kd.wuhan.net.cn | awk '/Date:/{gsub(/Jan/,"01",$4);gsub(/Feb/,"02",$4);gsub(/Mar/,"03",$4);gsub(/Apr/,"04",$4);gsub(/May/,"05",$4);gsub(/Jun/,"06",$4);gsub(/Jul/,"07",$4);gsub(/Aug/,"08",$4);gsub(/Sep/,"09",$4);gsub(/Oct/,"10",$4);gsub(/Nov/,"11",$4);gsub(/Dec/,"11",$4);print $5"-"$4"-"$3" "$6;}'`"