NTP multi-mode configuration

Source: Internet
Author: User
Tags net time

I installed and configured an NTP server some of the experience, I hope to share with you. Wrote a document containing the specific meaning of the various commands and parameters, because cannot upload can not share with you. In the future I hope that we can support and help us grow together, I will continue to do these years of business and lessons to share with you.

In daily life, we will encounter problems with the server or the time of our PC is inaccurate. Especially in some of the more important industries, the system of time requirements are relatively high. The system needs an accurate and reliable clock source to ensure the operation of the application. Especially in the securities industry, time requirements are more stringent. Generally, depending on the time provided by the stock Exchange, on the workstation of the offer system, the stock exchange will force a daily update of its time to meet the standard time of the Exchange configuration. We can set up the workstation as an NTP server, providing other systems with the same time service as the exchange. At the same time on the internet there are a large number of times the server can be connected, can be configured for its clients to calibrate our host time.

1 NTPService Introduction

Network time Protocol (NTP) is a protocol used to synchronize the computer's timing, which allows the computer to synchronize its servers or clock sources (such as quartz clocks, GPS, and so on), which provides high-precision time correction (less than 1 milliseconds between the LAN and the standard difference, Dozens of MS on the WAN), and can be referred to as a cryptographic acknowledgment to prevent malicious protocol attacks. NTP can take advantage of multiple paths and sources of time servers to more accurately calibrate time.

Most of the operating systems now support NTP, such as having their own NTP services in UNIX and Windows. For example, SNTP in Windows. Because the system vendors will be based on their own system to optimize NTP and set up, more suitable for his own system, the compatibility of other systems will be much worse. There are different versions of the NTP service that are used by the system at various times. The latest version bit V4, because each version has his own characteristics. So there are some compatibility issues when setting up an NTP server. Therefore, in a multi-type operating system environment, try to use the software provided by the NTP official organization instead of using the NTP server provided by the other vendors in the system. NTP official organization for Www.ntp.org

2 NTPHow the server operates

NTP servers are used in a way that includes fixed connections and dynamic connections. In a fixed connection, the client receives only the specified server-side connection and does not switch to another server-side receive time, regardless of whether the service side is connected properly. General client/server mode for this mode. In addition, the client is constantly receiving the server-side broadcast information, and when a server stops the service, the client can update the time normally, as long as the server broadcasts the correct and reliable time information. It is generally connected by broadcast mode.

Server/Client Mode

Client server is the most widely used method on the Internet, after setting up the server, he can configure the client flexibly, let the client choose whether to use NTP server or use that NTP server. The client server uses common RPC (remote-procedure-call) mode to transfer time information. They run the process for the client to make time requests to the server side, and then adjust the time based on the server-side response.

In general, the client can define the interval between their synchronization time, and they request the maximum and minimum time intervals. Clients will be based on their own clock time and NTP server time comparison, if the client's native clock is more accurate, their query time interval will be longer, if the local time error is large, the client will be in a relatively short time to make time requests to ensure the accuracy of client time.

Broadcast/multicast mode

Multicast and broadcast methods use broadcast and multicast protocols on Ethernet for time synchronization, and the time server sends broadcast and multicast information to the specified network segment on a timed basis. Using broadcast and multicast requires network devices to support the protocol, and the client also supports the protocol. You can use multicasting and manycasting to broadcast information on different network segments to provide NTP services using broadcast and multicast in complex networks with multiple network segments.

Active/Passive Mode

Active/Passive mode is used at most in the cluster system, because the cluster system for all servers in the same cluster time synchronization requirements are more stringent, they are configured for the NTP server side and the client, in the non-stop clock synchronization service, when one of the servers will not immediately affect the time synchronization of other servers. Can be said to be prepared in a way to synchronize time services.

3 NTPConfiguration file

Filename

Default location

Options

Using commands

Configuration file

/etc/ntp.conf

-C

None

Frequency file

/etc/ntp.drift

-F

Driftfile

Process PID File

None

-P

Pidfile

Log file

System log

-L

LogFile

Library files

None

None

Includefile

Status information file

/var/ntp

-S

Statsdir

Password file

/usr/local/etc

-K

Keysdir

4 NTPConfiguring server-side configuration for servers

The default configuration file on the NTP server side is the/etc/ntp.conf file (depending on the OS may be in different locations, as in Solaris under/etc/inet/ntp.conf).

Parameters for the configuration file:

The main four parameters:

Server address [Options ...]

Peer address [Options ...]

Broadcast address [Options ...]

Manycastclient address [Options ...]

These four parameters mainly specify the server name and IP address used by the NTP server and their operating mode. The name or address can be a host name, an IP address, and a DNS-resolved domain name.

Server is generally used for servers, the server does not go to synchronize other server time, the general server can be followed by 127.127.1.0 the address represents this level of the clock, if the server and other server IP, Indicates that the address of the other time server will be synchronized.

Peer General configuration indicates that the server receives the addresses of other servers and also provides an NTP server for other devices.

Broadcast configured as broadcast address

Manycastclient configured as a multicast address

The specific explanations are as follows:

Server

For type S and R addresses (only), this command normally mobilizes a persistent Client mode association with the specified Remote server or local reference clock. If The preempt flag is specified, a preemptable association is mobilized instead. In client mode the client clock can synchronize to the remote server or local reference clock, but the remote server can n Ever is synchronized to the client clock. This command should is used for type B or M addresses.

Peer

For type S addresses (only), this command mobilizes a persistent Symmetric-active mode association with the specified remo Te peer. In this mode the local clock can is synchronized to the remote peer or the remote peer can be synchronized to the local CL Ock. This was useful in a network of servers where, depending on various failure scenarios, either the local or remote peer may Be the better source of time. This command should is used for type B, M or R addresses.

Broadcast

for type B and M addresses (only), this command mobilizes a persistent broadcast mode Association. Multiple commands can be used to specify multiple local broadcast interfaces (subnets) and/or multiple multicast groups. Note that local broadcast messages go only to the interface associated with the subnet specified, but multicast messages G o to all interfaces.

In broadcast mode The local server sends periodic broadcast messages to a client population at the address specif IED, which is usually the broadcast address on (one of) the local network (s) or a multicast address assigned to NTP. The IANA have assigned the multicast group address IPv4 224.0.1.1 and IPv6 ff05::101 (site local) exclusively to NTP, but O Ther nonconflicting addresses can be used to contain the messages within administrative boundaries. Ordinarily, this specification applies only to the local server operating as a sender; For operation as a broadcast client, see the broadcastclient or multicastclient commands below.

Manycastclient

for type M addresses (only), this command mobilizes a preemptable manycast client mode Association for the multicast group address specified. In this mode a specific address must is supplied which matches the address used on the manycastserver command for the Desi gnated manycast servers. The NTP multicast address 224.0.1.1 assigned by the IANA should isn't be used, unless specific means is taken to avoid SPRA Ying large areas of the Internet with these messages and causing a possibly massive implosion of replies at the sender.

The manycastclient command specifies that the host was to operate in client mode with the remote servers that was Discovere D as the result of broadcast/multicast messages. The client broadcasts a request message to the group address associated with the specified address and specifical LY enabled servers respond to these messages. The client selects the servers providing the best time and continues as with the server command. The remaining servers is discarded as if never heard.

Additional option parameters:

You can also add parameters to control the NTP service

AutoKey

Burst

Iburst

Key Key

Minpoll Minpoll
Maxpoll Maxpoll

Noselect

Preempt

Prefer

True

TTL ttl

Version version

Dynamic

At the same time the NTP server also has the configuration security, the encryption, in the different network segments and so on configuration, the concrete may refer to www.ntp.org.

Client Configuration

1. The UNIX and Linux servers are configured by:

Edit/etc/ntp.conf (/etc/inet/ntp.conf in Solaris)

Add the server IPADDRESS to the file

2. How to configure in Windows 2000:

In the command line mode, enter:

NET time/setsntp:10.20.0.1 (specify NTP server IP)

net stop W32Time (turn off NTP service)

Net start W32Time (start NTP service)

W32tm–s (synchronous NTP time)

3. Configured in Windows XP to:

Control Panel à date, time, language and locale à date and time

Add the IP address of the NTP server to the server basket.

5 NTPThe commands inntpdCommand

The NTPD command configures the process for the NTP service, while the NTPD command can configure the NTP service. At execution time NTPD reads the configuration information from the configuration file/etc/ntp.conf and then executes the properties specified in the configuration file.

The parameter options for the NTPD command are used:

NTPD [ -46AABDDGLMNNQX] [-C conffile ] [-F driftfile ] [-I jaildir ] [-K keyfile ] [-L logfile ] [-P pidfile ] [-P priority] [-R Broadcastdelay ] [-S STATSDI  R ] [-t key ] [-u user[:group]] [-u interface_update_interval ] [-V variable ] [-v variable ]

Ntpq command

The NTPQ command is a command used to query the NTP service and can query for more detailed information, including the parameter command pattern and the interactive command pattern.

NTPQ [-INP] [-C Command] [host] [...]

NTPDC command

NTPDC is a special NTP query command

NTPDC [-ilnps] [-C Command ] [ host ] [...]

ntptrace command

The ntptrace command is a command that tracks the transmission of information from an NTP service, can view the transport status of the service, and finds the process by which NTP information is sent from that server and the command is transmitted.

Ntptrace [-VDN] [-R Retries ] [-t timeout ] [ server ]

NTP multi-mode configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.