NTPサーバーの展開とクライアントの自動同期

1.使用シナリオ:少なくとも1つのサーバーを外部ネットワークに接続でき、他のサーバーを外部ネットワークに接続できません。
NTPサーバーの展開とクライアントの自動同期

2.サーバーのインストール

yum -y install ntp ntpdate
ntpdate 0.asia.pool.ntp.org
hwclock --systohc       
systemctl enable ntpd         
systemctl start ntpd

配置ntp文件 vim /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict ::1
允许内网其他机器同步时间
restrict 192.168.206.0 mask 255.255.255.0 nomodify notr
定义使用的上游 ntp服务器,将原来的注释
server 0.asia.pool.ntp.org
定义使用的上游 ntp服务器,将原来的注释
restrict 0.asia.pool.ntp.org nomodify notrap noquery
定义使用的上游 ntp服务器,将原来的注释
server 127.127.1.0
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys

ntpq-pノードリストの表示
NTPサーバーの展開とクライアントの自動同期

3.クライアントの展開
サーバーの/ usr / sbin / ntpdateファイルをクライアントの/ usr / sbin /ディレクトリにコピーします

同期ファイルvim / usr / local / sbin / ntpdate.shを書き込みます

ntpdate -u 172.16.90.37
hwclock --systohc

crontab-e書き込みタイミングタスク

          • /usr/local/sbin/ntpdate.sh >> /tmp/ntp.log

おすすめ

転載: blog.51cto.com/14033037/2545133