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

首頁 > 系統 > Linux > 正文

linux配置ntp服務器的方法

2024-08-28 00:03: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 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 文安县| 鸡泽县| 南投县| 萍乡市| 富源县| 娄底市| 十堰市| 新巴尔虎左旗| 门源| 郴州市| 慈利县| 武穴市| 遵义县| 丰都县| 昌吉市| 班戈县| 古丈县| 江都市| 容城县| 富顺县| 巴马| 九龙县| 远安县| 阳原县| 应城市| 万宁市| 屏东市| 姜堰市| 山西省| 芜湖县| 韶关市| 泰和县| 浏阳市| 平安县| 渭源县| 岑溪市| 闻喜县| 武城县| 广安市| 新源县| 花莲市|