Saturday, January 3, 2009

Setting your Mac clock to NTP

Kurt showed me how to setup my macbook to use the Network Time Protocol for syncing the clock. By default, your clock syncs to Apple's time server, which can be off by minutes. There are also syncing issues due tons of computers trying to sync to one time server. To set your mac to use the NTP instead (where it will use a multitude of servers, not just one), do the following:

1. in terminal:

sudo
mkdir /var/log/ntpstats
( you won't put anything in here, but NTP will)

2. edit your /etc/ntp.conf:
#server time.apple.com  (the original ntp.conf, I would save this)
server 0.us.pool.ntp.org minpoll 12 maxpoll 17
server 1.us.pool.ntp.org minpoll 12 maxpoll 17
server 2.us.pool.ntp.org minpoll 12 maxpoll 17
server 3.us.pool.ntp.org minpoll 12 maxpoll 17
server 0.north-america.pool.ntp.org minpoll 12 maxpoll 17
server 1.north-america.pool.ntp.org minpoll 12 maxpoll 17
server 2.north-america.pool.ntp.org minpoll 12 maxpoll 17
server 127.127.1.0 minpoll 12 maxpoll 17

driftfile /var/db/ntp.drift
statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# The UNH time server (this was simply added because I go to UNH,
# you can omit this or add any other time servers you want)
server wilmot.unh.edu

# ... and use the local system clock as a reference if all else fails
# NOTE: in a local network, set the local stratum of *one* stable server
# to 10; otherwise your clocks will drift apart if you lose connectivity.
server 127.127.1.0
fudge 127.127.1.0 stratum 10

# By default, exchange time with everybody, but don't allow configuration.
# See /usr/share/doc/ntp-doc/html/accopt.html for details.
restrict default kod notrap nomodify nopeer noquery

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

3. reboot or run:
$ /sbin/SystemStarter restart "NetworkTime"



Still not working? See next post for update!

No comments:

Post a Comment