Linux的NTP的配置
Linux下的NTP伺服器:
Linux下快速搭建ntp時間同步伺服器:
Linux的NTP配置總結:
https://www.cnblogs.com/kerrycode/archive/2015/08/20/4744804.html
安裝環境:
Red Hat Enterprise Linux Server release 6.7 (Santiago)
一、檢查服務端、客戶端的ntp包是否已經安裝,預設是安裝的:
rpm -qa | grep ntp
rpm -q ntp
二、服務端
1.編輯ntp伺服器的配置檔案/etc/ntp.conf:
server 127.127.1.0 #把本機作為ntp服務端
fudge 127.127.1.0 stratum 0 #這行是時間伺服器的層次。設為0則為頂級,如果要向別的NTP伺服器更新時間,請不要把它設為0
2.重啟ntp服務:
service ntp restart(Ubuntu)
service ntpd restart(CentOS、linux)
systemctl restart ntpd(CentOS7.X、redhat linux 7以上)
3.ntp伺服器的防火牆放行ntp的123埠:(如果iptable防火牆關閉則不必要做,跳過即可)
/sbin/iptables -I INPUT -p udp --dport 123 -j ACCEPT
/etc/init.d/iptables status
netstat -tlunp | grep ntp
4.檢查ntp服務是否開機啟動,將其設定為開機啟動
chkconfig --list ntpd
chkconfig --level 345 ntpd on
三、
客戶端ntp client
1.編輯ntp客戶端的配置檔案/etc/ntp.conf,新增server_ip:
server server_ip
2.啟動後,一般需要5-10分鐘左右的時候才能與外部時間伺服器開始同步時間。可以透過命令查詢NTPD服務情況。
service ntpd restart
--檢視狀態:
ntpq -p
或者
watch "ntpq –p"
--檢視ntp伺服器有無和上層ntp連通:
ntpstat
--如果需要,手工同步,則需要先將client的ntp服務停掉:
servict ntpd stop
ntpdate ntpserver_ip
3.
檢查ntp服務是否開機啟動,將其設定為開機啟動
chkconfig --list ntpd
chkconfig --level 345 ntpd on
例項:
客戶端:
[root@one ~]# grep -v ^# /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
server 192.168.56.20 prefer
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
[root@one ~]#
[root@one ~]#
ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
192.168.56.20 .LOCL. 1 u 27 64 177 0.167 2100350 8577226
[root@one ~]#
[root@one ~]#
ntpstat
synchronised to unspecified at stratum 2
time correct to within 14779 ms
polling server every 64 s
[root@one ~]#
服務端端server_ip端:
[root@slient ~]# grep -v ^# /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
server 127.127.1.0
fudge 127.127.1.0 stratum 0
[root@slient ~]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2148396/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux伺服器配置---ntpLinux伺服器
- linux 配置ntp時間伺服器Linux伺服器
- Linux NTP工具的基本使用Linux
- 自動批量對linux伺服器安裝配置NTP服務Linux伺服器
- 如何在 Linux 上安裝、配置 NTP 伺服器和客戶端?Linux伺服器客戶端
- CentOS 配置阿里雲 NTP 服務CentOS阿里
- Linux系統檢視ntp是否同步的方法有幾種?Linux
- GPS對時裝置(GPS對時系統)LINUX系統下配置NTP方法Linux
- Windows server 2012 R2配置NTP ServerWindowsServer
- 如何在 Linux 下確認 NTP 是否同步?Linux
- LINUX 解決時間同步問題(NTP)Linux
- 配置Linux的網路Linux
- Linux系統時間同步方法小結(NTP)Linux
- NTP時間伺服器優先順序配置伺服器
- Linux使用ntp時間伺服器同步時間Linux伺服器
- ntp導致的時鐘回撥
- 如何安裝和配置 Chrony 作為 NTP 客戶端?客戶端
- realvnc linux,realvnc linux配置的8個步驟VNCLinux
- Linux CentOS 7 下 Redis 的配置LinuxCentOSRedis
- linux中的firewalld防火牆配置Linux防火牆
- linux ftp服務的搭建配置LinuxFTP
- linux下配置好的快捷鍵Linux
- linux配置本地ISO的yum源Linux
- Linux Vim編輯的的配置和使用Linux
- Linux上的redis的安裝和配置LinuxRedis
- Ubuntu的NTP同步時鐘設定方法Ubuntu
- Linux環境下如何驗證提供時間校準的NTP伺服器是否可用Linux伺服器
- Linux叢集環境下NTP伺服器時間同步Linux伺服器
- JB的測試之旅-Linux下配置Linux
- windows的vscode中配置linux環境WindowsVSCodeLinux
- 基於Linux的mysql主從配置LinuxMySql
- Linux環境下的Android的ADK安裝配置LinuxAndroid
- Linux下Java環境變數的配置LinuxJava變數
- 幾種Linux網路配置工具的使用Linux
- the NTP socket is in use, exiting
- NTP時間同步
- linux基礎:1、linux簡介、虛擬化軟體的安裝與配置、Xshell的安裝與配置Linux
- 淺談基於 NTP 的反射和放大攻擊反射
- 如何使用linux的伺服器需要進行的配置Linux伺服器