Linux Time Server Setup

Source: Internet
Author: User
Tags local time

One

Because the work needs, I need to set up an NTP server for time synchronization test, in the company has always thought very difficult to build, but also just work, and so on, and so the tutor to help to get a server, the result of the tutor gave me a system called fedora, let me build, in the company toss an afternoon, Did not get out, back home own research with the CentOS 6.0来 build NTP server, finally finally the party building success, feel the CentOS system is awesome, because many things are installed, do not have their own Ann, is really the best system of server system.

First of all, the procedure is not to say the principle, the building process is done under VMware, my component steps are:

1. Install the system first, then start to see if the system has NTP server components installed, using RMP-QA | grep NTP command to see what the result contains NTP 4.2 What, the NTP software has been installed, this time as long as the Services service NTPD RESATRT, in fact, the server is available, but need to use some features, need to be further configured, his parameter configuration is Is the configuration/etc/ntp.conf this file. The main features are in this file.

2, modify/etc/ntp.conf:

In the file restrict default Kod nomodify notrap nopeer Noquery commented out (before adding "#"), this should be too restrictive on the client, so remove it.

Add restrict default nomodify notrust to allow all clients to obtain time data. The functions of the Notrust parameter are and need to be authenticated to synchronize, that is, the client synchronization command must have keyID and key to pass.

3, the Trustedkey front of the # tick off, followed by the specified number Trustedkey 1 2 3, the number is arbitrary, but must be consistent with the values in the/etc/ntp/keys file. Note meaning: # Specify the key identifiers which is trusted-> "specifies that the key identifier is trustworthy", that is to say 1 2 3 these three numbers respectively as the authentication keyID.

4. #server 127.127.1.0 # Local Clock

#fudge 127.127.1.0 Stratum 10

Remove the previous # of the above two records, which is defined to keep the NTP server in sync with itself, and if the server defined in/ntp.conf is unavailable, the local time will be used as the NTP service for the NTP client. The purpose of modifying the above two is to provide the client with the time of the local NTP server as the synchronization time of the NTP service if there is no Internet connection, only the local network, that is, no internet access.

5. Finally save and exit.

6, modify the/etc/ntp/keys file,

Add to:

1 M Gao

2 M Tian

3 M di

The preceding number must be the same as the number specified behind Trustedkey in the/etc/ntp.conf file, and the string is arbitrary.

The following instructions are not related to server configuration and can be skipped!!!!!!

After configuring it, the client executes the Ntpdate Synchronization command is required to specify the keyID and key files, all clients need to configure the key file, the number of files to be consistent with the number of/etc/ntp/keys records, that is, three files, each file corresponding to a record, such as Service_ The Key1 file holds 1 m Gao, the service_key1 file corresponds to 2 M Tian, and so on, the file can be arbitrarily specified without the sequential order requirement. The keyId specified when the client executes the Ntpdate Synchronization command is consistent with the values in the key file. The values and strings recorded for each strip need to be provided to the client, which the client needs to authenticate to synchronize.

7, modify the next time zone Cp/usr/share/zoneinfo/asia/hong_kong/etc/localtime I do not know whether to modify the time zone is necessary.

8, and then start the NTP service ntpd Restart, wait, note that the NTP restart is delayed, so there are times when the reboot did not find that the modification configuration to take effect, because of this delay caused. This means that after restarting the service, you will have to wait for a while, and the synchronization cannot be successful, because NTP server is not synchronized with itself or its server.

Two

The following is the way to configure authentication, so more clearly, copied

Original address: http://www.cnblogs.com/itfriend/archive/2011/12/15/2289028.html

1. Configure NTP server
[Root etc] #cat/etc/ntp.conf
Broadcastclient
Keys/etc/ntp/keys
Trustedkey 1
2. Configure the key
[Root etc] #cat/etc/ntp/keys
1 M
3. Restart the NTPD service
[Root etc] #stopsrc-s XNTPD
0513-044 THE/USR/SBIN/XNTPD Subsystem is requested to stop.
[Root etc] #startsrc-s XNTPD
0513-059 the XNTPD Subsystem has been started. Subsystem PID is 1912936.

Client Authentication
[Root etc] #ntpdate-a 1-k/etc/ntp/keys-q 192.168.6.3

These three addresses are the methods of configuring the NTP server, and the main reference is the three tutorials

Http://www.linuxidc.com/Linux/2012-08/67223.htm

Http://www.lampbo.org/linux-xuexi/linux-sever/linux-system-server-config-ntp-server.html

Http://www.linuxidc.com/Linux/2012-06/62658.htm

Third, finally through the simplest command to test the success of the server, execute "ntpdate 192.168.28.55" on the client system, and then use the "date" command to see if the system time has changed, the change indicates that the synchronization was successful. Windows system can run the "date and time" in the Control I panel, select the "Internet Time" tab, set the synchronization server 192.168.28.55, and then "Update Now", success indicates that the NTP server configuration is successful.

Linux Time Server Setup

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.