Senin, 10 Juni 2013

CentOS 6 NTP Server

It is important for systems administrators to make sure that mission-critical servers are always using the correct system time.
The ntpd (Network Time Protocol daemon) program is an operating system daemon which sets and maintains the system time of day in synchronism with Internet standard time servers. Make sure that the time zone configuration of your computer is correct. ntpd itself does not do anything about the time zones, it just uses UTC internally.

Install Network Time Protocol (NTP) daemon

# yum install ntp

Add NTP daemon to startup

# chkconfig ntpd on

Edit the NTPD config file

Here you can either use the default NTP public servers or add servers closer to your region.
Visit http://www.pool.ntp.org/en/ and either considder joining or getting your regional NTP pool servers
# vi /etc/ntp.conf
20
21
22
23
24
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org

Start the NTP daemon

# service ntpd start

Standard NTP query program (ntpq)

Print a list of the peers known to the server as well as a summary of their state.
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*javanese.kjsl.c 69.36.224.15 2 u 108 128 377 1.401 3.392 4.779
+66-191-139-149. 132.163.4.101 2 u 70 128 377 46.044 11.205 5.378
+ntp.sunflower.c 132.236.56.250 3 u 85 128 377 50.962 -2.129 14.112

Managing NTPd with Puppet

If you’re running Puppet we have included the manifest for installing Varnish on CentOS 6. If you’re not running Puppet then you can install it by following the instructions outlined in our CentOS 6 Puppet Install.
This is only the manifest and doesn’t include any of the files (i.e. ntp.conf).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class ntpd::install {
 
 $packagelist = ["ntp"]
 
 package { $packagelist:
  ensure => installed
 }
}
 
class ntpd::service {
 
 service { "ntpd":
  ensure => true,
  enable => true,
  hasrestart => true,
  hasstatus => true,
  require => Class ["ntpd::install"]
 }
}
 
class ntpd::conf {
 
 File {
  require => Class ["ntpd::install"],
  owner => "root",
  group => "root",
  mode => 644,
  notify => Class ["ntpd::service"]
 }
 
 file { "/etc/ntp.conf":
  source  => "puppet:///modules/ntpd/ntp.conf"
 }
}
 
class ntpd {
 include ntpd::install, ntpd::service, ntpd::conf
}

Tidak ada komentar:

Posting Komentar