此内容没有您所选择的语言版本。
22.9. Understanding the ntpd Configuration File
			The daemon, 
 
Copy to Clipboard
Copied!
 
 
Toggle word wrap
Toggle overflow
 
 
			 The configuration commands are explained briefly later in this chapter, see Section 22.16, “Configure NTP”, and more verbosely in the 
ntpd, reads the configuration file at system start or when the service is restarted. The default location for the file is /etc/ntp.conf and you can view the file by entering the following command: 
less /etc/ntp.conf
~]$ less /etc/ntp.confntp.conf(5) man page.
		
			Here follows a brief explanation of the contents of the default configuration file: 
			
		
- The driftfile entry
- A path to the drift file is specified, the default entry on Red Hat Enterprise Linux is:If you change this be certain that the directory is writable bydriftfile /var/lib/ntp/drift driftfile /var/lib/ntp/driftCopy to Clipboard Copied! Toggle word wrap Toggle overflow ntpd. The file contains one value used to adjust the system clock frequency after every system or service start. See Understanding the Drift File for more information.
- The access control entries
- The following lines setup the default access control restrictions:Therestrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noqueryCopy to Clipboard Copied! Toggle word wrap Toggle overflow kodoption means a “Kiss-o'-death” packet is to be sent to reduce unwanted queries. Thenomodifyoptions prevents any changes to the configuration. Thenotrapoption preventsntpdccontrol message protocol traps. Thenopeeroption prevents a peer association being formed. Thenoqueryoption preventsntpqandntpdcqueries, but not time queries, from being answered. The-6option is required before anIPv6address.Addresses within the range127.0.0.0/8are sometimes required by various processes or applications. As the "restrict default" line above prevents access to everything not explicitly allowed, access to the standard loopback address forIPv4andIPv6is permitted by means of the following lines:Addresses can be added underneath if specifically required by another application. Thethe administrative functions. # the administrative functions. restrict 127.0.0.1 restrict -6 ::1Copy to Clipboard Copied! Toggle word wrap Toggle overflow -6option is required before anIPv6address.Hosts on the local network are not permitted because of the "restrict default" line above. To change this, for example to allow hosts from the192.0.2.0/24network to query the time and statistics but nothing more, a line in the following format is required:To allow unrestricted access from a specific host, for examplerestrict 192.0.2.0 mask 255.255.255.0 nomodify notrap nopeer restrict 192.0.2.0 mask 255.255.255.0 nomodify notrap nopeerCopy to Clipboard Copied! Toggle word wrap Toggle overflow 192.0.2.250/32, a line in the following format is required:A mask ofrestrict 192.0.2.250 restrict 192.0.2.250Copy to Clipboard Copied! Toggle word wrap Toggle overflow 255.255.255.255is applied if none is specified.The restrict commands are explained in thentp_acc(5)man page.
- The public servers entry
- By default, as of Red Hat Enterprise 6.5, thentp.conffile contains four public server entries:If upgrading from a previous minor release, and yourserver 0.rhel.pool.ntp.org iburst server 1.rhel.pool.ntp.org iburst server 2.rhel.pool.ntp.org iburst server 3.rhel.pool.ntp.org iburst server 0.rhel.pool.ntp.org iburst server 1.rhel.pool.ntp.org iburst server 2.rhel.pool.ntp.org iburst server 3.rhel.pool.ntp.org iburstCopy to Clipboard Copied! Toggle word wrap Toggle overflow /etc/ntp.conffile has been modified, then the upgrade to Red Hat Enterprise Linux 6.5 will create a new file/etc/ntp.conf.rpmnewand will not alter the existing/etc/ntp.conffile.
- The broadcast multicast servers entry
- By default, thentp.conffile contains some commented out examples. These are largely self explanatory. See the explanation of the specific commands Section 22.16, “Configure NTP”. If required, add your commands just below the examples.
Note
				When the 
DHCP client program, dhclient, receives a list of NTP servers from the DHCP server, it adds them to ntp.conf and restarts the service. To disable that feature, add PEERNTP=no to /etc/sysconfig/network.