NTP-time synchronization, (Linux/Windows) server is built to time synchronization configuration operation-take it directly

1. NTP server establishment and synchronization configuration (centos8)

1. Install the chrony service (the centos8 system version comes with it, the version before centos8 is the ntpd service)
yum install chrony

2. Start the service
Systemctl start chronyd

Systemctl status chronyd

Systemctl enable chronyd
Insert image description here

3. Configure NTP server
vim /etc/chronyd.conf

1. Add allow 172.31.21.0/24 to allow the network segment to connect to the server, configure and add IPs of different network segments—continue to add a line of allow 192.168.190.0/24

2.Local stratum 12 allows local synchronization. The default value is 10. The value can be increased and configured. Just configure 12 as shown below. Save and restart the chronyd service.
Insert image description here

4. Configure the server IP on the client host: pool 172.31.21.50 iburst, save and restart the service, check that the client has added the server configuration file and display
vim /etc/chrony.conf
Insert image description here

2. Check the synchronization status on the client:

1.chronyc sources -v Check the synchronization status and display the IP just configured. And if there is an * asterisk in front of the IP, it means success^? 2. The timedatectl command fails
Insert image description here
Insert image description here
. If NPT synchronized is yes, the synchronization is completed.Insert image description here

3.chronyc clients View the synchronized host (client) list on the NTP server
Insert image description here

7. After the NTP server has been configured, modify the client makestep 3 -1 parameters to quickly synchronize
Insert image description here

Note: Configuring 2 NTP servers on the client will not take effect. You need to configure an odd number of servers to take effect (1, 3, 5, 7,)

How can chrony decide which is the right one, and which source

has gone crazy. That is why it is always advised to use an odd number of

sources. Three allows one to go crazy and for chrony to know it is the one to

ignore. Five allows 2 to go crazy.

3. NTP server setup configuration and HC configuration (windows server 2016)

(NTP building package)

ntp-4.2.8p15-v2-win32-setup.exe
(just search online and download)

1. Install the windows system on the server, and install the NTP service plug-in in the system, as shown in the figure below, install the NTP service directly
Insert image description here

2. After the default installation, the default path is in the C drive: /Program Files(x86)/NTP directory. Edit the server configuration file, /etc/ntp, and configure it as shown below: restrict default kod nomodify notrap nopeer
noquery

restrict -6 default kod nomodify notrap nopeer noquery

restrict 192.168.122.92 nomodify notrap nopeer noquery

restrict 192.168.122.255 mask 255.255.255.0 nomodify notrap

server 192.168.122.92

server 127.127.1.0

fudge 127.127.1.0 stratum 10

After the configuration is completed, save it, and then restart the NTP service. At this time, the windows NTP server has been fully configured.
Insert image description here
Insert image description here

4. Configure the client on the linux-centos7 version host as follows:

Modify ntp client

vi /etc/ntp.conf

restrict 192.168.122.0 mask 255.255.255.0 nomodify notrap

bring up server 192.168.122.92

Comment out: 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

2. The client checks the ntp status, and manual time synchronization requires turning off the ntp status.

Check the client ntp status: service ntpd status

Shut down the ntpd service: service ntpd stop

The client manually performs time synchronization: ntpdate 192.168.202.76

Wait a few minutes to see if the client time is synchronized: date

Start the ntpd service to check that the service is displayed normally. Use the ntpq -p and timedatectl commands to check the synchronization status.
Insert image description here
Insert image description here
If the post-synchronization time of the Linux system (centos7 version) is eight hours different from the Windows time, you can use the following command to configure the time zone:

1.timedatectl set-local-rtc 1 adjusts the hardware clock to be consistent with the local clock, 0 means setting it to UTC time
2.timedatectl set-timezone Asia/Shanghai sets the system time zone to Shanghai

4. Configure the windowsNTP server on the client as follows:

After adding, directly follow the previous configuration and view the synchronization results on the client:
Insert image description here

5. Windows system client configuration NTP server operation (windows server 2016)

Steps to configure NTP client in windows system: (win server 2016 version configuration synchronization is used as an example)
1. Set the same network segment IP in the windows system, and the networks can ping each other
Insert image description here

2. Open the terminal with win, enter gpedit.msc to open the configuration windows time configuration interface: Computer Configuration → Administrative Templates → System → Windows Time Service → Time Provider, double-click to open the configuration windows NTP client, configure the NTP server IP, save and view the following figure Shown:
Insert image description here
Insert image description here
Insert image description here

3. Then return to the Windows interface to modify the editing time and date, enter the Internet time option to change the configuration, enter the configured server IP, click Update to see if the time synchronization is saved successfully, and check that the Windows time synchronization is consistent.
Insert image description here
Insert image description here

6. IPV6 environment server configuration:

(1) New IPV6 configuration for NTP server: Just change the previous IPV4 network segment configuration to an IPV6 network segment.
Insert image description here

(2) The firewall service on the server needs to be turned off (the default HS-569.iso system will enable the firewalld service)

systemctl stop firewalld
Insert image description here

(3) Then perform NTP synchronization configuration on the client, enter the configured server IP of IPV6 or IPV4, and then wait two minutes to check the client (HS, HC) server synchronization status

Client:
Insert image description here
Server:
Insert image description here

7. Use of multiple NTP configurations

1. Add and configure multiple NTP servers on the client and view the display

2. (Add two NTP servers) Both NTP servers are normal, but the synchronization abnormality is displayed when viewed.
Insert image description here

3. (Add two NTP servers) If there is a problem with one NTP server, the normal service will be taken over. Check the client synchronization display:
Insert image description here

4. (Add three NTP servers) The three NTP servers are all normal, and the view shows that the synchronization is normal.
Insert image description here

5. (Add three NTP servers) If there is a problem with one NTP server, the normal service will be taken over. Check the synchronization display on the client:
Insert image description here

Note: Every time the configuration of the NTP server changes or an exception occurs, the NTP server needs to be modified on the client to take effect (or the chronyd service can be restarted on the client or server)

Guess you like

Origin blog.csdn.net/qq_41196999/article/details/131046740