User Tools

Site Tools


ntp

This is an old revision of the document!


NTP(Network Time Protocol,网络时间协议)是通过网络来同步时间的一种协议,网络时间由NTP服务器来提供。 通过修改配置文件/etc/config/system来设置本机所在时区,并指定NTP服务器。可以参考如下设置:

 config system
      option hostname Widora32
      option timezone CST-8
 config timeserver ntp
      list server     0.openwrt.pool.ntp.org
      list server     1.openwrt.pool.ntp.org
      list server     2.openwrt.pool.ntp.org
      list server     3.openwrt.pool.ntp.org
      option enabled 1
      option enable_server 0

各选项说明:

    timezone      	 本机所在时区
    list server     	 NTP服务器列表,可以增删
    enabled        	 是否启用网络时间同步
    enable_server        本机是否作为NTP服务器

如果ntpd未启动,依次执行下面的命令来启动:

 /etc/init.d/sysntpd enable    (设置开机启动)
 /etc/init.d/sysntpd start     (启动)

连接NTP服务器可能需要等待一些时间, 最后执行date命令查看当前时间。

ntp.1525593323.txt.gz · Last modified: (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki