How To Set Time Using NTP In Solaris

NTP is stand for Network Time Protocol. It is used for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks. NTP uses UDP on port 123 as its transport layer.

Keeping the date/time synchronized throughout all computers / servers is really necessary. Solaris already comes with the ntp daemon, called “xntpd”.

  • Check whether NTP daemon┬ástatus
    root@server:~# svcs -a | grep ntp
    disabled May_11 svc:/network/ntp:default

  • If its not running/disabled, please create/edit the config file in /etc/inet/ntp.conf. The contents should be similar as below.
    root@server:~# cat /etc/inet/ntp.conf
    # ident "@(#)ntp.server 1.7 03/01/17 SMI"
    # Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
    # Use is subject to license terms.
    # List your ntp server address here. You may set one of the server as preferred.
    server prefer
    driftfile /var/ntp/ntp.drift
    statsdir /var/ntp/ntpstats/
    filegen peerstats file peerstats type day enable
    filegen loopstats file loopstats type day enable
    filegen clockstats file clockstats type day enable
  • Now start the NTP daemon
    root@server:~# svcadm enable ntp
  • Check for any error message
    root@server:~# tail -f /var/adm/messages