- 下载
Index of /~ntp/ntp_spool/ntp4
https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.8p17.tar.gz
- 编译openssl
LINUX下载编译OpenSSL_openssl-1.0.2u编译-CSDN博客
- 编译
DEST_DIR=/home/toybrick/ntp_serverif [ -d ${DEST_DIR} ]; thenrm -rf ${DEST_DIR}
fi./configure \--prefix=${DEST_DIR} \--enable-all-clocks \--enable-parse-clocksmake
make install
- 配置
具体何意吾亦不知
#restrict default nomodify notrap noquery
restrict 127.0.0.1
restrict 192.168.120.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 5
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
keys /etc/ntp/keys
- 运行server
cd /usr/local/ntp/sbin
./ntpd -c ./ntp.conf
- 检查server
ps aux | grep ntp
root 4215 0.0 0.0 7436 2784 ? Ss 13:49 0:00 ./ntpd -c ./ntp.conf
- 同步时间
sudo ntpdate 192.168.1.126
2024-02-21 14:04:21.33743 (+0800) +3.118318 +/- 0.000550 192.168.1.126 s6 no-leap
CLOCK: time stepped by 3.118318