Páginas

domingo, 26 de junio de 2022

FreeBSD cliente ntpd

Si tiene una máquina cliente deberá escuchar un servidor NTP para obtener la hora

ntp viene instalado por defecto

Configurar ntpd

/etc/rc.conf


# ntpd_enable="YES"
# ntpd_config="/etc/ntp.conf"
# netwait_enable="YES"

Archivo por defecto:

% sed -e '/^[ ]*#/d' -e '/^$/d' /etc/ntp.conf


tos minclock 3 maxclock 6
pool 0.freebsd.pool.ntp.org iburst
restrict default limited kod nomodify notrap noquery nopeer
restrict source  limited kod nomodify notrap noquery
restrict 127.0.0.1
restrict ::1
leapfile "/var/db/ntpd.leap-seconds.list"

Agregar un servidor NTP cercano (España)


tos minclock 3 maxclock 6
# pool 0.freebsd.pool.ntp.org iburst
#
# Servidor NTP
pool 0.es.pool.ntp.org iburst
#
restrict default limited kod nomodify notrap noquery nopeer
restrict source  limited kod nomodify notrap noquery
restrict 127.0.0.1
restrict ::1
leapfile "/var/db/ntpd.leap-seconds.list"

Modificar la hora sin cambiar la fecha

Por ejemplo, actualizar hora a 13 horas y 22 minutos

# date 1322

Iniciar el servicio


# service ntpd start

Solucionar error ntpd: error resolving pool 0.freebsd.pool

ntp esperará que nuestro equipo tenga conexión a internet


# sysrc netwait_enable=YES
netwait_enable: NO -> YES

Comprobar que funciona


# ntpq -pn
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.freebsd.pool. .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 0.es.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 -51.195.26.118   90.187.148.77    2 u   69   64  377   34.733   -1.417   0.259
#193.145.15.15   193.147.107.33   2 u   61   64  377   10.797   -0.456   0.831
-162.159.200.123 10.19.9.88       3 u   66   64  377   19.087   -0.709   0.719
*185.179.104.12  .GPS.            1 u   57   64  377   28.571   -0.880   0.429
#185.132.136.116 130.206.0.1      2 u   63   64  367   56.016  +11.404   1.522
-5.56.160.3      178.32.88.247    3 u   58   64  377   30.043   -0.500   0.904
#185.90.148.209  150.214.94.5     2 u   62   64  377   36.419   -0.867   0.528
+92.222.150.77   192.168.100.15   2 u   53   64  377   29.147   -0.891   0.325
+51.195.26.119   90.187.148.77    2 u   59   64  377   34.076   -1.644   0.533
 

FreeBSD es genial!.