国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

linux配置ntp服務器的方法

2019-11-02 16:43:23
字體:
來源:轉載
供稿:網友

一.安裝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.查看未修改的配置文件

# grep ^[^#] /etc/ntp.conf  driftfile /var/lib/ntp/driftrestrict default nomodify notrap nopeer noqueryrestrict 127.0.0.1restrict ::1server 0.centos.pool.ntp.org iburstserver 1.centos.pool.ntp.org iburstserver 2.centos.pool.ntp.org iburstserver 3.centos.pool.ntp.org iburstincludefile /etc/ntp/crypto/pwkeys /etc/ntp/keysdisable monitor

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

# grep ^[^#] /etc/ntp.conf  driftfile /var/lib/ntp/driftrestrict default nomodify notraprestrict 127.0.0.1restrict ::1server 0.centos.pool.ntp.org iburstserver 1.centos.pool.ntp.org iburstserver 2.centos.pool.ntp.org iburstserver 3.centos.pool.ntp.org iburstincludefile /etc/ntp/crypto/pwkeys /etc/ntp/keysdisable monitor

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

# grep ^[^#] /etc/ntp.conf driftfile /var/lib/ntp/driftrestrict default nomodify notrap nopeer noqueryrestrict 127.0.0.1restrict ::1restrict 192.168.1.0 mask 255.255.255.0 nomodify notrapserver 0.centos.pool.ntp.org iburstserver 1.centos.pool.ntp.org iburstserver 2.centos.ntp.org iburstserver 3.centos.pool.ntp.org iburstincludefile /etc/ntp/crypto/pwkeys /etc/ntp/keysdisable 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服務是否運行

# netstat -tlunp | grep ntpudp    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連通

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 土默特右旗| 水富县| 金阳县| 醴陵市| 崇义县| 明水县| 和政县| 溧水县| 石屏县| 揭东县| 论坛| 白河县| 勐海县| 虹口区| 尼木县| 连云港市| 辽宁省| 嘉峪关市| 乌拉特后旗| 永年县| 冕宁县| 皋兰县| 广河县| 弥勒县| 曲靖市| 会理县| 长沙市| 涪陵区| 进贤县| 泰顺县| 云林县| 康马县| 桑日县| 葵青区| 东明县| 越西县| 荣成市| 东明县| 土默特左旗| 丰原市| 遵义市|