21 ntpサーバ
1839 ワード
本文は上海の学生の馬振凱から来ます
NTP設置配置
NTP設置配置
1.インストールソフトntpdate
[root@m01 ~]# yum install -y ntp ntpdate
2.ntpサーバプロファイルのバックアップ
[root@m01 ~]# cp /etc/ntp.conf /etc/ntp.conf.bak
3.最適化プロファイルの簡略化
[root@m01 ~]# egrep -v "^$|#" /etc/ntp.conf.bak >/etc/ntp.conf
4.プロファイルの編集
[root@m01 ~]# vim /etc/ntp.conf
ftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
#
restrict 172.16.1.0 mask 255.255.255.0 nomodify notr
#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
# ntp ,
server ntp1.aliyun.com
server time1.aliyun.com
#
restrict time1.aliyun.com nomodify notrap noquery
restrict ntp1.aliyun.com nomodify notrap noquery
# ,
server 127.127.1.0
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
5.NTPサーバーの起動とノードリストの表示[root@m01 ~]# systemctl start ntpd
[root@m01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
120.25.115.20 10.137.53.7 2 u 8 64 1 32.515 2.672 0.000
203.107.6.88 10.137.38.86 2 u 7 64 1 24.061 4.179 0.000
*LOCAL(0) .LOCL. 10 l 6 64 1 0.000 0.000 0.000
6.クライアントテスト[root@web01 ~]# date -s 20190825 #
Sun Aug 25 00:00:00 CST 2019
[root@web01 ~]# ntpdate 172.16.1.61 #
2 Oct 09:22:40 ntpdate[1606]: adjust time server 172.16.1.61 offset 0.001950 sec
[root@m01 ~]# yum install -y ntp ntpdate
[root@m01 ~]# cp /etc/ntp.conf /etc/ntp.conf.bak
[root@m01 ~]# egrep -v "^$|#" /etc/ntp.conf.bak >/etc/ntp.conf
[root@m01 ~]# vim /etc/ntp.conf
ftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
#
restrict 172.16.1.0 mask 255.255.255.0 nomodify notr
#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
# ntp ,
server ntp1.aliyun.com
server time1.aliyun.com
#
restrict time1.aliyun.com nomodify notrap noquery
restrict ntp1.aliyun.com nomodify notrap noquery
# ,
server 127.127.1.0
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
[root@m01 ~]# systemctl start ntpd
[root@m01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
120.25.115.20 10.137.53.7 2 u 8 64 1 32.515 2.672 0.000
203.107.6.88 10.137.38.86 2 u 7 64 1 24.061 4.179 0.000
*LOCAL(0) .LOCL. 10 l 6 64 1 0.000 0.000 0.000
[root@web01 ~]# date -s 20190825 #
Sun Aug 25 00:00:00 CST 2019
[root@web01 ~]# ntpdate 172.16.1.61 #
2 Oct 09:22:40 ntpdate[1606]: adjust time server 172.16.1.61 offset 0.001950 sec