Wednesday, May 02, 2012

Sync Linux Time With Windows Domain Controller Time

If you use a Linux box in a Windows domain environment, you may want to sync its time with the domain's. Here is how:

  • Add domain controller to server pool in /etc/openntpd/ntpd.conf
  • # $OpenBSD: ntpd.conf,v 1.7 2004/07/20 17:38:35 henning Exp $
    # sample ntpd configuration file, see ntpd.conf(5)
    
    # Addresses to listen on (ntpd does not listen by default)
    #listen on *
    #listen on 127.0.0.1
    #listen on ::1
    
    # sync to a single server
    #server ntp.example.org
    
    # use a random selection of 4 public stratum 2 servers
    # see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers
    # and http://www.pool.ntp.org/
    server your_domain_controller
    #server 0.debian.pool.ntp.org
    #server 1.debian.pool.ntp.org
    #server 2.debian.pool.ntp.org
    #server 3.debian.pool.ntp.org
    
  • Add '-s' to DAEMON_OPTS in /etc/default/openntpd (from man page: "-s     Set the time immediately at startup if the local clock is off by more than 180 seconds.  Allows for a large time correction, eliminating the need to run rdate(8) before starting .")
  • # /etc/default/openntpd
    
    # Append '-s' to set the system time when starting in case the offset
    # between the local clock and the servers is more than 180 seconds.
    # For other options, see man ntpd(8).
    DAEMON_OPTS="-s -f /etc/openntpd/ntpd.conf"
    

2 comments:

Anonymous said...

I like what you guys are up too. This type of clever work
and reporting! Keep up the great works guys I've you guys to my own blogroll.

My page ... Ucd.Ie

Anonymous said...

Hi there! I'm at work browsing your blog from my new iphone 4! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the outstanding work!

Feel free to surf to my blog - cartoon paint review