婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Linux系統(tǒng)下NTP協(xié)議的超級配置攻略

Linux系統(tǒng)下NTP協(xié)議的超級配置攻略

熱門標簽:電話機器人服務器部署 江蘇小型外呼系統(tǒng)軟件 常熟外呼系統(tǒng) 地圖上標注點位的圖標 拉薩銷售外呼系統(tǒng)軟件 文山外呼營銷系統(tǒng) 百度地圖標注未成功 中山防封卡電銷卡辦理 電銷語音機器人哪個好
在Linux系統(tǒng)中,為了避免主機時間因為在長時間運行下所導致的時間偏差,進行時間同步(synchronize)的工作是非常必要的。Linux系統(tǒng)下,一般使用ntp服務來同步不同機器的時間。NTP 是網(wǎng)絡時間協(xié)議(Network Time Protocol)的簡稱,干嘛用的呢?就是通過網(wǎng)絡協(xié)議使計算機之間的時間同步化。

安裝NTP包

檢查是否安裝了ntp相關包。如果沒有安裝ntp相關包,使用rpm或yum安裝,安裝也非常簡單方便。
 

復制代碼
代碼如下:

[root@localhost ~]# rpm -qa | grep
ntpntpdate-4.2.6p5-1.el6.x86_64
fontpackages-filesystem-1.41-1.1.el6.noarch
ntp-4.2.6p5-1.el6.x86_64
 

NTP的配置


A: 配置/etc/ntp.conf

NTP Server的主要配置文件為/etc/ntp.conf ,沒有修改過的ntp.conf文件內(nèi)容如下所示,配置選項都有相關注釋信息(Linux 版本為Red Hat Enterprise Linux Server release 6.6 )

復制代碼
代碼如下:

[root@localhost ~]# more /etc/ntp.conf
# 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 not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod 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 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst


#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

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
[root@localhost ~]# more /etc/ntp.conf
# 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 not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod 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 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst


#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

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
各個選項信息:
#系統(tǒng)時間與BIOS事件的偏差記錄
driftfile /etc/ntp/drift

 

restrict 控制相關權限。

語法為: restrict IP地址 mask 子網(wǎng)掩碼 參數(shù)

其中IP地址也可以是default ,default 就是指所有的IP

參數(shù)有以下幾個:

ignore  :關閉所有的 NTP 聯(lián)機服務

nomodify:客戶端不能更改服務端的時間參數(shù),但是客戶端可以通過服務端進行網(wǎng)絡校時。

notrust :客戶端除非通過認證,否則該客戶端來源將被視為不信任子網(wǎng)

noquery :不提供客戶端的時間查詢:用戶端不能使用ntpq,ntpc等命令來查詢ntp服務器

notrap :不提供trap遠端登陸:拒絕為匹配的主機提供模式 6 控制消息陷阱服務。陷阱服務是 ntpdq 控制消息協(xié)議的子系統(tǒng),用于遠程事件日志記錄程序。

nopeer :用于阻止主機嘗試與服務器對等,并允許欺詐性服務器控制時鐘

kod : 訪問違規(guī)時發(fā)送 KoD 包。

restrict -6 表示IPV6地址的權限設置。

1:設定NTP主機來源(其中prefer表示優(yōu)先主機),192.168.7.49是本地的NTP服務器,所以優(yōu)先指定從該主機同步時間。
 

復制代碼
代碼如下:

server 192.168.7.49 prefer
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst


2:限制你允許的這些服務器的訪問類型,在這個例子中的服務器是不容許修改運行時配置或查詢您的Linux NTP服務器
 

復制代碼
代碼如下:

restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap

在上例中,掩碼地址擴展為255,因此從192.168.0.1-192.168.0.254的服務器都可以使用我們的NTP服務器來同步時間

 

復制代碼
代碼如下:

#此時表示限制向從192.168.0.1-192.168.0.254這些IP段的服務器提供NTP服務。
restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap noquery

#設置默認策略為允許任何主機進行時間同步
restrict default ignore

 

3:確保localhost(這個常用的IP地址用來指Linux服務器本身)有足夠權限.使用沒有任何限制關鍵詞的語法:

復制代碼
代碼如下:

restrict 127.0.0.1
restrict -6 ::1

 

B:配置/etc/ntp/stpe-tickers文件

修改/etc/ntp/stpe-tickers文件,內(nèi)容如下(當ntpd服務啟動時,會自動與該文件中記錄的上層NTP服務進行時間校對)

復制代碼
代碼如下:

[root@localhost ntp]# more /etc/ntp/step-tickers
# List of servers used for initial synchronization.
[root@localhost ntp]# vi /etc/ntp/step-tickers
# List of servers used for initial synchronization.
server 192.168.7.49 prefer
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
server 3.rhel.pool.ntp.org



C:配置/etc/sysconfig/ntpd文件

ntp服務,默認只會同步系統(tǒng)時間。如果想要讓ntp同時同步硬件時間,可以設置/etc/sysconfig/ntpd文件,在/etc/sysconfig/ntpd文件中,添加 SYNC_HWCLOCK=yes 這樣,就可以讓硬件時間與系統(tǒng)時間一起同步。

復制代碼
代碼如下:

#允許BIOS與系統(tǒng)時間同步,也可以通過hwclock -w 命令
SYNC_HWCLOCK=yes

 

IPTABLES 配置

由于NTP服務需要使用到UDP端口號123,所以當系統(tǒng)的防火墻(Iptables)啟動的情況下,必須開放UDP端口號123。

復制代碼
代碼如下:

[root@localhost ~]# /etc/init.d/iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

[root@localhost ~]# /sbin/iptables -I INPUT -p udp --dport 123 -j ACCEPT
[root@localhost ~]# /etc/init.d/iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:123
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
3 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
6 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

[root@localhost ~]#


如果防火墻沒有開放UDP端口號123,有可能出現(xiàn)下面情況。

復制代碼
代碼如下:

[root@localhost ~]# /usr/sbin/ntpq -c rv | grep stratum
stratum=16, precision=-24, rootdelay=0.000, rootdisp=3.525, refid=INIT,
[root@localhost~]#
A stratum level of 16 indicates that NTP is not synchronizing correctly.If a stratum level of 16 is detected, wait 15 minutes and issue the command again. It may take this long for the NTP server to stabilize.If NTP continues to detect a stratum level of 16, verify that the NTP port (UDP Port 123) is open on all firewalls between the cluster and the remote machine you are attempting to synchronize to.

 

啟動NTP服務

復制代碼
代碼如下:

[root@localhost ~]# service ntpd status
ntpd is stopped
[root@localhost ~]# service ntpd start
Starting ntpd: [ OK ]
[root@localhost ~]#

service ntpd status #查看ntpd服務狀態(tài)
service ntpd start #啟動ntpd服務
service ntpd stop #停止ntpd服務
service ntpd restart #重啟ntpd服務
檢查ntp服務是否開機啟動,將其設置為開機啟動。
[root@localhost ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost ~]# runlevel
N 3
[root@localhost ~]# chkconfig ntpd on #在運行級別2、3、4、5上設置為自動運行
[root@localhost ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost ~]#

如果要設置在運行級別上自動運行,可以使用下面命令

復制代碼
代碼如下:

chkconfig --level 345 ntpd on

可以用下面命令檢測NTP服務是否運行

復制代碼
代碼如下:

[root@localhost ~]# pgrep ntpd
2639
2641
[root@localhost ~]# netstat -tlunp | grep ntp #如果看到123端口,說明ntp服務成功啟動。
udp 0 0 192.168.7.224:123 0.0.0.0:* 2639/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 2639/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 2639/ntpd
udp 0 0 fe80::250:56ff:feb3:b5:123 :::* 2639/ntpd
udp 0 0 ::1:123 :::* 2639/ntpd
udp 0 0 :::123 :::* 2639/ntpd
[root@localhost ~]#


查看ntp服務器有無和上層ntp連通

復制代碼
代碼如下:

[root@localhost ~]# ntpstat
synchronised to NTP server (192.168.7.49) at stratum 6
time correct to within 440 ms
polling server every 128 s
[root@localhost ~]#

查看ntp服務器與上層ntp的狀態(tài)

remote   - 本機和上層ntp的ip或主機名,“+”表示優(yōu)先,“*”表示次優(yōu)先

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

st       - stratum階層

when     - 多少秒前曾經(jīng)同步過時間

poll     - 下次更新在多少秒后

reach    - 已經(jīng)向上層ntp服務器要求更新的次數(shù)

delay    - 網(wǎng)絡延遲

offset   - 時間補償

jitter   - 系統(tǒng)時間與bios時間差

要查看 ntpd 進程的狀態(tài),請運行以下命令,按 Ctrl+C 停止查看進程。

remote   - 本機和上層ntp的ip或主機名,“+”表示優(yōu)先,“*”表示次優(yōu)先

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

st       - stratum階層

when     - 多少秒前曾經(jīng)同步過時間

poll     - 下次更新在多少秒后

reach    - 已經(jīng)向上層ntp服務器要求更新的次數(shù)

delay    - 網(wǎng)絡延遲

offset   - 時間補償

jitter   - 系統(tǒng)時間與bios時間差

要查看 ntpd 進程的狀態(tài),請運行以下命令,按 Ctrl+C 停止查看進程。

標簽:鶴壁 景德鎮(zhèn) 威海 海北 天門 欽州 河南 黔南

巨人網(wǎng)絡通訊聲明:本文標題《Linux系統(tǒng)下NTP協(xié)議的超級配置攻略》,本文關鍵詞  Linux,系統(tǒng),下,NTP,協(xié)議,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Linux系統(tǒng)下NTP協(xié)議的超級配置攻略》相關的同類信息!
  • 本頁收集關于Linux系統(tǒng)下NTP協(xié)議的超級配置攻略的相關信息資訊供網(wǎng)民參考!
  • 推薦文章
    婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av
    国内成+人亚洲+欧美+综合在线| 一区二区三区精品在线| 欧洲另类一二三四区| 成人免费毛片嘿嘿连载视频| 国产精品白丝jk黑袜喷水| 美国十次综合导航| 国产自产高清不卡| 国产成人精品亚洲午夜麻豆| 国产成+人+日韩+欧美+亚洲| 粉嫩欧美一区二区三区高清影视| 国产传媒一区在线| 成人久久久精品乱码一区二区三区| 国产成人一级电影| 91猫先生在线| 欧美日韩国产小视频在线观看| 欧美三级视频在线播放| 欧美一级久久久久久久大片| 欧美精品一区二区三区久久久| 日韩一级片在线播放| 亚洲精品一区二区三区福利| 久久久久久夜精品精品免费| 中文字幕一区二区三| 亚洲成在人线在线播放| 日产国产高清一区二区三区| 九九热在线视频观看这里只有精品| 九九久久精品视频| 91麻豆国产自产在线观看| 欧美日韩和欧美的一区二区| 精品伦理精品一区| 中文字幕av一区 二区| 洋洋成人永久网站入口| 久久97超碰色| 91久久精品一区二区| 欧美一区二区私人影院日本| 国产欧美精品区一区二区三区 | 成人h动漫精品一区二区| 91麻豆高清视频| 精品日韩在线观看| 一区二区三区在线免费播放| 极品少妇一区二区三区精品视频| 色哟哟日韩精品| 2023国产精华国产精品| 亚洲国产日韩综合久久精品| 国产毛片精品一区| 欧美日韩一区二区在线观看视频| 欧美va在线播放| 天天影视涩香欲综合网| 成人精品国产免费网站| 欧美一级理论片| 一区二区三国产精华液| 成人午夜精品一区二区三区| 欧美二区在线观看| 一区二区三区在线免费播放| 狠狠色狠狠色综合| 欧美精品乱码久久久久久按摩 | 日韩欧美国产一二三区| 成人欧美一区二区三区白人 | 欧美高清在线一区二区| 蜜乳av一区二区| 欧美日韩激情一区二区三区| 亚洲视频一区二区在线| 成人免费不卡视频| 国产日韩精品视频一区| 精品亚洲porn| 精品国产亚洲一区二区三区在线观看| 亚洲图片有声小说| 欧美日韩综合色| 亚洲一区二区黄色| 91久久精品一区二区三区| 亚洲女同ⅹxx女同tv| 成人动漫在线一区| 国产精品久久久久一区二区三区共| 国产高清不卡二三区| 国产三级精品三级在线专区| 国产成人一级电影| 国产精品丝袜一区| 91亚洲男人天堂| 亚洲欧美国产77777| 色婷婷国产精品久久包臀| 亚洲欧美偷拍另类a∨色屁股| 97精品久久久久中文字幕| 国产精品国产三级国产三级人妇 | 欧美吞精做爰啪啪高潮| 亚洲精品第1页| 欧美影视一区二区三区| 亚洲电影在线免费观看| 欧美人伦禁忌dvd放荡欲情| 亚洲成人av在线电影| 91精品国产欧美一区二区18| 久久精品国产亚洲a| 久久精品视频一区二区| 99久久婷婷国产| 亚洲一区二区三区自拍| 欧美大片在线观看| 高清av一区二区| 夜夜嗨av一区二区三区| 日韩免费在线观看| 大美女一区二区三区| 亚洲人成精品久久久久| 欧美一区二区三区小说| 国产成人精品亚洲日本在线桃色| 亚洲黄色免费网站| 欧美成人一区二区| 色又黄又爽网站www久久| 捆绑紧缚一区二区三区视频| 国产精品久久国产精麻豆99网站| 欧美视频在线观看一区| 国产精品一二三区在线| 亚洲第一在线综合网站| 久久综合色婷婷| 欧美亚日韩国产aⅴ精品中极品| 青青草97国产精品免费观看 | 本田岬高潮一区二区三区| 亚洲综合av网| 久久久蜜臀国产一区二区| 欧美日韩情趣电影| 高潮精品一区videoshd| 日韩极品在线观看| ...xxx性欧美| 久久色在线观看| 欧美日韩免费观看一区二区三区| 床上的激情91.| 蜜桃视频在线观看一区| 国产精品不卡在线| 精品奇米国产一区二区三区| 欧美日韩精品系列| 99久久久精品| 国产精品综合在线视频| 麻豆精品一区二区三区| 亚洲午夜激情av| 亚洲伦理在线免费看| 国产精品另类一区| 久久久久国产精品麻豆ai换脸| 91麻豆精品91久久久久同性| 99国产精品一区| 99久久精品免费看国产 | 欧美日韩国产一二三| 色偷偷成人一区二区三区91 | 99久久亚洲一区二区三区青草| 激情综合网最新| 蜜乳av一区二区| 免费人成黄页网站在线一区二区 | 国内精品不卡在线| 捆绑调教一区二区三区| 精品中文字幕一区二区| 久久精品久久精品| 美女性感视频久久| 久久99在线观看| 蜜桃久久精品一区二区| 六月丁香综合在线视频| 日产精品久久久久久久性色| 亚洲成年人影院| 免费观看久久久4p| 久久精品国产77777蜜臀| 精品中文av资源站在线观看| 国产在线麻豆精品观看| 国产高清不卡二三区| aaa欧美色吧激情视频| 色偷偷久久一区二区三区| 色成年激情久久综合| 欧美日韩高清在线| 91.成人天堂一区| xnxx国产精品| 国产精品免费视频一区| 亚洲欧美日韩一区二区| 亚洲无人区一区| 日本午夜精品视频在线观看| 国产一区二区免费看| 成人av免费在线| 欧美无砖砖区免费| 26uuu亚洲综合色欧美| 亚洲天堂精品视频| 亚洲mv在线观看| 国产麻豆成人传媒免费观看| www.欧美亚洲| 欧美精品aⅴ在线视频| 久久久不卡网国产精品二区| 自拍偷拍国产精品| 日韩av中文字幕一区二区三区| 狠狠色丁香婷综合久久| 成人免费视频一区二区| 欧美三级中文字幕在线观看| 欧美一区二区在线不卡| 国产欧美综合在线观看第十页| 亚洲婷婷综合色高清在线| 无吗不卡中文字幕| 粉嫩av一区二区三区粉嫩| 欧美性受xxxx黑人xyx| 久久久久一区二区三区四区| 亚洲午夜激情网站| 高清不卡一区二区在线| 欧美久久一区二区| 亚洲色图一区二区三区| 久久99久久99精品免视看婷婷| 成人黄色片在线观看| 欧美sm美女调教| 性久久久久久久久| 不卡的av电影在线观看| 日韩一级高清毛片| 亚洲精品高清视频在线观看|