Table of Contents

Linux

ntp - How to Configure ntp in Linux

Commands

Commnads Note
ntpq -p
ntpdate -b -u IPADDRESS
ntptrace
hwclock


Configuration

/etc/ntp.conf

NTP Server

restrict default ignore   #default
restrict 127.0.0.1        #localhost
restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap    # Permit access from NTP Client


# NTP Server
server 210.173.160.87   # ntp3.jst.mfeed.ad.jp
server 210.138.174.45   # ntp.excite.co.jp

driftfile       /var/lib/ntp/drift
broadcastdelay  0.008

keys    /etc/ntp/keys


NTP Client

restrict default nomodify notrap noquery  #default
restrict 127.0.0.1                        # localhost
restrict 192.168.0.254                    # Permit access from NTP Server


# NTP Server
server 192.168.0.254 iburst minpoll 4 maxpoll 4 prefer
server 192.168.0.253 iburst minpoll 4 maxpoll 4

driftfile       /var/lib/ntp/drift
broadcastdelay  0.008

keys    /etc/ntp/keys


/etc/sysconfig/ntpd

OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -x"
SYNC_HWCLOCK=yes

-x : slew mode


TIPS

accelerate synchronizing timing

server   xxx.xxx.xxx.xxx    minpoll 4 maxpoll 4

Xen NTP Configuration

/etc/sysctl.conf

xen.independent_wallclock = 1

After OS booted, Configuration this parameter.

# echo 1 > /proc/sys/xen/independent_wallclock
or
# sysctl xen.independent_wallclock=1