Linux Scroll

Just another WordPress.com site

Linux system time NTP

Configure NTP.

# vi /etc/ntp.conf

Add:

#TIMESERVERS
logfile   /var/log/ntp
restrict 0.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org

Sync time before start ntp service.

# ntpdate -u 0.us.pool.ntp.org

Enable ntp service at boot.

# /sbin/chkconfig --level 345 ntpd on

Start ntp service.

# /sbin/service ntpd start

Check ntp sync

# /sbin/ntpq -np -c assoc

-n      Output all host addresses in dotted-quad numeric format  rather
        than converting to the canonical host names.

-p      Print a list of the peers known to the server as well as a sum-
        mary of their state. This is equivalent to the  peers  interac-
        tive command.

-c      The following argument is interpreted as an interactive  format
        command  and is added to the list of commands to be executed on
        the specified host(s). 

associations
        Obtains and prints a list of association identifiers  and  peer
        statuses  for  in-spec  peers  of the server being queried.
Advertisements

Comments are closed.

%d bloggers like this: