日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

centos7 NTP服务器搭建

發布時間:2023/12/20 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7 NTP服务器搭建 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

NTP服務器搭建
驗證NTP軟件包是否安裝

[root@localhost ~]# rpm -qa ntp* ntpdate-4.2.6p5-29.el7.centos.2.x86_64 ntp-4.2.6p5-29.el7.centos.2.x86_64

安裝ntp包

[root@localhost ~]# yum -y install ntp

配置ntp配置文件
[root@localhost ~]# yum -y install ntp

# For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).driftfile /var/lib/ntp/drift# Permit time synchronization with our time source, but do notpermit the source to query or modify the service on this system. restrict default nomodify notrap nopeer noquery# Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 192.168.17.10 nomodify notrap nopeer noquery #當前節點ip地址 restrict 127.0.0.1 restrict ::1# Hosts on local network are less restricted. #restrict 192.168.17.2mask 255.255.255.0 nomodify notrap #集群所在網段的網關(Gateway),子網掩碼(Genmask) # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst#選擇一個主節點 在server部分添加一下部分, server 127.127.1.0 Fudge 127.127.1.0 stratum 10 #主節點以外,在server部分添加如下語句,將server指向主節點。 server 192.168.17.10 Fudge 192.168.17.10 stratum 10#broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client

啟動ntp
systemctl start ntpd.service 或 service ntpd start 啟動
systemctl enable ntpd.service
systemctl status ntpd.service 狀態

查看ntp服務器有無和上層ntp連通
ntpstat
查看ntp服務器與上層ntp的狀態
ntpq -p

[root@localhost ~]# ntpq -premote refid st t when poll reach delay offset jitter ============================================================================== *202.118.1.130 .PTP. 1 u 40 64 377 51.713 2.895 4.108 -sv1.ggsrv.de 192.53.103.103 2 u 32 64 177 268.687 27.531 6.991 +tock.ntp.infoma .GPS. 1 u 29 64 353 183.400 -5.123 4.492 +service0-eth4.d 193.6.222.95 2 u 41 64 167 210.721 -5.117 26.617LOCAL(0) .LOCL. 5 l 604 64 0 0.000 0.000 0.000

remote:本機和上層ntp的ip或主機名,“+”表示優先,“*”表示次優先

refid:參考上一層ntp主機地址

st:stratum階層

when:多少秒前曾經同步過時間

poll:下次更新在多少秒后

reach:已經向上層ntp服務器要求更新的次數

delay:網絡延遲

offset:時間補償

jitter:系統時間與bios時間差

查看ntpd進程的狀態
【命令】watch “ntpq -p”

【終止】按 Ctrl+C 停止查看進程。

第一列中的字符指示源的質量。星號 ( * ) 表示該源是當前引用。

remote:列出源的 IP 地址或主機名。

when:指出從輪詢源開始已過去的時間(秒)。

poll:指出輪詢間隔時間。該值會根據本地時鐘的精度相應增加。

reach:是一個八進制數字,指出源的可存取性。值 377 表示源已應答了前八個連續輪詢。

offset:是源時鐘與本地時鐘的時間差(毫秒)。

設置開機啟動

chkconfig ntpd on

總結

以上是生活随笔為你收集整理的centos7 NTP服务器搭建的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。