Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Próxima revisión
Revisión previa
doc:tec:sis:gnu:hora:inicio [2025/12/19 10:37] – creado fepgdoc:tec:sis:gnu:hora:inicio [2025/12/19 10:51] (actual) fepg
Línea 1: Línea 1:
 ====== [Linux] Configurar la hora ====== ====== [Linux] Configurar la hora ======
  
 +===== Sincronizar hora con NTP o systemd‑timesyncd en Debian 13 =====
 +
 +Para sincronizar la hora con NTP en Debian 13 lo habitual es usar **systemd‑timesyncd** a través de `timedatectl`, o bien instalar un demonio NTP completo como `ntp`/`chrony` si necesitas más opciones.[3][7]
 +
 +**Comprobar estado actual**
 +
 +  * Ver estado de hora, NTP y zona horaria: <code>
 +
 +timedatectl status
 +
 +</code> En la salida revisa:
 +    - System clock synchronized: debería ser yes.
 +    - NTP service: debería decir active si se usa systemd‑timesyncd u otro cliente NTP integrado.[7][3]
 +
 +**Usar systemd‑timesyncd**
 +
 +Debian moderno suele integrar `systemd‑timesyncd` como cliente SNTP ligero, pero puede no venir instalado o habilitado por defecto.[4][6][7]
 +
 +  - 1. Instalar (si no existe): <code>
 +
 +# apt update
 +# apt install systemd-timesyncd
 +
 +</code>
 +  - 2. Habilitar y arrancar:
 +   ```bash
 +   sudo systemctl enable --now systemd-timesyncd.service
 +   ```
 +  - 3. Activar la sincronización NTP en systemd:
 +   ```bash
 +   sudo timedatectl set-ntp true
 +   ```
 +  - 4. Verificar:
 +   ```bash
 +   timedatectl status
 +   systemctl status systemd-timesyncd.service
 +   ```
 +   Si el servicio aparece como `active (running)` y `NTP service: active`, el reloj se sincroniza con servidores NTP configurados en `systemd‑timesyncd`.[1][3][7]
 +
 +**Configurar servidores NTP en systemd‑timesyncd**
 +
 +  - Editar el archivo de configuración:
 +  ```bash
 +  sudo nano /etc/systemd/timesyncd.conf
 +  ```
 +  - En la sección `[Time]`, define tus servidores:
 +  ```ini
 +  [Time]
 +  NTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org
 +  FallbackNTP=2.debian.pool.ntp.org 3.debian.pool.ntp.org
 +  ```
 +  - Aplicar cambios:
 +  ```bash
 +  sudo systemctl restart systemd-timesyncd.service
 +  sudo timedatectl status
 +  ```
 +  En entornos con servidor NTP interno pon la IP o nombre de ese servidor en `NTP=` y deja `FallbackNTP` con servidores públicos.[9][1][3]
 +
 +**Usar un demonio NTP completo (ntp o chrony)**
 +
 +Si necesitas más precisión, estadísticas o servir tiempo a otros equipos, conviene instalar un cliente/servidor NTP completo.[6][7]
 +
 +  - 1. Instalar `ntp` (ejemplo):
 +   ```bash
 +   sudo apt update
 +   sudo apt install ntp
 +   ```
 +   O bien `chrony`:
 +   ```bash
 +   sudo apt install chrony
 +   ```
 +  - 2. Desactivar la sincronización de systemd‑timesyncd para evitar conflictos:
 +   ```bash
 +   sudo timedatectl set-ntp false
 +   sudo systemctl disable --now systemd-timesyncd.service
 +   ```
 +  - 3. Configurar servidores en:
 +   - `/etc/ntp.conf` para `ntp`.
 +   - `/etc/chrony/chrony.conf` para `chrony`.  
 +   Después reinicia el servicio correspondiente:
 +   ```bash
 +   sudo systemctl restart ntp
 +   # o
 +   sudo systemctl restart chrony
 +   ```
 +   `ntp` y `chrony` proporcionan más opciones de ajuste fino, pero para la mayoría de escritorios y servidores simples basta con systemd‑timesyncd.[3][6][7]
 +
 +**Forzar y verificar sincronización**
 +
 +  - Forzar actualización rápida (útil después de cambiar servidores):
 +    - Con systemd‑timesyncd, lo normal es esperar unos minutos; si la hora está muy desfasada, puedes ajustarla una vez:
 +    ```bash
 +    sudo timedatectl set-time "2025-12-19 10:44:00"
 +    ```
 +    y dejar que NTP haga los ajustes finos posteriores.[10][3]
 +  - Comprobar otra vez:
 +  ```bash
 +  timedatectl status
 +  ```
 +  Cuando el campo `System clock synchronized` pase a `yes` y el desajuste sea mínimo, la sincronización está funcionando correctamente.[7][3]
 +
 +Si indicas si tu Debian 13 es servidor o escritorio y si tienes servidor NTP interno, se pueden proponer valores concretos para el `timesyncd.conf` o para `ntp`/`chrony`.
 +
 +  * [1](https://guidocutipa.blog.bo/como-sincronizar-la-hora-en-ubuntu-debian-con-un-servidor-ntp/)
 +  * [2](https://translate.google.com/translate?u=https%3A%2F%2Fphoenixnap.com%2Fkb%2Fdebian-time-sync&hl=es&sl=en&tl=es&client=srp)
 +  * [3](https://translate.google.com/translate?u=https%3A%2F%2Fwiki.debian.org%2FDateTime&hl=es&sl=en&tl=es&client=srp)
 +  * [4](https://www.reddit.com/r/debian/comments/1e4k61a/needed_to_install_ntp_to_synchronize_the_time/)
 +  * [5](https://translate.google.com/translate?u=https%3A%2F%2Fdocs.vultr.com%2Fhow-to-set-the-timezone-and-configure-ntp-on-rocky-linux&hl=es&sl=en&tl=es&client=srp)
 +  * [6](https://instructorbenyblanco.wordpress.com/2020/06/02/hora-linux-systemd/)
 +  * [7](https://translate.google.com/translate?u=https%3A%2F%2Fwiki.debian.org%2FNTP&hl=es&sl=en&tl=es&client=srp)
 +  * [8](https://www.youtube.com/watch?v=IOCoG8VX_dE)
 +  * [9](https://translate.google.com/translate?u=https%3A%2F%2Fwiki.archlinux.org%2Ftitle%2FSystemd-timesyncd&hl=es&sl=en&tl=es&client=srp)
 +  * [10](https://translate.google.com/translate?u=https%3A%2F%2Fserverfault.com%2Fquestions%2F948974%2Fforce-systemd-timesyncd-to-sync-time-with-ntp-server-immediately&hl=es&sl=en&tl=es&client=srp)
 +\\ 
  • doc/tec/sis/gnu/hora/inicio.1766137032.txt.gz
  • Última modificación: 2025/12/19 10:37
  • por fepg