環(huán)境:服務(wù)器CentOS勺馆,測(cè)試客戶端Kali
1) 安裝軟件 yum instal ntpd –y
2) 啟動(dòng)ntpd查看狀態(tài)
3) 配置CentOS為本地ntp服務(wù)器(最上游)葬项,對(duì)同網(wǎng)絡(luò)客戶進(jìn)行時(shí)間同步
所有配置文件
driftfile /var/lib/ntp/drift
#1
#允許與我們的時(shí)間源同步時(shí)間,但是不允許源查詢或修改這個(gè)系統(tǒng)上的服務(wù)业栅。
#restrict default nomodify notrap nopeer noquery
#restrict -6 default nomodify notrap nopeer noquery
#restrict 140.143.246.125
restrict 127.0.0.1
#restrict ::1
restrict 192.168.1.0 mask 255.255.255.0 nomodify
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#2
#配置上游服務(wù)器同步時(shí)間
#server 140.143.246.125
#3
#設(shè)置本地主機(jī)作為服務(wù)器 127.127.1.0 代表本機(jī) stratum 0 表示1級(jí)primary reference
#想配置本地時(shí)間服務(wù)器server 127.127.1.0 必須這樣寫(xiě)
server 127.127.1.0 prefer fudge 127.127.1.0 stratum 0
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
4) 配置客戶端連接上游本地ntp服務(wù)器(CentOS)
5)時(shí)間同步測(cè)試
修改服務(wù)器時(shí)間讓客戶機(jī)進(jìn)行同步
客戶端出現(xiàn)時(shí)間差距:等待時(shí)間同步進(jìn)行查看
時(shí)間同步完成