1
2
3
4
5
6
7
8
|
以源代码为例
# wget http://ntp.buptnet.edu.cn/ntp_chinese/down/server/ntp-4.2.0.tar.gz
# tar -zxvf ntp-4.2.0.tar.gz –C /usr/local/src;cd /usr/local/src/ntp-4.2.0
2. 开始设定参数、编译与安装:
#./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocks
# make clean ; make
# make check
# make install
|
1
2
3
4
5
6
7
8
|
6.1.2.1. Can I use my system clock as reference clock? YES,as you
do
like so
#server 127.127.1.1 #LCL,local clock,最好不要这样。引发时间混乱
6.1.3.1. How can I configure the amount of logging information?
6.1.3.2. How can I speed up initial Synchronization?
6.1.3.3. How
do
I configure remote administration?
6.1.3.4. How
do
I use authentication keys?
6.1.3.5. What are all the different Keys used
for
?
6.1.3.6. How
do
I use the new autokey feature?
具体解决方法,查看文首提示的官网链接
|
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
39
40
41
42
43
44
45
46
47
48
49
50
|
# write the server time and local BIOS time in it ,and count it.
driftfile
/var/lib/ntp/drift
#restrict default kod nomodify notrap nopeer noquery
#restrict -6 default kod nomodify notrap nopeer noquery
# the Usage
# restrict [ your IP address ] mask [ netmask ] [ power ]
# power: ignore --> deny all of types NTP connection
# power: nomodify --> deny clients use ntpq or ntpc to change the time of NTP server
# power: noquery --> deny clients use ntpq or ntpc to checkout time , that means deny clients use the NTP server.
# power: notrap --> dont't support remote event logging.
# power: notrust --> deny clients that not be authored.
# if "[ power ]" is null , it means every client can use this host of NTP server.
restrict default nomodify notrap noquery
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0 nomodify
restrict -6 ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# server 210.72.145.44 is BJ Time Station.
# source of ntp-server ; and prefer is priority
server asia.pool.ntp.org prefer
server 210.72.145.44
# local network lo interface
server 127.127.1.1
# LCL does't sync
fudge 127.127.1.1 stratum 10 refid NIST
# broadcast delay frequency
Broadcastdelay 0.008
#server 127.127.1.1
logfile
/var/log/ntp
.log
#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
# Enable public key cryptography.
#crypto
includefile
/etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys
/etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
|
1
2
|
[root@gang ~]
# /etc/init.d/ntpd start
Starting ntpd: [ OK ]4. 一下为正常
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
Mar 24 18:29:45 gang ntpd[3547]: ntpd 4.2.6p5@1.2349-o Sat Nov 23 18:21:48 UTC 2013 (1)
Mar 24 18:29:45 gang ntpd[3548]: proto: precision = 0.628 usec
Mar 24 18:29:45 gang ntpd[3548]: 0.0.0.0 c01d 0d kern kernel
time
sync
enabled
Mar 24 18:29:45 gang ntpd[3548]: line 32 column 1 syntax error, unexpected T_String, expecting $end
Mar 24 18:29:45 gang ntpd[3548]: syntax error
in
/etc/ntp
.conf line 32, column 1
Mar 24 18:29:45 gang ntpd[3548]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Mar 24 18:29:45 gang ntpd[3548]: Listen and drop on 1 v6wildcard :: UDP 123
Mar 24 18:29:45 gang ntpd[3548]: Listen normally on 2 lo 127.0.0.1 UDP 123
Mar 24 18:29:45 gang ntpd[3548]: Listen normally on 3 br0 192.168.0.199 UDP 123
Mar 24 18:29:45 gang ntpd[3548]: Listen normally on 4 eth0 fe80::eea8:6bff:fea4:912b UDP 123
Mar 24 18:29:45 gang ntpd[3548]: Listen normally on 5 br0 fe80::eea8:6bff:fea4:912b UDP 123
Mar 24 18:29:45 gang ntpd[3548]: Listen normally on 6 lo ::1 UDP 123
Mar 24 18:29:45 gang ntpd[3548]: peers refreshed
Mar 24 18:29:45 gang ntpd[3548]: Listening on routing socket on fd
#23 for interface updates
|
1
2
3
4
|
[root@gang ~]
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
proxy02.ispros. .INIT. 16 u - 256 0 0.000 0.000 0.000
|
1
2
3
4
5
|
[root@gang ~]
# ping asia.pool.ntp.org
PING asia.pool.ntp.org (78.111.50.2) 56(84) bytes of data.
^C
--- asia.pool.ntp.org
ping
statistics ---
28 packets transmitted, 0 received, 100% packet loss,
time
27241ms
|
1
2
3
4
5
6
|
[root@gang ~]
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*time2.isu.net.s .GPS. 1 u 2 64 27 341.015 -64.352 16.181
210.72.145.44 .INIT. 16 u - 64 0 0.000 0.000 0.000
LOCAL(1) .NIST. 10 l 13 64 177 0.000 0.000 0.000
|