Solved

standalone ntp server

Posted on 2009-07-02
6
1,014 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
Industry Leaders: 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

739 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