Manage NTP

TIPS & TRICKS

To search the contents of the man pages

# man -k searchterm 
# man -K searchterm

Configure NTP

To keep in mind. If necessary:

# yum install chrony -y
# systemctl restart chronyd.service
# systemctl enable chronyd.service --now
# vim /etc/chrony.conf

Configure NTP 1

| Configure your system so that it is an NTP pool of 2.centos.pool.ntp.org

NTP is a service that is using chrony deamon. It should be already installed in the system but it does not cost You to issue:

# yum install -y chrony
# systemctl enable chronyd.service
# systemctl start chronyd.service

There is a list of servers being used to get time from. The lines start with server. In order to use only one of the
servers (the one that is provided in question) You should comment all others and just put new line there:

# vim /etc/chrony.conf
pool 2.centos.pool.ntp.org iburst (also comment out the pool)
# systemctl restart chronyd.service
# systemctl enable chronyd.service --now

Verify:

# timedatectl
# timedatectl set-ntp 1

User command to interfere with chronyd is chronyc. To list the NTP sources being used we issue:

# chronyc sources -v

Configure NTP 2

| Configure NTP service, Synchronize the server time, NTP server: classroom.example.com

Configure the client:

# dnf -y install chrony
# vim /etc/chrony.conf
server classroom.example.com iburst

Start:

# systemctl enable chronyd
# systemctl restart chronyd

Verifr:

timedatectl status

Configure NTP 3

| Set the system time zone in Paris and configure the system to use NTP

Check if the chrony service is up and running:

# systemctl status chronyd.service
# timedatectl list-timezones	           // choose the apropriate timezone 
# timedatectl set-timezone Europe/Paris
# timedatectl set-ntp true

Configure NTP 4

| Make node1 server as NTP server to utility.server9.example.com (172.24.9.40)

# vim /etc/chrony.conf
allow 172.24.9.0/24
# systemctl daemon-reload
# systemctl restart chronyd

Finally add ntp service to firewall

# firewall-cmd --add-service=ntp --permanent    // Applique de façon permanente (Prochain reboot)
# firewall-cmd --add-service=ntp // Applique dès maintenant
# firewall-cmd --reload

Configure NTP 5

| Configure your system to be an NTP client for materials.example.com.
| (Note: materials.example.com is a DNS alias for classroom.example.com)

# vim /etc/chrony.conf
server materials.example.com iburst

Restart the service, let the modification of the configuration file take effect, and set the boot to start automatically:

# systemctl restart chronyd.service
# systemctl enable chronyd.service

Verify:

# chronyc sources -v
^* classroom.example.com
# timedatectl
System clock synchronized: yes
NTP service: active

Documentations

Internet
Git
ChatGPT

> Partager <