1. 程式人生 > >linux服務ntp

linux服務ntp

ntp

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] ~]#


本文出自 “lyw666” 博客,請務必保留此出處http://lyw666.blog.51cto.com/12823216/1957478

linux服務ntp