Servicio de sincronización horaria de Linux-chronyd

LinuxServicio de sincronización horaria -chronyd

Instalar

Utilice la herramienta de instalación de paquetes para instalar chronyy ntp:

  • Arch Linuxserie:

    sudo pacman -S ntp chrony
    
  • Debianserie:

    sudo apt install ntp chrony
    
  • Red Hatserie:

    sudo yum install ntp chrony
    

    o

    sudo dnf install ntp chrony
    

Configuración

① En chronyel archivo de configuración, comente el NTPservidor de sincronización original y complete NTPla URL del servidor de sincronización Alibaba o Tencent. El ejemplo es el siguiente:

### SPECIFY YOUR NTP SERVERS
# Most computers using chrony will send measurement requests to one or
# more 'NTP servers'.  You will probably find that your Internet Service
# Provider or company have one or more NTP servers that you can specify.
# Failing that, there are a lot of public NTP servers.  There is a list
# you can access at http://support.ntp.org/bin/view/Servers/WebHome or
# you can use servers from the pool.ntp.org project.

#! server 0.arch.pool.ntp.org iburst
#! server 1.arch.pool.ntp.org iburst
#! server 3.arch.pool.ntp.org iburst

#pool 2.arch.pool.ntp.org iburst

# The URL of Tencent NTP network time server is as follows:
! server ntp.tencent.com iburst
! server ntp2.tencent.com iburst
! server ntp3.tencent.com iburst
! server ntp4.tencent.com iburst
! server ntp5.tencent.com iburst

# The URL of Ali NTP network time server is as follows:
! server ntp.aliyun.com iburst
! server ntp1.aliyun.com iburst
! server ntp2.aliyun.com iburst
! server ntp3.aliyun.com iburst
! server ntp4.aliyun.com iburst
! server ntp5.aliyun.com iburst
! server ntp6.aliyun.com iburst
! server ntp7.aliyun.com iburst

pool ntp1.tencent.com

Aviso:

Simplemente elige tres o cuatro de ellos.

② Ingrese el siguiente comando para permitir que el firewall pase chronydel servicio para que chronydel servicio pueda ejecutarse sin problemas:

  • Firewalldconfiguración:

    $ firewall-cmd --add-service=ntp --permanent
    $ firewall-cmd --reload
    
  • Ufwconfiguración:

    $ sudo ufw allow ntp
    $ sudo ufw allow out ntp
    

administrar

Utilice systemctlcomandos para permitir que chronydel servicio se inicie automáticamente en el inicio, habilitar chronydel servicio para que se inicie y ver chronydel estado de ejecución del servicio. Los comandos específicos son los siguientes:

# systemctl start chronyd.service    #启动
# systemctl status chronyd.service     #查看
# systemctl enable chronyd.service    #设置开机启动

Utilice el siguiente comando para ver la fuente de sincronización horaria:

$ chronyc sources -v

Utilice el siguiente comando para verificar el estado de la fuente de sincronización horaria:

$ chronyc sourcestats -v

Utilice el siguiente comando para habilitar la sincronización horaria NTP:

$ timedatectl set-ntp yes

Utilice el siguiente comando para calibrar el servidor de hora:

$ chronyc tracking

Aviso:

Una vez /etc/chrony.confcompletada , chronyes necesario reiniciar el servicio; de lo contrario, es posible que no surta efecto.

Supongo que te gusta

Origin blog.csdn.net/GaaraZ/article/details/127424633
Recomendado
Clasificación