编辑/etc/ntp.conf文件,增加NTP server地址,格式“server <ip address>”
重启ntpd服务生效
[root@host-2:~] cat /etc/ntp.conf
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
driftfile /etc/ntp.drift
server 192.168.1.1
[root@host-2:~] echo "server 10.10.10.1" >> /etc/ntp.conf
[root@host-2:~] cat /etc/ntp.conf
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
driftfile /etc/ntp.drift
server 192.168.1.1
server 10.10.10.1
[root@host-2:~] /etc/init.d/ntpd restart
Stopping ntpd
watchdog-ntpd: Terminating watchdog process with PID 2101076
Starting ntpd
[root@host-2:~] date
Tue May 10 02:34:35 UTC 2022