Solved

standalone ntp server

Posted on 2009-07-02
6
1,007 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
  • 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

805 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