如何使用一台 Linux 服务器同步其他服务器的时间?
接下来讲讲时间服务器端的配置,这里以 192.168.10.1 为例。
第一步先安装 ntp 软件包,执行 # rpm -ivh ntp-4.1.2-4.EL3.1.i386.rpm。
然后编辑 # vi /etc/ntp.conf,把 restrict default ignore 这一行注释掉,再加入 restrict 192.168.10.0 mask 255.255.255.0 notrust nomodify notrap。
接着编辑 # vi /etc/ntp/step-tickers,写入一行 pool.ntp.org,这样每次 ntpd 启动时都会自动连接这个国际标准时间服务器。
最后用 # service ntpd start 启动服务,再执行 # netstat -an |grep 123 来确认 123 端口是以 udp 方式开放的。