NTP服务器
NTP --------- Network Time Protocol 网络时间协议
软件: ntp
配置文件:/etc/ntp.conf
服务:ntpd
端口:123/udp
示例:配置ntp时间服务器
1) 安装ntp软件
[root@server ~]# yum install -y ntp
2) 编辑ntp配置文件
[root@server ~]# vim /etc/ntp.conf
restrict 192.168.87.0 mask 255.255.255.0 nomodify
server 127.127.1.0 iburst
fudge 127.127.1.0 stratum 10
[root@server ~]# systemctl start ntpd
[root@server ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[root@server ~]#
[root@server ~]# ss -anup | grep :123
UNCONN 0 0 192.168.124.1:123 *:* users:(("ntpd",pid=6092,fd=20))
UNCONN 0 0 192.168.87.101:123 *:* users:(("ntpd",pid=6092,fd=19))
3) 关闭SELinux和防火墙
客户端测试:
[root@node1 ~]# ntpdate 192.168.87.101
11 Nov 12:15:19 ntpdate[13399]: adjust time server 192.168.87.101 offset -0.001224 sec
[root@node1 ~]#