Rhel5 NTP service configuration

Source: Internet
Author: User
Rhel5 NTP service configuration-Linux Enterprise Application-Linux server application information. The following is a detailed description. 1. install the software package:

Yum install ntp

The Ntp configuration file is/etc/ntp. conf, the working directory is/etc/ntp/, and then the/etc/ntp. conf file is edited.

2. Server Configuration:

IP: 192.168.1.110

Edit the/etc/ntp. conf file:

[Root @ rhel5 ~] # Cat/etc/ntp. conf

# Permit time synchronization with our time source, but do not

# Permit the source to query or modify the service on this system.

Restrict default kod nomodify notrap nopeer noquery

Restrict-6 default kod nomodify notrap nopeer noquery


# Permit all access over the loopback interface. This cocould

# Be tightened as well, but to do so wocould effect some

# The administrative functions.

Restrict 127.0.0.1

# Hosts on local network are less restricted.

Restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap (Intranet Communication allowed)

Restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust (prohibit other ip addresses from updating the time)

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html ).

Server 0.pool.ntp.org (redhat is server 0.redhat.pool.ntp.org by default)

Server 1.pool.ntp.org (redhat is server 1.redhat.pool.ntp.org by default)

Server 2.pool.ntp.org (redhat is server 2.redhat.pool.ntp.org by default)

# Broadcast 192.168.1.255 key 42 # broadcast server

# Broadcastclient # broadcast client

# Broadcast 224.0.1.1 key 42 # multicast server

# Multicastclient 224.0.1.1 # multicast client

# Manycastserver 239.415254.254 # manycast server

# Manycastclient 239.415254.254 key 42 # manycast client

# Undisciplined Local Clock. This is a fake driver intended for backup

# And when no outside source of synchronized time is available.

Server 127.127.1.0

Fudge 127.127.1.0 stratum 10

# Drift file. Put this in a directory which the daemon can write.

# No symbolic links allowed, either, since the daemon updates the file

# By creating a temporary in the same directory and then rename () 'ing

# It to the file.

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 shift of the clock, so that the clock remains accurate even when the external source is cut off)

# Key file containing the keys and key identifiers used when operating

# With encryption Ric key cryptography.

Keys/etc/ntp/keys

# Specify the key identifiers which are trusted.

# Trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.

# Requestkey 8

Logfile/var/log/ntp. log (define log information)

# Specify the key identifier to use with the ntpq utility.

# Controlkey 8

Restrict 0. pool.ntp.org mask limit 255 nomodify notrap noquery

Restrict 1. pool.ntp.org mask limit 255 nomodify notrap noquery

Restrict 1. pool.ntp.org mask limit 255 nomodify notrap noquery

If restric is not followed by a parameter, all permissions are allowed. the above three files affect/etc/ntp/step-tickers, which will follow/etc/ntp. conf file changes.

/Etc/sysconfig/clock is a file used to set the time zone, for example:

[Root @ rhel5 ntp] # cat/etc/sysconfig/clock

# The ZONE parameter is only evaluated by system-config-date.

# The timezone of the system is defined by the contents of/etc/localtime.

ZONE = "Asia/Chongqing"

UTC = true

ARC = false

The/usr/share/zoneinfo directory specifies the time setting files for each major time zone, for example, Chongqing:/usr/share/zoneinfo/Asia/Chongqing.

If you want to write the synchronization time to the BIOS, you need to set the/etc/sysconfig/ntp file and change SYNC_HWCLOCK = no to SYNC_HWCLOCK = yes.

Start the ntp service:

[Root @ rhel5 ntp] # service ntpd restart

Shutting down ntpd: [OK]

Ntpd: Synchronizing with time server: [OK]

Starting ntpd: [OK]

[Root @ rhel5 ntp] # chkconfig ntpd on

3. Client settings:

You can use system-config-time to change the time server to 192.168.1.110, or use ntpdate-u 192.168.1.110 to synchronize with the time server. Remember to restart the NTP service after the changes take effect. Or use crontab-e to edit:

*/5 */usr/sbin/ntpdate-u 192.168.1.110 indicates synchronization every five minutes. Restart the crond service.

Can ntpq be used? P. Check the synchronization status.

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.