Linux如何搭建本地时间服务器

2025-05-15 02:46:41
推荐回答(2个)
回答1:

1、安装ntpd
2、vi /etc/ntp.conf
server 指定连接时间服务器
restrict指定允许访问的主机列表
例如
server 210.72.145.44 prefer

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust
3、/etc/init.d/ntpd start 启动ntp服务
4、netstat -nulp检查123UDP端口是否开启
5、在需要同步时钟的主机配置计划任务
0 0 * * * /usr/sbin/ntpdate 192.168.1.9;/sbin/hwclock -w;

回答2:

安装ntpd