LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-02-2016, 07:53 AM   #1
newhorizons009
LQ Newbie
 
Registered: Sep 2016
Posts: 18

Rep: Reputation: Disabled
Linux ntp server and client configuration


Hello All,

I would like my machine to be a NTP Time server for all downstream devices. The same machine, I would like to be a client to get the time from internet based time servers.

Is it possible for me to configure my box this way, where it assumes both roles of NTP Server and Client ?

Thanks,

Last edited by newhorizons009; 11-02-2016 at 08:18 AM.
 
Old 11-02-2016, 08:03 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,615
Blog Entries: 3

Rep: Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860
Yes, it's easy to do. Which NTP daemon have you chosen? The details of doing so vary a little between the two available.

Last edited by Turbocapitalist; 11-02-2016 at 08:05 AM.
 
Old 11-02-2016, 08:16 AM   #3
newhorizons009
LQ Newbie
 
Registered: Sep 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
I am currently using a version that comes with busybox. However, I can get any version, cross compile to my arm and use it.

usyBox v1.19.3 (2016-10-25 12:50:24 EDT) multi-call binary.

Usage: ntpd [-dnqNwl] [-S PROG] [-p PEER]...

NTP client/server

-d Verbose
-n Do not daemonize
-q Quit after clock is set
-N Run at high priority
-w Do not set time (only query peers), implies -n
-l Run as server on port 123
-S PROG Run PROG after stepping time, stratum change, and every 11 mins
-p PEER Obtain time from PEER (may be repeated)
 
Old 11-02-2016, 08:23 AM   #4
newhorizons009
LQ Newbie
 
Registered: Sep 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
I also have a more modern version of ntpd,
ntpd - NTP daemon program - Ver. 4.2.6p5
USAGE: ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
- prohibits these options:
ipv6
-6 no ipv6 Force IPv6 DNS name resolution
- prohibits these options:
ipv4
-a no authreq Require crypto authentication
- prohibits these options:
authnoreq
-A no authnoreq Do not require crypto authentication
- prohibits these options:
authreq
-b no bcastsync Allow us to sync to broadcast servers
-c Str configfile configuration file name
-d no debug-level Increase output debug message level
- may appear multiple times
-D Str set-debug-level Set the output debug message level
- may appear multiple times
-f Str driftfile frequency drift file name
-g no panicgate Allow the first adjustment to be Big
- may appear multiple times
-i --- jaildir built without --enable-clockctl or --enable-linuxcaps
-I Str interface Listen on an interface name or address
- may appear multiple times
-k Str keyfile path to symmetric keys
-l Str logfile path to the log file
-L no novirtualips Do not listen to virtual interfaces
-n no nofork Do not fork
-N no nice Run at high priority
-p Str pidfile path to the PID file
-P Num priority Process priority
-q no quit Set the time and quit
-r Str propagationdelay Broadcast/propagation delay
Str saveconfigquit Save parsed configuration and quit
-s Str statsdir Statistics file location
-t Str trustedkey Trusted key number
- may appear multiple times
-u --- user built without --enable-clockctl or --enable-linuxcaps
-U Num updateinterval interval in seconds between scans for new or dropped in
terfaces
Str var make ARG an ntp variable (RW)
- may appear multiple times
Str dvar make ARG an ntp variable (RW|DEF)
- may appear multiple times
-x no slew Slew up to 600 seconds
opt version Output version information and exit
-? no help Display extended usage information and exit
-! no more-help Extended usage information passed thru pager

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.

The following option preset mechanisms are supported:
- examining environment variables named NTPD_*



please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
[root@IM /root]#
 
Old 11-02-2016, 08:26 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,615
Blog Entries: 3

Rep: Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860
BusyBox could have any version included. The help info from the version you have show that it's not one of the common two.

But it does show that you can launch "ntpd" with the -l option to have it serve up time on port 123. So you may have to recompile BusyBox so that it happens automatically. Be sure that port 123 incoming is open on the BusyBox device's firewall. That ought to be compiled in, too. However, try the -l option and the firewall modification manually first and then when you know what to change do the recompilation.
 
Old 11-02-2016, 08:30 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,615
Blog Entries: 3

Rep: Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860
Quote:
Originally Posted by newhorizons009 View Post
I also have a more modern version of ntpd,
ntpd - NTP daemon program - Ver. 4.2.6p5
That version most likely has more options, but if the first one works it may not be necessary. Just a guess but I suspect the first one is smaller and lighter. If you go with 4.2.6p5 then the file /etc/ntp.conf needs some changes to be a server. The restrict directive would be where to look in the manual page and in the guides.
 
Old 11-02-2016, 09:11 AM   #7
newhorizons009
LQ Newbie
 
Registered: Sep 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
BusyBox could have any version included. The help info from the version you have show that it's not one of the common two.

But it does show that you can launch "ntpd" with the -l option to have it serve up time on port 123. So you may have to recompile BusyBox so that it happens automatically. Be sure that port 123 incoming is open on the BusyBox device's firewall. That ought to be compiled in, too. However, try the -l option and the firewall modification manually first and then when you know what to change do the recompilation.
Right now, I am running it with -l switch, and its serving up time just fine. Now I have a need, to make it receive time as well. So if add up what you are saying, is
1. Change the sources to not require the -l switch, so that by default it comes up as server on port 123.
2. Change firewall to allow incoming traffic on port 123.

Now the question is, will this be sufficient, to where, it will also serve as client, meaning periodically, fetch time from the servers listed in ntp.conf ?
 
Old 11-02-2016, 09:20 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,615
Blog Entries: 3

Rep: Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860
1. Using the -p to point to other time servers will get it to run as a client, it looks like. Can you just have BusyBox launch "ntpd" with the -l option to serve up time plus three or four -p options specifying which time servers (aka peers) to get time from as a client? How is 'ntpd" set up to launch currently?

2. Yes, this would be your filter to decide which addresses or networks are allowed to query your device for time updates.
 
Old 11-02-2016, 01:01 PM   #9
newhorizons009
LQ Newbie
 
Registered: Sep 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
1. Using the -p to point to other time servers will get it to run as a client, it looks like. Can you just have BusyBox launch "ntpd" with the -l option to serve up time plus three or four -p options specifying which time servers (aka peers) to get time from as a client? How is 'ntpd" set up to launch currently?

2. Yes, this would be your filter to decide which addresses or networks are allowed to query your device for time updates.
I have a startup script, that launches "ntpd -l".
 
Old 11-02-2016, 01:42 PM   #10
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,615
Blog Entries: 3

Rep: Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860
Quote:
Originally Posted by newhorizons009 View Post
I have a startup script, that launches "ntpd -l".
Ok. Then it's just a matter of adding "-p someserver.com" a few times in there. You'll need to pick out some NTP servers to point it at, if you haven't already. If this is some kind of product or otherwise will be widely distributed, you'll want to pick carefully perhaps with the agreement of the server owners.
 
  


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 with ntp server time sagar666 Linux - Server 3 12-19-2014 04:47 AM
[HELP] Linux NTP Client Server Configuration firewallengineer Linux - Newbie 8 09-05-2013 12:29 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:54 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
Open Source Consulting | Domain Registration