前提條件:ntp服務器需要與集群在同一網段內,也就是同一VMent中,并且關閉防火墻!! 關閉selinux
1.which ntpd(查看是否安裝ntp)
which chronyd(查看是否安裝chrony)
2.修改ntp組態檔
vim /etc/ntp.conf
有這樣幾行
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
以上全部注釋掉,然后改為自己的配置為:
server 127.127.1.0 iburst (這一行是固定地,作用是:使用當前主機作為時間同步的服務器)
fudge 127.127.1.0 stratum 8(這一行表示當前服務器在整個互聯網時間同步服務器層級中處于第八層,數字越小層級越高)
然后還有這樣兩行
# Hosts on local network are less restricted. (這行表示限制網段的意思)
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap(這行是限制網段的格式)
添加一行,其中的ip為你的主機ip網段,nomodify表示不允許你修改此網段:
restrict 192.168.66.0 mask 255.255.255.0 nomodify
保存退出
重啟ntp systemctl restart ntpd
3.配置網卡ip
vim /etc/sysconfig/network-scripts/ifcfg-ens33
添加兩行
IPADDR=192.168.xxx.xxx (自己向設定的ip地址,但是不可在dhcp服務器自動分配的ip范圍內)
PREFIX=24(子網掩碼)
修改一行
PROXY_METHOD="none" 或者="static"
如果是克隆的,把UUID那一行洗掉
保存退出
4.重啟網卡
systemctl restart network
5.測驗
用同一網段的虛擬機測驗輸入
ntpdate 192.168.124.117(服務端ip)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/2227.html
標籤:其他
上一篇:計算點到直線的距離】 C#實作
下一篇:Linux CentOS7
