LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
 
Search this Thread
Old 11-18-2013, 10:14 AM   #1
Oromis_32
LQ Newbie
 
Registered: Nov 2013
Posts: 9

Rep: Reputation: Disabled
NTP server on Embedded Linux


Hi guys,

I'm currently setting up a distributed system consisting of 5 single-board computers (4 BeagleBone Black and 1 Karo TX6Q), which are all ARM-based computers running Linux. (If you are interested, the system will be used as the on-board computer system in a racing car).

The boards are supposed to exchange sensor data. To be able to perform calculations on consistent data, all system clocks need to be synchronized very accurately. We want to use NTP for this job since it promises sub-millisecond precision in good network conditions.

So I downloaded the sources from http://www.ntp.org/ and compiled them using a cross-compiler for the Karo board (which is the central computer). Then I copied the generated files to the board and created a ntp.conf which looks like this:

Code:
driftfile /var/lib/ntp/ntp.drift
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 localhost

restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1

enable monitor
I started the ntp daemon using
Code:
ntpd -l
which gave me no error and ps shows a new running ntpd process.

Unfortunately, when I wanted to test the server using
Code:
ntpq -p
it responded with
Code:
localhost: timed out, nothing received
***Request timed out
which apparently means that the server is not working.

I haven't found anything helpful in Google, so now I hope one of you has an idea. If you need additional information, feel free to ask.

Thanks in advance

David
 
Old 11-18-2013, 11:08 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,600

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
If you want to setup ntp using the local clock as a time source then you need the following in your ntp.conf file
Quote:
server 127.127.1.0
fudge 127.127.1.0 stratum 1
You did not state if the central computer is going to be connected to the internet but I would guess that time synch is more important then an absolute time. Setting the central computer to stratum 1 will trick the others to thinking it is a good time source.

If the internet is not available and you need an absolute time reference then a GPS receiver is required. They are fairly cheap and easy to configure using gpsd.

Sounds like an interesting project.
 
Old 11-18-2013, 12:57 PM   #3
Oromis_32
LQ Newbie
 
Registered: Nov 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks for your reply!

I changed my /etc/ntp.conf file to

Code:
driftfile /var/lib/ntp/ntp.drift
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 127.127.1.0
fudge 127.127.1.0 stratum 1

restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1

enable monitor
Unfortunately, no difference.

Quote:
You did not state if the central computer is going to be connected to the internet but I would guess that time synch is more important then an absolute time
You are right, synch is most important. It would be nice to have an absolute time, but that has lower priority. The car will not be connected to the internet directly.

Quote:
Sounds like an interesting project.
Glad to hear that. If you want more information about what we are doing, here is our website (In German, but you can find some pretty international pictures: http://www.elefantracing.de/, http://www.elefantracing.de/medien/bilder)
 
Old 11-18-2013, 01:54 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,600

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
I assume you restarted ntp...

It isn't obvious why ntp isn't working.
 
Old 11-18-2013, 04:12 PM   #5
Oromis_32
LQ Newbie
 
Registered: Nov 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Yes, I restarted ntp ... Any further ideas?
 
Old 11-19-2013, 10:51 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,600

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
Starting ntpd with the -d switch might provide some addition debug messages.
 
Old 11-19-2013, 11:37 AM   #7
Oromis_32
LQ Newbie
 
Registered: Nov 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Nope, no luck with that either. Actually doesn't print anything. Is it possible that I screwed up compilation?
 
Old 11-19-2013, 01:45 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Whatever fits the task best
Posts: 16,151
Blog Entries: 2

Rep: Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389
I may be wrong on this (I don't know much about NTP), but shouldn't the IP address in that config be 127.0.0.1 instead of 127.127.1.0?
 
Old 11-19-2013, 01:59 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,600

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
Nope.

http://doc.ntp.org/4.2.0/drivers/driver1.html

I forgot to mention that if the system time is off by more then 1000s ntp will quit. Be sure to set time with the date command if required prior to starting ntpd. Does the Karo board have a backed real time clock?

Also ntpd with the -g option will force time to be set difference is > 1000s.

Last edited by michaelk; 11-19-2013 at 02:55 PM.
 
Old 11-19-2013, 03:04 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Whatever fits the task best
Posts: 16,151
Blog Entries: 2

Rep: Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389Reputation: 4389
Quote:
Originally Posted by michaelk View Post
I stand corrected, thanks for that link.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP client is not syncing to ntp server LittleMaster Linux - Newbie 6 04-05-2013 02:37 PM
[SOLVED] NTP configuration in client to synchronize with NTP server. antnish Linux - General 12 04-01-2013 01:49 PM
ntp server keeps on changing time-local ntp server Gil@LQ Linux - Newbie 3 01-23-2013 09:33 AM


All times are GMT -5. The time now is 03:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration