Configure the time server in RedHat9

Source: Internet
Author: User
Article Title: configure the time server under RedHat9. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In linux, we can use the built-in NTP (Network Time Protocol) Protocol to keep our systems accurate over the Network. The available public time server list can be obtained from the following address:
  
Http://www.eecis.udel.edu /~ Mills/ntp/servers.html
  
   What is NTP?
NTP is a protocol used to synchronize time between the system and a precise time source. We recommend that you create at least one time server in your managed network to synchronize local time, which makes it easier to process and collect logs and manage them on different systems.
  
There are also many free NTP clients available for Windows, and you can use them to synchronize your windows system time.
  
   Download and install
This article describes how to install the time server on RedHat9.0. If you want to get the latest NTP version, you can download the tar package and compile it by yourself. Here only the NTP service software installed in RPM mode is described.
  
The NTP version of RedHat9.0 is 4.1.2. You can run the following command to check whether the software package has been installed:
  
# Rpm-qa | grep ntp
Chkfontpath-1.9.7-1
Ntp-4.1.2-0.rc1.2
  
If no installation is found, install the software on the CD. Run the following command to install the ntp rpm package:
  
# Rpm-ivh ntp-4.1.2-0.rc1.2.i386.rpm
  
   /Etc/ntp. conf
This is the main configuration file of NTP. It sets the domain name or IP address of the time server you used to synchronize the time. The following is the most basic configuration for synchronizing time to the Internet:
  
First, define our favorite time server:
  
Server ntp.research.gov
Server otherntp.research.gov
  
Next, we set the access permissions for the above two servers. In this example, we do not allow them to modify or query the NTP server we configured on Linux.
  
Restrict ntp.research.gov mask limit 255 nomodify notrap noquery
Restrict otherntp.research.gov mask limit 255 nomodify notrap noquery
  
Mask 255.255.255.255 is used to restrict the mask address of the remote NTP server.
  
Next, set the client address that allows access to our time server. Generally, these servers should be in our own LAN. Note that noquery has been removed from the Configuration:
  
Restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap
  
In the above example, the mask address is extended to 255, so all servers from 192.168.0.1-192.168.0.254 can use our NTP server to synchronize time.
  
Finally, the most important thing is that the default restricted configuration should be deleted from your configuration file. Otherwise, it will overwrite all your configuration options and you will find that if you do not delete the configuration, your time server can only communicate with itself. Comment out the following line in ntp. conf:
  
# Restrict default ignore
  
Save your configuration file, and then execute the 2-part query command for each time server you configured in ntp. conf:
  
# Ntpdate ntp.research.gov
27 Jun 10:12:01 ntpdate [25475]: adjust time server ntp.research.gov offset-0.127154 sec
# Ntpdate ntp.research.gov
27 Jun 10:12:06 ntpdate [25478]: adjust time server ntp.research.gov offset 0.010008 sec
  
   Enable the NTP Process
To enable the NTP service to automatically start during system boot, run:
  
# Chkconfig ntpd on
  
The command to start/disable/restart NTP is:
  
#/Etc/init. d/ntpd start
#/Etc/init. d/ntpd stop
#/Etc/init. d/ntpd restart
  
Remember to restart the service every time you modify the configuration file to make the configuration take effect. You can run the following command to check whether the NTP service is started. You should be able to get a process ID:
  
# Pgrep ntpd
  
Check whether the time server is correctly synchronized
Run the following command to check the synchronization status of the Time Server:
  
# Ntpq-p
  
Output:
  
Remote refid st t when poll reach delay offset jitter
========================================================== ==============================================
-Jj.cs.umb.edu gandalf. sigmaso 3 u 95 1024 377 31.681-18.5491.572
Milo. mcs. anl. go ntw.mcs. anl. go 2 u 818 1024 125-15.20.1.392
-Mailer1.psc.edu ntp1.usno. navy. 2 u 972 1024 377 38.206 19.589
-Dr-zaius.cs.wis ben.cs.wisc.edu 2 u 502 1024 357 55.0983.9790.333
+ Taylor. cs. wisc. ben.cs.wisc.edu 2 u 454 1024 347 54.20.3.20.0.047
-Nt1_cis. strath harris. cc. strat 3 u 507 1024 377-5.0251.20.
* Clock.via.net. GPS.1 u 426 1024 377-3.0182.534
Ntp1.conectiv. c 0.0.0.0 16 u-10240 0.20..000 4000.00
   
  
One evidence proves that the jitter value of all remote servers is 4000 and the value of delay and reach is 0.
  
Remote refid st t when poll reach delay offset jitter
  
========================================================== ==============================================
  
LOCAL (0) LOCAL (0) 10 l-6470.0000.000 0.008
  
Ntp-cup.externa 0.0.0.0 16 u-6400.0000.000 4000.00
  
Snvl-smtp1.trim 0.0.0.0 16 u-6400.0000.000 4000.00
  
Nist1.aol-ca. tr 0.0.0.0 16 u-6400.0000.000 4000.00
  
Possible causes include:
  
Restrict default ignore in the configuration file is not commented out
  
A firewall blocks communication with the server.
  
In addition, it takes about 3-5 minutes to restart the NTP server before the client can establish a normal communication connection with the server. Otherwise, when you execute the ntpdate ip address, the system will return:
  
27 Jun 10:20:17 ntpdate [1, 21920]: no server suitable for synchronization found
  
  
Related Article

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.