Lab: Hosting NTP Server

Asked by Ricky Hair

I'm setting up a lab using virtual machines, and have 2 ubuntu 9.10 running.

On 1 machine, I wish to provide NTP service to serve the other machine.
I've installed ntp, then adjusted the /etc/ntp.conf to allow my client machine to connect to it.

After starting the service, I ran

sudo ntpdate 10.10.10.2 -> no server suitable for synchronization found.

The /etc/ntp.conf file is as follows:
-----------------------------------------------------------------------------------------------------------------------
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 3.sg.pool.ntp.org

restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

restrict 10.10.10.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
restrict ::1

broadcast 10.10.10.255
------------------------------------------------------------------------------------------------------------

Any help is very very much appreciated. Thank you.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu ntp Edit question
Assignee:
No assignee Edit question
Solved by:
Ricky Hair
Solved:
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

Start by doing a
   ping 10.10.10.2
to check if computer is reachable.

Which virtualisation software do you use ?

Revision history for this message
Ricky Hair (rhair78) said :
#2

Hi delance,

Thanks, I'm running VM Workstation, and have the 2 instances of Ubuntu 9.10.
All traffic between the 2 instances are ok, running on the same vmnet.

Revision history for this message
delance (olivier-delance) said :
#3

It looks more as ntp configuration issue than network issue.

(http://www.malekal.com/ntp.html for myself)

Do you want to have:
     external ntp server -> local ntp server -> local client
or
     local ntp server -> local client

Can you post configuration files in this thread if they are not too big (else send to <email address hidden>) and give me the identity and version of ntp server you use) ? I will see what I can do.

Revision history for this message
Ricky Hair (rhair78) said :
#4

Hi delance,

Actually, I just need to provide a local ntp server -> local client.

Because it is just a lab and to show that the NTP server is setup and functional.

The config is as posted in the original question.

driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 3.sg.pool.ntp.org

restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

restrict 10.10.10.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
restrict ::1

broadcast 10.10.10.255

Revision history for this message
delance (olivier-delance) said :
#5

Check in /etc/services you have lines
     ntp 123/tcp
     ntp 123/udp # Network Time Protocol
Check process ntpd is running.

Add in file /etc/ntp.conf:
     server 127.127.1.0
Reboot, and in a terminal, run
     ntpq -p
to check server.

I get:
root@lucid:~# ntpq -p
     remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 5 l 20 64 17 0.000 0.000 0.001
root@lucid:~# ntptrace
localhost: stratum 6, offset 0.000000, synch distance 0.198386

(Note for me: http://www.funix.org/fr/linux/ntp.htm)

PS: what is your level in software ?

Revision history for this message
Ricky Hair (rhair78) said :
#6

Hi delance,

I am a complete newbie in linux.

user@gandhi:/$ ntpq -p
     remote refid st t when poll reach delay offset jitter
==============================================================================
10.10.10.255 .BCST. 16 - - 64 0 0.000 0.000 0.031

user@gandhi:/$ ntptrace
ganghi: stratum 16, offset 0.000000, synch distance 0.044145

The 2 lines are in the service as stated.

I will try to clear the whole config file, and insert only a plain vanilla config as per your config reference.

Revision history for this message
Ricky Hair (rhair78) said :
#7

Hi all,

As a last resort, I removed all configuration and am using the local clock as a reliable time source.

server 127.127.1.0

driftfile /var/lib/ntp/ntp.drift

restrict 127.0.0.1 mask 255.255.255.255

restrict 10.10.10.0 mask 255.255.255.0

user@gandhi:~$ sudo ntpq -p

remote refid st t when poll reach delay offset jitter
LOCAL(0) .LOCL. 5 l 10 64 7 0.000 0.000 0.000 0.002

However, doing a ntpdate 10.10.10.2 from the client still yields "no server suitable for synchronization found"

Revision history for this message
Ricky Hair (rhair78) said :
#8

After managing to clear out all the DHCP cache, and also connecting via NAT to the internet, the server appears to work.
The client is now able to grab a reliable time from the NTP server.
While the NTP server is getting Stratum 2 time from an asian ntp pool.

Many thanks to all friends who have helped to guide me.