OpenWRTの時間設定に関するページです。 †時計 †参考: BusyBoxのdateコマンドは、標準的なdateコマンドと受け付ける形式が違うので注意。(情報源:えびめも(2003-02-07) # date -s "2007.10.28-22:18:00"
でも、再起動すると、また時計が2000年1月1日に戻ってしまう。きちんと運用するには、NTPを使わねばだめか。 時間帯 †OpenWrt/Kamikazeからは Timezone は system.@system[0].timezone に格納されるようになったので、自分の地域の時間帯に変更するには、uci コマンドを使うことになる or /etc/config/system ファイルに記述すればよい。 /etc/config/system ファイルを編集する場合 †日本 †config system option hostname ホスト名 option timezone JST-9 option zonename Asia/Tokyo タイ †config system option hostname ホスト名 option timezone IST-7 option zonename Asia/Bangkok uci コマンドを使う場合 †日本 †# uci set system.@system[0].zonename="Asia/Tokyo" # uci set system.@system[0].timezone=JST-9
タイ †# uci set system.@system[0].zonename="Asia/Bangkok" # uci set system.@system[0].timezone=IST-7
共通 †# uci commit system # timezone=$(uci get system.@system[0].timezone); [ -z "$timezone" ] && timezone=UTC; echo "$timezone" > /tmp/TZ 以上の作業でタイムゾーンがJSTにはなるが、まだ時刻の同期はとれていない。 ntpd †一時的に ntpd パッケージが壊れていた時期があったので、下に示す ntpclient の利用が勧められていた頃もあったが、最近は大丈夫である。 インストール †# opkg install ntpd ntp-utils
設定 †/etc/ntp.conf ファイル中、server パラメータを各自の環境に合わせて編集する。 日本標準時プロジェクト 公開NTPを利用する場合 †server -4 ntp.nict.jp iburst server -4 ntp.nict.jp iburst server -4 ntp.nict.jp iburst 特定の NTP サーバを利用する場合 †server NTPサーバ名 あるいは IPアドレス 複数ある場合は、列挙すればよい。 起動と自動起動の設定 †# /etc/init.d/ntpd start # /etc/init.d/ntpd enable 動作確認 †ntpq コマンドを使えばよい。 # ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp-a3.nict.go. .NICT. 1 u 36 64 377 158.564 10.139 117.826 [#s789a29c]
+ntp-b2.nict.go. .NICT. 1 u 34 64 377 158.396 9.650 139.330
ntpclient †# opkg install ntpclient
/etc/config/ntpclientを編集する。 config ntpclient option hostname 'NTPサーバのIPアドレス' option port '123' option count '1' config ntpclient option hostname 'ntp.ring.gr.jp' option port '123' option count '1' ntpclientを再起動して、時刻をサーバと同期させる。 # ACTION=ifup /etc/hotplug.d/iface/20-ntpclient
|