One-to-one teaching of NTP Time Server Installation learning notes

Source: Internet
Author: User

Over time, computer clock tends to drift. Network Time Protocol (NTP) is a way to ensure that your clock remains accurate. NTP is installed by default.

Use the following command to view

[Root @ wap etc] # rpm-qa | grep ntp

Ntp-4.2.0.a.20040617-4.EL4.1

The NTP service mainly includes the following files:

/Etc/ntp. conf // The main configuration file of the NTP service.

/Usr/share/zoneinfo // specifies the time setting file for each major time zone, such as Shanghai/usr/share/zoneinfo/Asia/Shanghai

The main Time Zone setting file of/etc/sysconfig/clock // Linux. After each startup, the Linux operating system reads the file to set the preset display time, for example: "Zone = Asia/Shanghai

/Etc/localtim // The time setting file of the local system.

/Bin/date // date and time modification and output commands on Linux

/Sbin/hwclock // the BIOS time of the host is separated from the Linux system time after the date command is adjusted, it only affects the system time. If you want to change the BIOS time, run the hwlock command.

/Usr/sbin/ntpd // NTP daemon

/Usr/sbin/ntpdata // The NTP client is used to connect to the NTP server command file

/Usr/sbin/ntpq // Standard Network Timing protocol NTP) query Program

Configuration

[Root @ wap etc] # vi/etc/ntp. conf

Restrict default ignore // ignore all ntp requests. The restrict 127.0.0.1 restrict 218.0.0.0 mask must have 248 nomodify restrict 202. 0.0.0 mask 255.255.255.0 nomodify restrict 61. 0.0.0 mask 255.255.255.0 nomodify // restrict can be used to restrict subnets and ip addresses. The nomodify parameter indicates that the client can verify the ip address on the server, however, you cannot change the server parameter server 0.pool.ntp.org server 1.pool.ntp.org server 2.pool.ntp.org // note: the server option specifies which server to use and each server has an independent line, if the prefer (preference) parameter restrict 0.pool.ntp.org restrict 1.pool.ntp.org restrict 2.pool.ntp.org is specified on a server, indicates that all permissions can be granted to server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 driftfile/var/lib/ntp/drift/driftfile, and the file used to save the system clock frequency deviation is specified, the ntpd program uses it to automatically compensate for the natural drift of the clock, so that the clock can be used even when the external source is cut off, still maintain considerable accuracy broadcastdelay 0.008 logfile/var/log/ntp. log keys/etc/ntp/keys

Client settings:

Set by crontab timer, run once every 5 minutes

*/5 */usr/local/wapsh/ntprsync. sh

[Root @ AppServer wapsh] # cat ntprsync. sh

#! /Bin/sh

/Usr/sbin/ntpdate 218.0.0.1

/Sbin/hwclock-w

Here, 218.0.0.1 is the Server ip address, so that the client Synchronizes time with the server every five minutes.


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.