Here's a quick entry I'm writing because I can't remember the few ntp commands to get time sync running on my Fedora box in my company's predominantly Windows environment.
Configure /etc/ntp.conf
Let's add a single time server to our /etc/ntp.conf file:
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server timeserv.corpdomain
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
#server 127.127.1.0 # local clock
#fudge 127.127.1.0 stratum 10
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
Is the ntp daemon currently running on my box?
From the output of ntpq and the service command, I'd say no:
[sodo@computer ~]$ ntpq
ntpq> peers
ntpq: read: Connection refused
ntpq> assoc
ntpq: read: Connection refused
[sodo@computer ~]$ service --status-all | grep ntp
ntpd is stopped
Start up ntpd!
First, we'll configure ntpd to start at the various multiuser levels:
[sodo@computer ~]$ sudo chkconfig --list | grep ntp
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[sodo@computer ~]$ sudo chkconfig --levels 2345 ntpd on
[sodo@computer ~]$ sudo chkconfig --list | grep ntp
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Then, we'll start 'er up!
[sodo@computer ~]$ sudo service ntpd start
Starting ntpd: [ OK ]
Validate
Once started, we'll wait about ten minutes and then check ntpq to see if the ntpq is talking to the time server we configured in /etc/ntp.conf:
[sodo@computer ~]$ ntpq
ntpq> peers
remote refid st t when poll reach delay offset jitter
==============================================================================
*timeserve.corpdomain 192.168.62.30 5 u 71 128 377 0.448 19.236 24.240
ntpq> assoc
ind assid status conf reach auth condition last_event cnt
===========================================================
1 4341 967a yes yes none sys.peer sys_peer 7
Sweet! Looks like we're sync'd up!
TAG
Tuesday, March 15, 2011
Subscribe to:
Post Comments (Atom)
Feel free to drop me a line or ask me a question.
No comments:
Post a Comment