企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# **公告:本知识库已迁移至[https://faq.uniontech.com](https://faq.uniontech.com) ,请访问新知识库。本知识库不再更新维护** ## **方法一:NTP时间同步** NTP基于UDP报文进行传输,使用的UDP端口号为123 一、服务端: 假设ip是192.168.100.100 1、安装ntp 外网:sudo apt install ntp (内网拷贝离线包安装) 2、修改配置文件:vim /etc/ntp.conf 注释默认的时间同步源 #pool 127.0.0.1 iburst #pool 1.debian.pool.ntp.org iburst #pool 2.debian.pool.ntp.org iburst #pool 3.debian.pool.ntp.org iburst 增加以下2行 server 127.127.1.0 fudge 127.127.1.0 stratum 8 修改后,保存退出 3、启动服务并设置服务开机自启 systemctl start ntp && systemctl enable ntp 4、查看侦听端口 netstat -tunlp | grep ntp 或者ss -ntulp | grep ntp 一般是在123端口 timedatectl 查看当前机器时间 ip a 查看服务端ip 二、客户端 客户端需要安装ntpdate的包,输入 ntpdate serverip(服务端配置ntp的ip地址)去同步时间 结果显示类似: 18 Aug 16:04:24 ntpdate[30646]: step time server 10.20.xx.xx offset 47606319.594686 sec PS: 1、如果上述操作不成功,可以 ntpdate -d 192.168.100.100 查看报错详情,然后再去ntpdate 服务端ip 同步时间 2、ntp客户端用ntpdate -d serverip查看,发现有192.168.100.100: Server dropped: strata too high 的错误,这是因为ntp server还没有和其自身或者它的server同步上。可以用ntptrace 和ntpd -s -d 命令,再去ntpdate serverip即可。 ## **方法二:chrony时间同步** 一、服务端: 假设ip是10.20.22.122 1、安装chrony 外网:sudo apt install chrony(内网拷贝离线包安装) 2、修改配置文件 vim /etc/chrony/chrony.conf #pool 2.debian.pool.ntp.org iburst server 10.20.22.122 iburst allow all 允许所有客户端主机 local stratum 10 即使自己未能通过网络时间服务器同步到时间,也允许将本地时间作为标准时间授时给其它客户端。 3、启动服务并设置服务开机自启 systemctl restart chrony && systemctl enable chrony 二、客户端 vim /etc/chrony/chrony.conf #pool 2.debian.pool.ntp.org iburst server 10.20.22.122 iburst systemctl restart chrony systemctl restart chronyd chronyc sources 检查是否同步成功,同步成功会有*,如果未同步成功,可以用chronyc -a makestep 强制同步 ***** 《@版权归统信软件华中技术团队所有》 *****