激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務器之家:專注于服務器技術及軟件下載分享
分類導航

Linux|Centos|Ubuntu|系統進程|Fedora|注冊表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務器之家 - 服務器系統 - Linux - linux配置ntp服務器的方法

linux配置ntp服務器的方法

2021-12-09 15:47Linux教程網 Linux

下面小編就為大家帶來一篇linux配置ntp服務器的方法。小編覺得挺不錯的,現在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

linux配置ntp服務器的方法

一.安裝ntp軟件

1.檢查是否安裝了ntp相關包。
rpm -qa | grep ntp

2.安裝ntp軟件。
yum -y install ntp

二.參數講解

ignore  :關閉所有的 NTP 聯機服務

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

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

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

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

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

kod : 訪問違規時發送 KoD 包。

三.修改配置文件

1.查看未修改的配置文件

?
1
2
3
4
5
6
7
8
9
10
11
12
# grep ^[^#] /etc/ntp.conf 
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
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
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor

1.設置允許任何IP的客戶機都可以進行時間同步(修改后的配置文件)

?
1
2
3
4
5
6
7
8
9
10
11
12
# grep ^[^#] /etc/ntp.conf 
driftfile /var/lib/ntp/drift
restrict default nomodify notrap
restrict 127.0.0.1
restrict ::1
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
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor

2.只允許192.168.1.0網段的客戶機進行時間同步(修改后的配置文件)

?
1
2
3
4
5
6
7
8
9
10
11
12
13
# grep ^[^#] /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.ntp.org iburst
server 3.centos.pool.ntp.org iburst
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor

四.啟動NTP服務和防火墻

systemctl start ntpd
systemctl enable ntpd
iptables -A INPUT -p UDP -i eno16777736 -s 192.168.1.0/24 --dport 123 -j ACCEPT
setsebool -P ntp_disable_trans 1#SELinux設置
vi /etc/sysconfig/ntpd#允許BIOS與系統時間同步,添加下面一行。
SYNC_HWCLOCK=yes

五.檢測NTP

1.檢測NTP服務是否運行

?
1
2
3
4
5
6
7
# netstat -tlunp | grep ntp
udp    0   0 192.168.1.101:123    0.0.0.0:*              2563/ntpd    
udp    0   0 127.0.0.1:123      0.0.0.0:*              2563/ntpd    
udp    0   0 0.0.0.0:123       0.0.0.0:*              2563/ntpd    
udp6    0   0 fe80::20c:29ff:fe7b:123 :::*                2563/ntpd    
udp6    0   0 ::1:123         :::*                2563/ntpd    
udp6    0   0 :::123         :::*                2563/ntpd

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

?
1
2
3
4
# ntpstat
synchronised to NTP server (120.25.108.11) at stratum 3
  time correct to within 99 ms
  polling server every 64 s

3.查看ntp服務器與上層ntp的狀態

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ntpq -p
   remote      refid   st t when poll reach  delay  offset jitter
==============================================================================
 news.neu.edu.cn .INIT.     16 u  -  64  0  0.000  0.000  0.000
x202.118.1.130  202.118.1.47   2 u  7  64 377 153.659  9.605 19.941
*time4.aliyun.co 10.137.38.86   2 u  10  64 377  39.666 -47.661 15.944
remote  - 本機和上層ntp的ip或主機名,“+”表示優先,“*”表示次優先
refid  - 參考上一層ntp主機地址
st    - stratum階層
when   - 多少秒前曾經同步過時間
poll   - 下次更新在多少秒后
reach  - 已經向上層ntp服務器要求更新的次數
delay  - 網絡延遲
offset  - 時間補償
jitter  - 系統時間與bios時間差

六.配置時間同步客戶機

1.執行ntpdate命令:

ntpdate 192.168.1.101 #192.168.1.101為ntp服務器IP地址

2.寫入BIOS

hclock -w

3.crond服務

vi /etc/crontab
30 8 * * * root /usr/sbin/ntpdate 192.168.1.101; /sbin/hwclock -w

4.重啟crond服務

service crond restart

以上就是小編為大家帶來的linux配置ntp服務器的方法全部內容了,希望大家多多支持服務器之家~

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产亚洲精久久久久久蜜臀 | 色av成人天堂桃色av | 国产成人aⅴ| 国产精品亚洲欧美 | www成人在线观看 | 久草免费资源视频 | 久久草草亚洲蜜桃臀 | 久久国产一二区 | 久久久久九九九女人毛片 | 精品一区二区三区中文字幕老牛 | 亚洲成人网一区 | 草草影院地址 | 国产精品一区在线免费观看 | 91色爱 | 久久久久国产一区二区三区不卡 | 免费99热在线观看 | 成人午夜久久 | 一级毛片真人免费播放视频 | 神马久久蜜桃 | 空姐一级毛片 | 永久免费毛片 | 欧美一级一区二区三区 | 久久av一区二区 | 欧美福利视频一区二区三区 | 亚洲一区动漫 | 国产妇女乱码一区二区三区 | 欧美成人精品一区 | 国产精品久久久久久久亚洲按摩 | 久久精品网站视频 | 免费男女乱淫真视频 | 国产一级片91 | 色婷婷综合久久久久中文 | 国产精品久久久久免费视频 | 成人国产精品免费 | 少妇色诱麻豆色哟哟 | 免费观看一区二区三区视频 | av不卡毛片 | 久久91亚洲人成电影网站 | 校花被肉干高h潮不断 | 一区二区久久电影 | 欧美日本免费一区二区三区 |