NTP Time Server Installation Study Notes-Linux Enterprise Application-Linux server application information, the following is a detailed description. 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
NTP service, mainly including four files
/Etc/ntp. conf; the main configuration file of the NTP service.
/Usr/share/zoneinfo; specifies the time setting files for each major time zone, such as Shanghai/usr/share/zoneinfo/Asia/Shanghai
/Etc/sysconfig/clock; Linux's main Time Zone setting file. After each startup, the Linux operating system reads this file to set the system's preset display time, for example, "Zone = Asia/Shanghai
/Etc/localtim; specifies the time setting file of the local system.
/Bin/date the date and time modification and output commands in Linux
The BIOS time of the/sbin/hwclock 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 service daemon
/Usr/sbin/ntpdata; the NTP client is used to connect to the NTP server command file.
/Usr/sbin/ntpq Standard Network Time Protocol (NTP) query Program
Configuration
[Root @ wap etc] # vi/etc/ntp. conf
Restrict default ignore
// Ignore all ntp required packets
Restrict 127.0.0.1
Restrict 218.0.0.0 mask has been modified 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 pass server verification, but cannot change server parameters.
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 row. If prefer parameter is specified on a server
Restrict 0.pool.ntp.org
Restrict 1.pool.ntp.org
Restrict 2.pool.ntp.org
// If restric is not followed by a parameter, all permissions are allowed.
Server 127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10
Driftfile/var/lib/ntp/drift
// The driftfile option specifies the file used to save the system clock frequency deviation. The ntpd program uses it to automatically compensate for the natural drift of the clock, so that the clock can maintain a considerable accuracy even when the external source is cut off.
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.
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