Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos synchronization time

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Time synchronization and Network synchronization of centos system

Generally speaking, the newly installed centos system server may have the wrong time or set the wrong time zone, so you can use NTP to synchronize from the time server.

1. Adjust the current time zone to Shanghai + 8 zone, or other time zones if you want. In the / usr/share/zoneinfo directory

Cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

two。 Install ntpdate

Yum install-y ntpdate

3. Use ntpdate to synchronize standard time (or synchronize other time servers)

Ntpdate us.pool.ntp.org

4. Write the synchronized time into bios

Hwclock-w

5. If there is no network, you can set the time manually

Date-s 10:00:00

6. If the above synchronization is successful, you can put it in crontab.

Set the time to synchronize every ten minutes

* / 10 * ntpdate time.nist.gov

List several time servers

Us.pool.ntp.org

Time.nist.gov

Time.nuri.net

Asia.pool.ntp.org

Asia.pool.ntp.org

Asia.pool.ntp.org

Asia.pool.ntp.org

Set up your own time server

1. Install the time synchronization server ntp

Yum install-y ntp

two。 Configure ntp

Vim / etc/ntp.conf

Restrict default ignore / / does not allow modification or query of ntp by default, and does not receive special packet restrict 127.0.0.1 / / give all permissions to the local machine restrict 192.168.1.0 mask 255.255.255.0 notrap nomodify / / give the machine on the local network the right to synchronize time server time.nist.gov prefer / / set the time server Add prefer to indicate priority server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org server 2.asia.pool.ntp.org server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 driftfile / var/lib/ntp/drift keys / etc/ntp/keys

3. Start ntp

/ etc/init.d/ntpd start

Chkconfig ntpd on

4. View and test

Ntpq-pn / / View synchronized server ip

Remote refid st t when poll reach delay offset jitter = 50.77.217.185 .INIT. 16U-64 0 0.000 0.000 0.000 202.90.158.4 .INIT .16 u-64 0 0.000 0.000 0.000 202.71.100.89 .INIT .16 u-64 0 0.000 0.000 0.000 202.134.1.10. INIT. 16 u-64 0 0.000 0.000 0.000 * 127.127.1.0. LOCL. 10 l 18 64 377 0.000 0.000

Remote: that is, the IP or host name of the NTP host. Pay attention to the leftmost symbol. If "+" represents the upper NTP that is currently working on the clock, if it is "*", it means that it is also connected, but as a secondary online NTP host.

Refid: the address of the upper-level NTP host referenced

St: the stratum class

When: time synchronization update was done a few seconds ago

Poll: the next update is in a few seconds

Reach: the number of updates that have been requested from the upper NTP server

Delay: the time of clock delay during network transmission

Offset: the result of time compensation

Difference time between jitter:Linux system time and BIOS hardware time

Recommend the first method, although it is relatively simple to build a time server, but I do not think this is necessary. If you use someone else's time server, synchronize every 10 minutes, which can be accurate to milliseconds.

5. View the results of synchronization

Ntpstat

6. Client configuration

The installation and startup methods are the same, but the configuration of server is different. Change the configuration of server to the server 192.168.103.117 connected to the external network.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report