standalone ntp server

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.
jusbugAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

woolmilkporcCommented:
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
jusbugAuthor Commented:

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
woolmilkporcCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

jusbugAuthor Commented:


sorry m8 i confused the file, it's the other way around.
0
woolmilkporcCommented:
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
jusbugAuthor Commented:


YOU ARE THE MAN
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.