Ntp time synchronization in Linux

Synchronize with the clock server provided on the Internet when connected to the Internet

Synchronization command: ntpdate ntp4.aliyun.com (a free time server provided by Alibaba Cloud)

Configure clock synchronization in offline state

1. Set the time of the clock synchronization server (node03 2012-12-12 12:12:12)

Synchronize node01 node02 time with node03

2. Modify the first configuration file /etc/ntp.conf

Add the following content

restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap ​ server 127.127.1.0 # localclock ​ fudge 127.127.1.0 stratum 10

Annotate future servers

#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. Modify the second configuration file vi /etc/sysconfig/ntpd

Add the following content

SYNC_HWLOCK=yes

4. Restart the ntp service

/etc/init.d/ntpd restart

5. Clock synchronization

Synchronize on node01 node02

Command ntpdate node03 (clock server)

ntpdate 192.168.100.133 (clock server)

Guess you like

Origin blog.csdn.net/Dreamy_zsy/article/details/103010961