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

首頁(yè) > 服務(wù)器 > Linux服務(wù)器 > 正文

linux配置ntp服務(wù)器的方法

2024-09-05 23:03:14
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

一.安裝ntp軟件

1.檢查是否安裝了ntp相關(guān)包。
rpm -qa | grep ntp

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

二.參數(shù)講解

ignore  :關(guān)閉所有的 NTP 聯(lián)機(jī)服務(wù)

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

notrust :客戶端除非通過(guò)認(rèn)證,否則該客戶端來(lái)源將被視為不信任子網(wǎng)

noquery :不提供客戶端的時(shí)間查詢:用戶端不能使用ntpq,ntpc等命令來(lái)查詢ntp服務(wù)器

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

nopeer :用于阻止主機(jī)嘗試與服務(wù)器對(duì)等,并允許欺詐性服務(wù)器控制時(shí)鐘

kod : 訪問(wèn)違規(guī)時(shí)發(fā)送 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.設(shè)置允許任何IP的客戶機(jī)都可以進(jìn)行時(shí)間同步(修改后的配置文件)

# 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網(wǎng)段的客戶機(jī)進(jìn)行時(shí)間同步(修改后的配置文件)

# 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

四.啟動(dòng)NTP服務(wù)和防火墻

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設(shè)置
vi /etc/sysconfig/ntpd#允許BIOS與系統(tǒng)時(shí)間同步,添加下面一行。
SYNC_HWCLOCK=yes

五.檢測(cè)NTP

1.檢測(cè)NTP服務(wù)是否運(yùn)行

# 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服務(wù)器有無(wú)和上層ntp連通

# ntpstatsynchronised to NTP server (120.25.108.11) at stratum 3  time correct to within 99 ms  polling server every 64 s

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

# 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.000x202.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.944remote  - 本機(jī)和上層ntp的ip或主機(jī)名,“+”表示優(yōu)先,“*”表示次優(yōu)先refid  - 參考上一層ntp主機(jī)地址st    - stratum階層when   - 多少秒前曾經(jīng)同步過(guò)時(shí)間poll   - 下次更新在多少秒后reach  - 已經(jīng)向上層ntp服務(wù)器要求更新的次數(shù)delay  - 網(wǎng)絡(luò)延遲offset  - 時(shí)間補(bǔ)償jitter  - 系統(tǒng)時(shí)間與bios時(shí)間差

六.配置時(shí)間同步客戶機(jī)

1.執(zhí)行ntpdate命令:

ntpdate 192.168.1.101 #192.168.1.101為ntp服務(wù)器IP地址

2.寫入BIOS

hclock -w

3.crond服務(wù)

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

4.重啟crond服務(wù)

service crond restart

以上就是小編為大家?guī)?lái)的linux配置ntp服務(wù)器的方法全部?jī)?nèi)容了,希望大家多多支持VEVB武林網(wǎng)~

 

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 淮南市| 西畴县| 砚山县| 怀柔区| 泽库县| 山阴县| 伊宁县| 左贡县| 岗巴县| 达日县| 清远市| 沭阳县| 乌鲁木齐市| 克什克腾旗| 剑阁县| 霍邱县| 三原县| 樟树市| 翁源县| 东乡| 江津市| 论坛| 舟山市| 石门县| 赫章县| 剑阁县| 肥城市| 诏安县| 云梦县| 六安市| 吉安县| 太仆寺旗| 清水县| 丽江市| 德格县| 安岳县| 永年县| 灌南县| 湖口县| 荆州市| 合川市|