Table of Contents

NTP

ntp ntpq time

Paquetes

Comunnes para cliente y servidor:

sudo aptitude install ntp ntpdate

Servidor

1. Actualizar configuracion:

sudo mv /etc/ntp.conf /etc/ntp.conf.old
sudo vim /etc/ntp.conf
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
server 0.es.pool.ntp.org
server 1.es.pool.ntp.org
server 2.es.pool.ntp.org

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# http://support.ntp.org/bin/view/Support/AccessRestrictions#Section_6.5.1.2.
# In theory I should use IP addresses on 'restrict'
restrict 0.es.pool.ntp.org mask 255.255.255.255 nomodify
restrict 1.es.pool.ntp.org mask 255.255.255.255 nomodify
restrict 2.es.pool.ntp.org mask 255.255.255.255 nomodify

# LAN
restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap nopeer

2. Para NTP:

sudo /etc/init.d/ntp stop

3. Sincronizar (en este ejemplo el servidor es 0.es.pool.ntp.org)

ntpdate 0.es.pool.ntp.org

4. Arrancar NTP:

sudo /etc/init.d/ntp start

Cliente

1. Actualizar configuracion:

sudo mv /etc/ntp.conf /etc/ntp.conf.old
sudo vim /etc/ntp.conf
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

server time-1.dev.jj.com

restrict -4 default ignore
restrict -6 default ignore
restrict 127.0.0.1
restrict ::1
restrict time-1.dev.jj.com

Sincronizamos el cliente contra el servidor (time-1.dev.jj.com) y permitimos acceso local, todo lo demas lo cerramos.

2. Parar NTP:

sudo /etc/init.d/ntp stop

3. Sincronizar (en este ejemplo el servidor es time-1.dev.jj.com)

ntpdate time-1.dev.jj.com

4. Arrancar NTP:

sudo /etc/init.d/ntp start