NTP服务器
NTP --------- Network Time Protocol 网络时间协议
软件: ntp
配置文件:/etc/ntp.conf
服务:ntpd
端口:123/udp
示例:配置ntp时间服务器
1) 安装ntp软件
[[email protected] ~]# yum install -y ntp
2) 编辑ntp配置文件
[[email protected] ~]# 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
[[email protected] ~]# systemctl start ntpd
[[email protected] ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[[email protected] ~]#
[[email protected] ~]# 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和防火墙
客户端测试:
[[email protected] ~]# ntpdate 192.168.87.101
11 Nov 12:15:19 ntpdate[13399]: adjust time server 192.168.87.101 offset -0.001224 sec
[[email protected] ~]#