NTP服务器和客户端的设置及使用(EN版)
作者: 来源: 发布日期:2007-8-30 11:24:36 点击次数:
# to provide NTP packets on the ntp multicast net. #
multicastclient 224.0.1.1
2. Start the xntpd daemon
# /usr/lib/inet/xntpd -m &
(We start the xntpd daemon with the -m argument to listen for multicast packets if you were using broadcast as a method of receiving NTP updates you would use -b as the argument)
4. Using the ntpdate command
The ntpdate utility sets the local date and time. To determine the correct time, it polls the Network Time Protocol (NTP) servers on the hosts given as arguments. This utility must be run as root on the local host. It obtains a number of samples from each of the servers and applies the standard NTP clock filter and selection algorithms to select the best of these.It can be run on a regular basis from cron(1M) as an alternative to running a daemon. Doing so once every one to two hours will result in precise enough timekeeping to avoid stepping the clock. If you're are already running the xntpd daemon you can't use the ntpdate command. Trying to do so will generate the following error :
# ntpdate champ 23 Sep 14:55:52 ntpdate[19780]: the NTP socket is in use, exiting
You must also be root user to run the ntpdate command or you will see an error like this returned:
% ntpdate champ 23 Sep 14:44:36 ntpdate[19743]: bind() fails: Permission denied
In this example we specify the ntp server "jedi" to sync with.
# ntpdate jedi 23 Sep 17:12:21 ntpdate[20963]: adjust time server 129.148.192.147
offset 0.001422 sec
5. Using the ntpq command
ntpq queries NTP servers which implement the recommended NTP mode 6 control message format, about current state. It can also request changes in that state. The program can be run in interactive mode; or it can be controlled using command line arguments. Requests to read and write arbitrary variables can be assembled, with raw and pretty-printed output options available. By sending multiple queries to the server, ntpq can also obtain and print a list of peers in a common format.
To query an NTP server for a list of its peers:
# ntpq -p jedi remote refid st t when poll reach delay
offset disp ============================================================================== *eastpager1.East dollar.East.Sun 3 u 97 64 376 2.03
4.564 2.33 LOCAL(0) LOCAL(0) 5 l 19 64 377 0.00
0.000 10.01 NTP.MCAST.NET 0.0.0.0 16 - - 64 0 0.00
0.000 16000.0 255.255.255.255 0.0.0.0 16 - - 64 0 0.00
|