Monday, April 4, 2011

Debian NTP Server

Let start by installing few packages:
apt-get -y install ntp ntpdate
The options passed to ntp daemon are set in /etc/default/ntp file. We are interested to turn off ipv6 for now:
NTPD_OPTS='-4 -g'
As well we are going restrict ntp daemon for use ipv4 only (file /etc/ntp.conf):
# 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
Restart ntp daemon so the changes take place:
/etc/init.d/ntp restart
Look which servers it uses for synchronization:
ntpq -4p

Client

Install ntpdate package:
apt-get -y install ntpdate
You can sync the client with you ntp server by issuing the following command (I assume your local htp server resolves to ntp.dev.local):
ntpdate -p 2 ntp.dev.local
Consider have a look at the following post (you just need to substitute the ntp server name with yours).

1 comment :

  1. Thank you, you helped me stop NTP from listening on IPv6 addresses with the /etc/default/ntp tip.

    ReplyDelete