Solved

standalone ntp server

Posted on 2009-07-02
6
1,001 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now