Local NTP on RHL


 
Thread Tools Search this Thread
Operating Systems Linux Local NTP on RHL
# 1  
Old 04-01-2012
Local NTP on RHL

Hi I have an offline system, no access to the internet. It has a number of windows vms as well as some physical Red hat linux servers. I would like to one of the linux servers as a NTP server, so its local time is used as the reference point for all the other vms. How do I do this. Most of the articles I have read talk about using some online NTP which the linux or windows syncs with. I want to set my own one up.

Also how to I control changes to the time. Seem like changing the hardware clock time is not enough.

Thanks
# 2  
Old 04-01-2012
Some of tips related to NTP server(conecpt related to oracle rac server which should sync between two servers), Hope this will give some idea, details given below.
+++++++++++++++++++++++++++++++++

In this Document
Purpose
Scope
Linux OS Service 'ntpd'
Service Name
Description
Nature
Service Control
Configuration
Oracle Enterprise Linux Version(s)
See Also
Notes
References




Applies to:

Linux OS - Version: 4.4 to 5.1 - Release: OEL4U4 to OEL5U1
Linux x86
Linux x86-64
Linux Kernel - Version: 4.4 to 5.1
***Checked for relevance on 25-Jan-2011***
Purpose

This is a reference document to describe Linux operating system service 'ntpd' with respect to its use, scope, nature and applicability.

Scope

This document is useful for Linux operating system administrators for the specific Linux OS service 'ntpd'
Linux OS Service 'ntpd'

Service Name
ntpd
Description
This service executes the Network Time Protocol (NTP) daemon ntpd. The purpose is to synchronize the time of the local computer to a NTP server or other reference time source such as a radio or satellite receiver or modem. The NTP time protocol provides accuracies typically within a millisecond on LANs and up to a few tens of milliseconds on WANs relative to Coordinated Universal Time (UTC) via a Global Positioning Service (GPS) receiver. The Linux NTP package is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with prior versions 1, 2, and 3.

The NTP system uses two main roles for participating computers: server or client. Time servers supply time to one or more NTP clients. NTP clients use the reference time from one or more NTP servers to determine the local time. This scheme allows an NTP client to reject bogus time from an NTP server; to compensate for network-induced delays; and to determine which NTP server has the best time. An NTP client may also server as an NTP server for other machines.

The ntpd program operates by exchanging messages with one or more configured servers at designated poll intervals. The program requires several exchanges from the majority of chosen servers so the signal processing and mitigation algorithms can accumulate and groom the data before setting the local clock.

Usually each country provides an official time reference. In the USA, the National Institute of Standards (NIST) provides this service. The national time reference is called a tier 1 server. NTP servers who use this source for their reference time are called tier 2 servers. NTP servers who connect to tier 2 servers are known as tier 3 servers, and so on. NTP clients who use their own atomic clocks are also called tier 1 servers. NTP clients must connect to an NTP server to synchronize their clocks. Some ISPs provide NTP server access to their clients, but publicly-accessible servers at pool.ntp.org are also available. Higher-tier NTP servers are usually no less accurate than their lower-tier counterparts, which can get overburdened. Many companies implement their own NTP server by connecting to external NTP servers, reducing the load on these external servers.

Most machines have a real-time chip (RTC) to maintain the time during periods when the power is off. When the machine is booted, the calendar chip is used to initialize the operating system time; the ntpdate(1) program can also be used to set the local time from a reference NTP server.. After the machine has synchronized to an NTP server, the operating system corrects its notion of time gracefully. Under ordinary condition, ntpd adjusts the O/S clock in small steps so that the timescale is effectively monotonic, without discontinuities. Once the clock has been set, its accuracy is continuously checked and adjustments for any drift are stored into a local file and are thus saved across reboots. Usually at system shutdown the O/S updates this RTC clock chip with the current time, thus closing the cycle.

The Linux NTP service is quite configurable. Comprehensive on-line documentation is supplied in both ntpd(1) manual pages and /usr/share/doc/ntp-<version> documentation.

Note: this service is needed even for NTP clients. The server/client role is distinguished by its configuration.


The RPM package containing this service:

ntp
Nature
Daemon service
Service Control

This service is handled by init.d script /etc/init.d/ntp. Its usage is as follows:

# /sbin/service ntpd
usage: /etc/init.d/ntpd {start|stop|restart|condrestart|status}
#


Start the service as follows:

# /sbin/service ntpd start
ntpd: Synchronizing with time server: [ OK ]
Starting ntpd: [ OK ]
#


Stop the service as follows:

# /sbin/service ntpd stop
Shutting down ntpd: [ OK ]
#


Check if the serivce is started or stopped:

# /sbin/service ntpd status
ntpd is stopped
#


If the service is started, then restart it; otherwise do nothing. Typically used only by the RPM install scripts.

# /sbin/service ntpd condrestart
Shutting down ntpd: [ OK ]
Starting ntpd: [ OK ]
#


Determine which system run levels the service is active:

# /sbin/chkconfig --list ntpd
ntpd 0Smilieff 1Smilieff 2Smilieff 3Smilien 4Smilieff 5Smilien 6Smilieff
#

Configuration
Ordinarily, ntpd reads the ntp.conf configuration file at startup time in order to determine the synchronization sources and operating modes. It is also possible to specify a working, although limited, configuration entirely on the command line, obviating the need for a configuration file.

Usually, the configuration file is installed in the /etc directory, but could be installed elsewhere (see the -c conffile command line option). The file format is similar to other Unix configuration files - comments begin with a # character and extend to the end of the line; blank lines are ignored.
The default ntp.conf file like this:
restrict default nomodify notrap noquery

restrict 127.0.0.1

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

driftfile /var/lib/ntp/drift
broadcastdelay 0.008

keys /etc/ntp/keys

In addition, ntpd daemon can be run with various options. In order to add command line options to the ntpd service (/etc/init.d/ntpd), one has to edit /etc/sysconfig/ntpd file and add the desired option to the OPTIONS variable, and restart the service via 'service ntpd restart'.

For example, the -x argument is mandatory for RAC configurations and the /etc/sysconfig/ntpd file looks as:

# Drop root to id 'ntp:ntp' by default.
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=no

# Additional options for ntpdate
NTPDATE_OPTIONS=""


You can check the settings from that /etc/sysconfig/ntpd file but it will not be reliable if the ntpd process is started manually for some reason. To check the arguments you can use command line:
# ps -o args -p `cat /var/run/ntpd.pid`
COMMAND
ntpd -x -u ntp:ntp -p /var/run/ntpd.pid
#


Files: /etc/ntp/ntp.conf - the default name of the configuration file
/var/lib/ntp/drift - the default name of the drift file
/etc/ntp/keys - the default name of the key file
/etc/sysconfig/ntpd - setting command line options for ntpd daemon

Oracle Enterprise Linux Version(s)
  • OEL 4 (Base to Update 6)
  • OEL 5 (Base to Update 1)
See Also

See the man page ntpd(1)
See the man page ntpdate(1)
ntp.org: Home of the Network Time Protocol

Notes

None

References

http://www.ntp.org/

++++++++++++++++
Mohammed Fareed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Ntp client sync with local over ntp server

Hi, I have two ntp servers in my cluster and I want all the nodes in my cluster to sync with either of the ntp servers or just one. Unfortunately it keep rotating the sync, between my ntp server 1, ntp server 2 and local. Is there anyway I can change the sync to avoid local? # ntpq -p ... (3 Replies)
Discussion started by: pjeedu2247
3 Replies

2. UNIX for Dummies Questions & Answers

Help needed - RHL

Hi, have been given a dell server with redhat linux installed , in my new company on my desk , have not worked much on linux. Was also given a static IP. I dont have a console, but a monitor, that I switch between my desktop and this server. yesterday I wanted to change IP of the server... (4 Replies)
Discussion started by: abhi123
4 Replies

3. HP-UX

Setting up NTP HP-UX clients from solaris NTP server

Hi I wonder if its possible to setup NTP clients running HP-UX o.s. from a solaris 10 NTP server? FR (3 Replies)
Discussion started by: fretagi
3 Replies

4. Linux

How often does Linux NTP server update its time with the external NTP server?

All here, thank you for listening. Now I've set up a Linux NTP server by adding a external windows NTP server in /etc/ntp.conf. Then I start the ntpd daemon. But how often does the Linux NTP server update its time with the external NTP server? I've looked up everywhere but found no information... (1 Reply)
Discussion started by: MichaelLi
1 Replies

5. AIX

Do I need to configure my local windows to FTP files from local windows to a UNIX AIX server?

Hi Friends, I have this script for ftping files from AIX server to local windows xp. #!/bin/sh HOST='localsystem.net' USER='myid_onlocal' PASSWD='mypwd_onlocal' FILE='file.txt' ##This is a file on server(AIX) ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE... (1 Reply)
Discussion started by: rajsharma
1 Replies

6. UNIX for Dummies Questions & Answers

Can you force local NTP server to be accepted as "suitable"?

Is there some way to force the NTP server on a brand-new install to be "suitable" to sync other servers from? (I'm more concerned with synchronization between machines, and less concerned with what the actual time they sync to is) For example, whenever I install fresh from the Fedora DVDs and... (0 Replies)
Discussion started by: jjinno
0 Replies

7. Debian

HDD not detected by RHL 9 (or 7.2)

Hi, I have got myself a new hard disk- a 80 GB SATA IDE from Seagate. When I try installing Red Hat Linux 9(and RHL 7.2 too), it displays an error message saying that it fails to detect any hard drive. In the BIOS, I tried changing the drive configuration to "Legacy Drive", but that didnt help... (5 Replies)
Discussion started by: Abhishek Ghose
5 Replies

8. Solaris

ntp server and ntp client

All, How do you set a Solaris 9 server which received ntp updates from a ntp server to broadcast them on a local subnet. I have created a /etc/inet/ntp.conf file to receive the updates from a server on network and need to make this server become like a ntp relay from the main server. Any... (1 Reply)
Discussion started by: bubba112557
1 Replies

9. UNIX for Dummies Questions & Answers

External Modem for RHL 7.3...

Another stupid question... and I can only hope someone can spend a little time answering it... So thats it. I went thru the documentation out there at linmodems.org, trie this and that... read thru this post https://www.unix.com/showthread.php?s=&threadid=1787 on my favorite forums. And... (3 Replies)
Discussion started by: Vishnu
3 Replies

10. UNIX for Dummies Questions & Answers

Dual booted RHL 7.3 with Win XP..

Hello all, I'm a no Linux expert! But I perfectly dual booted Win XP with RHL 7.3 on a hp pavilion notebook (model ze5170). All working fantastic now. But I have a minor problem now. I can't get RHL probe the modem, so could not get the internet connection working. The modem is a Conexant... (1 Reply)
Discussion started by: Vishnu
1 Replies
Login or Register to Ask a Question