内网服务器时间修改,内网(无网络)搭建ntp时间同步服务
有三臺服務器作為集群,地址分別為:192.168.1.33(以下簡稱33),192.168.1.35(以下35),192.168.1.37(以下37)。都沒有網絡,
這里以33作為ntp服務器,其他兩臺作為客戶端同步33的時間。
1、33服務器下載ntp軟件
yum install -y ntp
2、編輯/etc/ntp.conf
修改
restrict 192.168.1.255(這里為網關地址) mask 255.255.255.0(子網掩碼地址) modify notrap
添加
server 127.127.1.0
fudge 127.127.1.0 stratum 10
注釋
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
3、啟動ntp服務、設置開機自啟ntp
systemctl start ntpd.service
systemctl enable ntpd.service
以上步驟是設置服務器,以下開始設置客戶端
客戶端下載ntp軟件
yum install -y ntp
設置/etc/ntp.conf
修改
restrict 192.168.1.33 nomodify notrap nopeer noquery
添加
server 192.168.1.33
之后,在客戶端執行命令ntpdate 192.168.1.33即可同步時間
利用crontab執行定時任務,比如每10分鐘同步一次服務器時間
/10 * /usr/sbin/ntpdate 192.168.1.33
總結
以上是生活随笔為你收集整理的内网服务器时间修改,内网(无网络)搭建ntp时间同步服务的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OpenJudge NOI 1.7 14
- 下一篇: eclipse mysql jdbc驱动