Valiceemo
Posts: 33
Joined: Wed Apr 19, 2017 1:47 pm

Use a Pi as an NTP server

Wed Jul 19, 2017 10:02 am

I have searched a lot for this and am still unsure on a few things...

Quick bit of background as to why I'm looking at this...

I have added a TP-Link wifi extender (model TP Link TL-WA850RE) into my home network to help with a bit of a black spot.
I have a Pi2 with Pihole running 24/7 and very quickly noticed the extender was querying multiple time servers every second, so I was getting 100,000+ DNS queries every day.
This raised questions as to why? and bandwidth being wasted for example.
Long story short, it seems to be a bug or a badly constructed firmware, and flashing a 3rd party firmware is a risk, as there seems to be no officially supported one for my model / version from anyone.

Someone suggested using the Pi as a NTP server, so all requests to the timer servers from the extender were handled internally, by the Pi...does that make sense?

So, I understand why it may be beneficial, but I can not seem to find much else on this...

Any thoughts, ideas or experiences would be great.

Thanks!

Can I set this up to run along side PiHole with no detriment to anything else within my network (smart TVs, phones, tablets, xbox, other Pis)

As far as I can see, the TP-Link extender is the only device that is making these 'calls' on such a high frequency....is there any means to be sure, or would Pihole tell me?

I know that using the Pi as an NTP server is not a solution, it is a workaround of sorts.

Ultimately is it really worth it?

beta-tester
Posts: 1236
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Use a Pi as an NTP server

Wed Jul 19, 2017 4:19 pm

1. you can adjust the interval of "syncing" the time in the /etc/ntp.conf file.
(unfortunately under linux, with the default ntp conifuration a time sync will happen every few seconds ~64s)
try to change the minpoll xxxx value to a high value (2^^xxxx)=seconds (6 = 64s) see Server Command Options

Code: Select all

# /etc/ntp.conf
server  0.debian.pool.ntp.org  minpoll xxxx  maxpoll yyyy
server  1.debian.pool.ntp.org  minpoll xxxx  maxpoll yyyy
server  2.debian.pool.ntp.org  minpoll xxxx  maxpoll yyyy
server  3.debian.pool.ntp.org  minpoll xxxx  maxpoll yyyy
2. you can let act one RPi as local NTP server. but the local dhcp has to tell the other network devices that there is the RPi as ntp server. and even then, many devices are using its "hardcoded" timeservers - so they will ignore the existence of your local ntp server until you modify thier configuration - smart tv and other devices mostely don't have the ability to change the timeserver url.
maybe you can also add firewall rules to redirect requests for an external ntp server to your local ntp server.
Last edited by beta-tester on Wed Jul 19, 2017 4:47 pm, edited 2 times in total.
{ I only give negative feedback }
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B, RPi3B, RPi3B+, RPiZeroW, ...

W. H. Heydt
Posts: 10749
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Use a Pi as an NTP server

Wed Jul 19, 2017 4:29 pm

You can do that, but your local NTP server is still going to "want" to check with network NTP servers to keep in sync. Since you're only concerned with a single Pi, why not add an RTC to that Pi and once you have the RTC set, disable the automatic NTP checks? Just tell it to resync to the RTC periodically.

Now, as it happens, I have set up an Pi-based NTP server. This is because, for a long weekend once a year, I run up to 8 Pis on a LAN that is isolated from the internet. My NTP server is a Pi0 (mostly because...I can). I'm running a longish term clock accuracy test (not really needed as I have long since established that the RTC is accurate enough to cover the length of time the Pis will be off the 'net with utter ease). However, here is the current state of the timekeeping:

Code: Select all

pi@pi0ntp:~ $ uptime; date; sudo hwclock -r
 09:24:35 up 73 days, 11:47,  3 users,  load average: 0.08, 0.06, 0.01
Wed Jul 19 09:24:35 PDT 2017
Wed 19 Jul 2017 09:24:37 AM PDT  -0.529983 seconds
pi@pi0ntp:~ $
Rough calculation indicates that it is running within 12 to15 secs. per year of the correct time. This is more than just acceptable to me.

To see how to set this up, use your favorite search engine to look up "Debian NTP server" and you should find out how to do it.

Valiceemo
Posts: 33
Joined: Wed Apr 19, 2017 1:47 pm

Re: Use a Pi as an NTP server

Wed Jul 19, 2017 4:54 pm

Thanks for taking the time to reply. But I must admit I'm still a little confused...

Are we saying there is little point in spending the time doing this?

I can see that `/etc/ntp.conf` exists.

If I'm.not really going to see any gains / advantages I'm not wanting to do it, as I think it's beyond my capabilities. At least for now, I'm pretty new to Linux / RPi.

If I should do it, as in, there are justifiable benefits, will.ot run alongside pihole, which is acting as a dhcp server for my network.

beta-tester
Posts: 1236
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Use a Pi as an NTP server

Wed Jul 19, 2017 5:51 pm

íf you don't have a router with a free firmware, you normally don't have the ability to do fancy stuff like redirecting ntp requests to a local ntp server.

to enlarge the sync poll intervals, you have to modify it on each device you have access to it. to a RPi it is easy, but not to a smart TV.

if there is no possibility to change the time server to use from the user interface of the other devices (smart TV , Xbox, mobile phone, tablet), you can not change it to use your local time server.

so i guess, then you have to live with that traffic, those devices are doing.
blocking those traffice completely may have consequences to digital right management (e.g. XBox), when the system time is too far off/not accurate anymore.
{ I only give negative feedback }
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B, RPi3B, RPi3B+, RPiZeroW, ...

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: Use a Pi as an NTP server

Wed Jul 19, 2017 6:21 pm

I think the most direct solution is contact TP-LINK for support.

I see they are offering firmware update: http://www.tp-link.com/us/download/TL-WA850RE.html

Valiceemo
Posts: 33
Joined: Wed Apr 19, 2017 1:47 pm

Re: Use a Pi as an NTP server

Thu Jul 20, 2017 8:33 am

beta-tester wrote:íf you don't have a router with a free firmware, you normally don't have the ability to do fancy stuff like redirecting ntp requests to a local ntp server.

to enlarge the sync poll intervals, you have to modify it on each device you have access to it. to a RPi it is easy, but not to a smart TV.

if there is no possibility to change the time server to use from the user interface of the other devices (smart TV , Xbox, mobile phone, tablet), you can not change it to use your local time server.

so i guess, then you have to live with that traffic, those devices are doing.
blocking those traffice completely may have consequences to digital right management (e.g. XBox), when the system time is too far off/not accurate anymore.
my router is ISP provided, and is pretty much totally locked down. I cant even set the DNS servers manually!

I think maybe that there isn't really much to be gained from using the Pi as an NTP server. It will more than likely create more problems for me I imagine.

Valiceemo
Posts: 33
Joined: Wed Apr 19, 2017 1:47 pm

Re: Use a Pi as an NTP server

Thu Jul 20, 2017 8:34 am

allfox wrote:I think the most direct solution is contact TP-LINK for support.

I see they are offering firmware update: http://www.tp-link.com/us/download/TL-WA850RE.html
yep, im going to try this.

The link above is for the US, I am in the UK.

The firmware I have on my TP-Link device is the most upto date for my model and version.

Its a shame...and to be honest, I actually am now beginning to consider returning it!

Return to “General discussion”