[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]
Commands Reference, Volume 4
ntpdate Command
Purpose
Sets the date and time using the Network Time Protocol (NTP). This command only applies to AIX Version 4.2 or later.
ntpdate [ -b ] [ -d ] [ -s ] [ -u ] [ -a Keyid ] [ -e AuthenticationDelay ] [ -k KeyFile ] [ -o Version ] [ -p Samples ] [ -t TimeOut ] Server ...
Description
The ntpdate command sets the local date and time by polling the NTP servers specified to determine the correct time. It obtains a number of samples from each server specified and applies the standard NTP clock filter and selection algorithms to select the best of the samples.
The ntpdate command makes time adjustments in one of the following ways:
- If it determines that the clock is off by more than 0.5 seconds, it steps the clock's time by calling the settimeofday subroutine. This is the preferred method at boot time.
- If it determines that the clock is off by less than 0.5 seconds, it slews the clock's time by calling the adjtime subroutine with the offset. This method tends to keep a badly drifting clock more accurate, though at some expense to stability. When running the ntpdate command on a regular basis from the cron command instead of running a daemon, doing so once every hour or two results in precise enough timekeeping to avoid stepping the clock.
Notes:
- The ntpdate command's reliability and precision improves dramatically with a greater number of servers. Although you can use a single server, you obtain better performance by providing at least three or four servers.
- If an NTP server daemon like the xntpd daemon is running on the same host, the ntpdate command will decline to set the date.
- You must have root authority on the local host to run this command.
Flags
-a Keyid |
Authenticate all packets using Keyid. |
-b |
Step the clock's time by calling the settimeofday subroutine. |
-d |
Specifies debug mode. Determines what results the ntpdate command produces without actually doing them. The results appear on the screen. This flag uses unprivileged ports. |
-e AuthenticationDelay |
Specifies the amount of time in seconds to delay the authentication processing. |
-k KeyFile |
Specifies a different name for the file containing the keys when not using the default /etc/ntp.keys file. See ... for the description of the KeyFile. |
-o Version |
Specifies the NTP version implementation to use when polling its outgoing packets. The values for Version can be 1, 2 or 3. The default is 3. |
-p Samples |
Specifies the number of samples to acquire from each server. The values for Samples can be between 1 and 8 inclusive. The default is 4. |
-s |
Specifies the use of the syslog facility to log actions instead of using standard output. Useful when running the ntpdate command with the cron command. |
-t TimeOut |
Specifies the amount of time to wait for a response. The value given for TimeOut is rounded to a multiple of 0.2 seconds. The default is 1 second. |
-u |
Specifies the use of an unprivileged port to send the packets from. Useful when you are behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronize with hosts beyond the firewall. A firewall is a system or machine that controls the access from outside networks to a private network. |
Parameters
Server ... |
Specifies the servers to poll. |
Exit Status
This command returns the following exit values:
0 |
Successful completion. |
>0 |
An error occurred. |
Security
Access Control: You must have root authority to run this command.
Auditing Events: N/A
Examples
To set the local date and time by polling the NTP servers at address 9.3.149.107, enter:
/usr/sbin/ntpdate 9.3.149.107
Output similar to the following appears:
28 Feb 12:09:13 ntpdate [18450]: step time server 9.3.149.107
offset 38.417792 sec
Files
/usr/sbin/ntpdate |
Contains the ntpdate command. |
/etc/ntp.keys |
Contains the default key file. |
Related Information
Commands: ntpq, ntptrace, xntpdc
Daemons: xntpd,
[ Next Article |
Previous Article |
Book Contents |
Library Home |
Legal |
Search ]