Ubuntu 时间同步
环境说明
- Ubuntu 21.10
问题说明
有个接口报错,debug后是服务器时间跟接口服务器时间对不上,然该服走代理使用ntpdate
时间同步报错
14 Mar 13:18:32 ntpdate[2101582]: no server suitable for synchronization found
关闭代理又正常,然服务代理不能关。
步骤说明
ntpdate 时间同步
安装
apt-get install ntpdate
与网络服务器同步时间ntpdate cn.pool.ntp.org
htpdate 时间同步
因ntp同步失败,使用htpdate进行同步
安装
编译安装:
git clone https://github.com/iridium77/htpdate
make && make installapt-get install htpdate
同步
htpdate -t -s cn.pool.ntp.org |
配置定时同步
crontab -e
0 3 * * * /usr/sbin/htpdate -t -s cn.pool.ntp.org |
参数详细
htpdate -h
htpdate version 1.2.2 |
问题解决
配置netpaln
有遇到报错
root@axinblog:/etc/netplan# vim 00-installer-config.yaml |
参考
netplan generate: gateway4
已被弃用,改用默认路由
Netplan configuration examples
解决
vim /etc/netplan/00-installer-config.yaml
#gateway4: 192.168.1.1 |
应用
netplan apply
参考文献
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Axinの博客!
评论