Linux下NTP服務(wù)器配置詳細過程
更新時間:2021年11月30日 10:05:33 作者:jks212454
大家好,本篇文章主要講的是Linux下NTP服務(wù)器配置詳細過程,感興趣的同學趕快來看一看吧,對你有幫助的話記得收藏一下哦,方便下次瀏覽
一、環(huán)境配置
1.NTP服務(wù)器
NTP服務(wù)器版本:Red Hat Enterprise Linux release 8.0 (Ootpa) NTP服務(wù)器IP:192.168.8.11/24 NTP服務(wù)器hostname:node1
2.業(yè)務(wù)服務(wù)器
NTP服務(wù)器版本:Red Hat Enterprise Linux release 8.0 (Ootpa) NTP服務(wù)器IP:192.168.8.12/24 NTP服務(wù)器hostname:node2
二、NTP服務(wù)器配置
1.查看chrony服務(wù)狀態(tài)
[root@node1 ~]# systemctl status chronyd ● chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:chronyd(8) man:chrony.conf(5) [root@node1 ~]#
2.啟動chrony服務(wù)
[root@node1 ~]# systemctl enable --now chronyd Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
3.關(guān)閉防火墻和selinux
[root@node1 ~]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) [root@node1 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config [root@node1 ~]# setenforce 0 setenforce: SELinux is disabled [root@node1 ~]# getenforce Disabled [root@node1 ~]#
4.配置NTP服務(wù)文件
[root@node1 ~]# vim /etc/chrony.conf [root@node1 ~]# cat /etc/chrony.conf |grep -Ei '(allow|local)' # Allow the system clock to be stepped in the first three updates # Allow NTP client access from local network. #allow 192.168.0.0/16 allow 192.168.8.0/24 local stratum 10 [root@node1 ~]#
5.重啟服務(wù)
[root@node1 ~]# systemctl restart chronyd [root@node1 ~]#
三、業(yè)務(wù)服務(wù)器配置
1.開啟chrony服務(wù)
[root@node2 ~]# systemctl enable --now chronyd Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service. [root@node2 ~]#
2.配置chrony服務(wù)文件
[root@node2 ~]# vim /etc/chrony.conf [root@node2 ~]# cat /etc/chrony.conf |grep pool # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). pool 192.168.8.11 iburst [root@node2 ~]#
3.重啟服務(wù)
[root@node2 ~]# systemctl restart chronyd [root@node2 ~]#
四、測試業(yè)務(wù)服務(wù)器時間狀態(tài)
1.查看時間同步狀態(tài)
[root@node2 ~]# chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^? 192.168.8.12 0 7 0 - +0ns[ +0ns] +/- 0ns [root@node2 ~]#
2.立即時間同步
[root@node2 ~]# chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 192.168.8.11 10 6 17 2 +249ns[ +141us] +/- 100us [root@node2 ~]# chronyc sources -v 210 Number of sources = 1 .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 192.168.8.11 10 6 17 8 +249ns[ +141us] +/- 1103us [root@node2 ~]#
到此這篇關(guān)于Linux下NTP服務(wù)器配置詳細過程的文章就介紹到這了,更多相關(guān)Linux NTP服務(wù)器配置內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
VMware虛擬機安裝Centos操作系統(tǒng)的教程
這篇文章主要為大家詳細介紹了VMware虛擬機安裝Centos操作系統(tǒng)的教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-07-07如何監(jiān)控 Linux 服務(wù)器狀態(tài)的方法
這篇文章主要介紹了如何監(jiān)控 Linux 服務(wù)器狀態(tài)的方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-06-06開發(fā)環(huán)境Ubuntu16安裝以后的初始化設(shè)置
今天小編就為大家分享一篇關(guān)于開發(fā)環(huán)境ubuntu16安裝以后的初始化設(shè)置,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2018-10-10CentOS 8.1下搭建LEMP(Linux+Nginx+MySQL+PHP)環(huán)境(教程詳解)
LEMP是一個軟件堆棧,包含一組免費的開源工具,這些工具用于為高流量和動態(tài)網(wǎng)站提供動力。 這篇文章給大家介紹如何在CentOS 8 Linux發(fā)行版上安裝LEMP服務(wù)器,本文通過實例代碼給大家介紹的非常詳細,對大家的工作或?qū)W習具有一定的參考借鑒價值,需要的朋友參考下吧2020-03-03