NTP Linux. |
code:
start() {
readconf;
if [ -n "$dostep" ]; then
gprintf $"Syncing time for ntpd: "
# try hard, some networks/slow machines/... take a while to have DNS
local triesleft=7
while [ $triesleft -gt 0 ]; do
/usr/sbin/ntpdate -s -b $NTPDATE_OPT $tickers
RETVAL=$?
[ $RETVAL -eq 0 ] && break
triesleft=$(($triesleft-1))
sleep 1
done
unset triesleft
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
[ "$SYNC_HWCLOCK" = "yes" ] && sync_hwclock
else
OPTIONS="$OPTIONS -g"
fi
else
# -g can replace the grep for time servers
# as it permits ntpd to violate its 1000s limit once.
OPTIONS="$OPTIONS -g"
fi
# Start daemons.
gprintf $"Starting $prog: "
daemon ntpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
return $RETVAL
}
code:
pool.ntp.org.
code:
#urpmi ntp
code:
server 0.ru.pool.ntp.org
server 1.ru.pool.ntp.org
server 2.ru.pool.ntp.org
server 3.ru.pool.ntp.org
code:
#ntpdate pool.ntp.org
code:
#service ntpd restart
code:
#ntpq -p
code:
remote refid st t when poll reach delay offset jitter
==============================================================================
mx.kr-pro.ru 62.149.0.30 2 u 26 64 1 22.416 77.711 0.001
phobos.bsys-net 192.36.143.151 2 u 25 64 1 32.994 64.937 0.001
webhost.mitht.r 77.105.134.138 3 u 25 64 1 68.134 37.119 0.001
hornet.itconnec 77.233.172.7 3 u 24 64 1 58.604 38.047 0.001
code:
remote refid st t when poll reach delay offset jitter
==============================================================================
*mx.kr-pro.ru 62.117.76.142 2 u 5 64 377 20.558 38.662 19.060
+phobos.bsys-net 192.36.143.151 2 u 6 64 377 17.726 38.447 15.132
-webhost.mitht.r 77.105.134.138 3 u 4 64 377 66.744 13.451 16.257
+hornet.itconnec 77.233.172.7 3 u 11 64 377 57.291 43.556 13.327
code:
remote refid st t when poll reach delay offset jitter
==============================================================================
172.22.128.8 93.185.187.89 3 u 142 256 377 3.906 -450.41 61.937
195.200.216.16 .INIT. 16 u - 64 0 0.000 0.000 0.000
ams1.x31.com .INIT. 16 u - 64 0 0.000 0.000 0.000
mail2.mgts.by .INIT. 16 u - 64 0 0.000 0.000 0.000
*LOCAL(1) .LOCL. 3 l 13 64 377 0.000 0.000 3.906
code:
01 # Public NPS servers, from we get time
02 server 0.ru.pool.ntp.org
03 server 1.ru.pool.ntp.org
04 server 2.ru.pool.ntp.org
05 server 3.ru.pool.ntp.org
06 server 0.europe.pool.ntp.org
07 server 1.europe.pool.ntp.org
08
09 # For all other acces denied
10 restrict default ignore
11
12 # Public NPS servers can't control our local server
13 restrict 0.ru.pool.ntp.org nomodify notrap
14 restrict 1.ru.pool.ntp.org nomodify notrap
15 restrict 2.ru.pool.ntp.org nomodify notrap
16 restrict 3.ru.pool.ntp.org nomodify notrap
17 restrict 0.europe.pool.ntp.org nomodify notrap
18 restrict 1.europe.pool.ntp.org nomodify notrap
19
20 # Our server provide NTP service for local network,
21 # and clients can't control our local server
22 restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap nopeer
23
24 # Need for loopback synchronisation, without it no will work
25 restrict 127.0.0.1 nomodify notrap
code:
#service ntpd restart
code:
#ntpq -p
code:
remote refid st t when poll reach delay offset jitter
==============================================================================
*mx.kr-pro.ru 62.117.76.142 2 u 5 64 377 20.558 38.662 19.060
+phobos.bsys-net 192.36.143.151 2 u 6 64 377 17.726 38.447 15.132
-webhost.mitht.r 77.105.134.138 3 u 4 64 377 66.744 13.451 16.257
+hornet.itconnec 77.233.172.7 3 u 11 64 377 57.291 43.556 13.327
+sinister.wzw.tu 129.69.1.153 2 u 1 64 377 80.064 48.067 14.367
+time.sunrise.ne 193.192.225.90 3 u 3 64 377 72.448 22.575 14.584