一 服务器配置NTP 其IP为172.17.167.30和10.31.255.30
[root@localhost ~]# vi /etc/ntp.conf
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
#restrict default kod nomodify notrap nopeer noquery
#restrict -6 default kod nomodify notrap nopeer noquery
#restrict default nomodify noquery notrap
#restrict default ignore
#restrict 202.112.10.60
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
#restrict -6 ::1
# Hosts on local network are less restricted.
restrict 10.31.255.0 mask 255.255.255.0 nomodify
restrict 172.17.167.0 mask 255.255.255.0 nomodify notrap
#restrict 0.0.0.0 mask 0.0.0.0 notrap noquery notrust
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool ().
server time.buaa.edu.cn prefer
server time.buptnet.edu.cn
#broadcast 192.168.1.255 key 42 # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 key 42 # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 key 42 # manycast client
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
# 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
--------------------
[root@localhost ~]# cat /etc/ntp/step-tickers
time.buaa.edu.cn
============================
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*202.112.128.33 210.72.145.44 2 u 301 512 377 122.333 -0.907 16.022
202.112.10.60 .INIT. 16 u - 1024 0 0.000 0.000 0.000
LOCAL(0) .LOCL. 10 l 20 64 377 0.000 0.000 0.001
=============================
[root@localhost ~]# lsof -i:123
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
ntpd 23021 ntp 16u IPv4 649101 UDP *:ntp
ntpd 23021 ntp 17u IPv6 649102 UDP *:ntp
ntpd 23021 ntp 18u IPv6 649103 UDP [fe80::20f:eaff:fe56:9156]:ntp
ntpd 23021 ntp 19u IPv6 649104 UDP localhost6.localdomain6:ntp
ntpd 23021 ntp 20u IPv6 649105 UDP [fe80::20f:eaff:fe56:9157]:ntp
ntpd 23021 ntp 21u IPv6 649106 UDP [fe80::fcff:ffff:feff:ffff]:ntp
ntpd 23021 ntp 22u IPv6 649107 UDP [fe80::fcff:ffff:feff:ffff]:ntp
ntpd 23021 ntp 23u IPv6 649108 UDP [fe80::200:ff:fe00:0]:ntp
ntpd 23021 ntp 24u IPv4 649109 UDP localhost:ntp
ntpd 23021 ntp 25u IPv4 649110 UDP 10.31.255.22:ntp
ntpd 23021 ntp 26u IPv4 649111 UDP 10.31.255.20:ntp
ntpd 23021 ntp 27u IPv4 649116 UDP 10.31.255.23:ntp
ntpd 23021 ntp 28u IPv4 649117 UDP 10.31.255.21:ntp
ntpd 23021 ntp 29u IPv4 649118 UDP 172.17.167.30:ntp
ntpd 23021 ntp 30u IPv4 649119 UDP 192.168.122.1:ntp
ntpd 23021 ntp 31u IPv4 649120 UDP 10.31.255.30:ntp
ntpd 23021 ntp 32u IPv4 649121 UDP 10.8.0.1:ntp
================================
[root@localhost ~]# netstat -unl | grep 123
udp 0 0 10.8.0.1:123 0.0.0.0:*
udp 0 0 10.31.255.30:123 0.0.0.0:*
udp 0 0 192.168.122.1:123 0.0.0.0:*
udp 0 0 172.17.167.30:123 0.0.0.0:*
udp 0 0 10.31.255.21:123 0.0.0.0:*
udp 0 0 10.31.255.23:123 0.0.0.0:*
udp 0 0 10.31.255.20:123 0.0.0.0:*
udp 0 0 10.31.255.22:123 0.0.0.0:*
udp 0 0 127.0.0.1:123 0.0.0.0:*
udp 0 0 0.0.0.0:123 0.0.0.0:*
udp 0 0 fe80::200:ff:fe00:0:123 :::*
udp 0 0 fe80::fcff:ffff:fef:123 :::*
udp 0 0 fe80::fcff:ffff:fef:123 :::*
udp 0 0 fe80::20f:eaff:fe56:123 :::*
udp 0 0 ::1:123 :::*
udp 0 0 fe80::20f:eaff:fe56:123 :::*
udp 0 0 :::123 :::*
=========================
二 客户端可是windows或linux
ntpdate 172.17.167.30
阅读(1222) | 评论(0) | 转发(0) |