Sets the date and time using the Network Time Protocol (NTP). This command only applies to AIX® 4.2 or later.
ntpdate [ -b ] [ -c ] [-d ] [ -s ] [ -u ] [ -a Keyid ] [ -e AuthenticationDelay ] [ -k KeyFile ] [ -o Version ] [ -p Samples ] [ -t TimeOut ] Server ...
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:
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.
Item | Description |
---|---|
-a Keyid | Enable the authentication function and authenticate all packets using Keyid. By default, the authentication function is disabled. |
-b | Step the clock's time by calling the settimeofday subroutine. |
-c | Slew the clock's time by calling the adjtime 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. Typical values range from 0.0001 to 0.003. |
-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. |
Item | Description |
---|---|
Server ... | Specifies the servers to poll. |
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
Access Control: You must have root authority to run this command.
Auditing Events: N/A
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
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
Item | Description |
---|---|
/usr/sbin/ntpdate | Contains the ntpdate command. |
/etc/ntp.keys | Contains the default key file. |