Solved

standalone ntp server

Posted on 2009-07-02
6
1,016 Views
Last Modified: 2012-05-07
hi, guys

I'm looking to setup an NTP server, i looked around and googled without success, what i want is the server itself provide time, i dont want it to be connected to for example
hk.pool.ntp.org.
and then the client get sync with the server, the point for that is because i'm doing some testing and i need to change the time on the server constantly.

my question is, how do i configure /etc/ntp.conf on the server and client?
i'm using RHEL 5

thank you guys.
0
Comment
Question by:jusbug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24764174
Hi,
- configure in /etc/ntp.conf (server)
server 127.127.1.0
fudge  127.127.1.0 stratum 10
driftfile /etc/ntp.drift
where 127.127.1.0 means
127.127 = constant
1 = clock type, 1 = system clock
0 = instance
stratum 10 to indicate it's not a DCF77 clock or the like, but just a simple hardware clock.
 
- configure in /etc/ntp.conf (client)

server ip.of.your.server
driftfile /etc/ntp.drift
- restart xntpd on server and client
That should do the trick
wmp
 
 
 
0
 

Author Comment

by:jusbug
ID: 24765406

thanks for your reply but i did exactly what you said and the client doesn't sync with the server.

in client when i do "ntpdate -u 192.168.2.200" (192.168.2.200 is the server) i got:
 "2 Jul 17:58:52 ntpdate[4394]: no server suitable for synchronization found"

and when i do "ntpq -p" i got:

remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.2.200   .INIT.          16 u    -   64    0    0.000    0.000   0.000


ntp.conf for server is:

# 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

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# 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

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.2.200
driftfile /etc/ntp.drift
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org

#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.255.254.254            # manycast server
#manycastclient 239.255.254.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.
fudge      127.127.1.0 stratum 10      

# Drift file.  Put this in a directory which the daemon can write to.
# 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

# Key file containing the keys and key identifiers used when operating
# with symmetric 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

# Specify the key identifier to use with the ntpq utility.
#controlkey 8
restrict 192.168.2.200 mask 255.255.255.255 nomodify notrap noquery


the client is:

# 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

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
restrict 192.168.2.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 127.127.1.0
fudge 127.127.1.0 stratum 10
driftfile /etc/ntp.drift
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org

#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.255.254.254            # manycast server
#manycastclient 239.255.254.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 to.
# 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

# Key file containing the keys and key identifiers used when operating
# with symmetric 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

# Specify the key identifier to use with the ntpq utility.
#controlkey 8
restrict 0.rhel.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.rhel.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.rhel.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery


0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 24766102
Well,

why 'server 192.168.2.200' in the server's config? That's its own address and doesn't make sense at all. Remove it, please!

Instead,  'server 192.168.2.200' is missing in the client's config, where it does make sense. Please add it with stratum 1.

'server 127.127.1.0' is missing at the server. Why?
Instead it is present in the client config! Maybe you should remove it from there, but since you have stratum 10, it will probably do no harm.

Or did you confuse server and client in your post above?


Also take note that the server's clock and the client's clock should not differ too much, else ntp will not synchronize.


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jusbug
ID: 24766626


sorry m8 i confused the file, it's the other way around.
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 500 total points
ID: 24767151
OK, that sounds better.
 
 The output of ntpq -p indicates that the server was well recognized as unicast peer, but the refid was .INIT.
Maybe the server's ntpd was really still starting up, or the synchronization distance was too big (Did you check the time difference?)
It can last several minutes until ntpd is operational. Did you wait long enough?
Did you recycle both ntp daemons (ntpd)?

Try 'ntpdc -c sysinfo' to query daemon info.

btw. you have two driftfile statements in each of the configs. Please correct!

Do you really use keys? If not, comment out the 'keys' directive.

And, I would no longer use ntpdate. It's deprecated.
Using ntpd on both sides is far better.


 
0
 

Author Comment

by:jusbug
ID: 24769124


YOU ARE THE MAN
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question