ntp开机无法自启
1.1 查询ntp状态
[root@host-172-18-0-37 ~]# service ntpd status
Redirecting to /bin/systemctl status ntpd.service
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: inactive (dead)
1.2 查询ntp是否设置开机自启
[root@host-172-18-0-37 ~]# systemctl is-enabled ntpd
enabled
说明ntp已经设置开机自启,但是开机启动并未成功。一般引起这个问题的最为常见的原因是系统上安装了一个与NTP相冲突的工具:chrony。
1.3 查询chrony是否被设置为enabled
[root@host-172-18-0-37 ~]# systemctl is-enabled chronyd
enabled
2 解决办法
systemctl disable chronyd
重启机器,查看ntp的状态:
[root@host-172-18-0-37 ~]# service ntpd status
Redirecting to /bin/systemctl status ntpd.service
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-04-27 14:11:59 CST; 4min 12s ago
Process: 632 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 643 (ntpd)
CGroup: /system.slice/ntpd.service
└─643 /usr/sbin/ntpd -u ntp:ntp -g
Apr 27 14:11:59 localhost.localdomain ntpd[643]: Listening on routing socket on fd #20 for interface updates
Apr 27 14:11:59 localhost.localdomain ntpd[643]: 0.0.0.0 c016 06 restart
Apr 27 14:11:59 localhost.localdomain ntpd[643]: 0.0.0.0 c012 02 freq_set kernel 24.633 PPM
Apr 27 14:11:59 localhost.localdomain systemd[1]: Started Network Time Service.
Apr 27 14:12:03 host-172-18-0-37 ntpd[643]: Listen normally on 4 eth0 172.18.0.37 UDP 123
Apr 27 14:12:03 host-172-18-0-37 ntpd[643]: Listen normally on 5 eth0 fe80::f816:3eff:fefa:262c UDP 123
Apr 27 14:12:03 host-172-18-0-37 ntpd[643]: new interface(s) found: waking up resolver
Apr 27 14:12:10 host-172-18-0-37 ntpd[643]: 0.0.0.0 c61c 0c clock_step -225.297501 s
Apr 27 14:08:25 host-172-18-0-37 ntpd[643]: 0.0.0.0 c614 04 freq_mode
Apr 27 14:08:26 host-172-18-0-37 ntpd[643]: 0.0.0.0 c618 08 no_sys_peer