Second/backup NTP server option

Tell us your most wanted features from QNAP products.
Post Reply
Vasekdvor
New here
Posts: 2
Joined: Tue Mar 28, 2017 7:48 am

Second/backup NTP server option

Post by Vasekdvor »

Hi, i would like to see new option to set second/backup NTP server to synchronize time with (for the situation when first NTP server is not responding or it's down).

Here is the screenshot, how it should look:
NTP server QNAP.PNG
You do not have the required permissions to view the files attached to this post.
Owner of QNAP TS-673A-8G & QNAP TS-251
User avatar
OneCD
Guru
Posts: 12137
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Second/backup NTP server option

Post by OneCD »

Why do you need a backup?

The NTP pool is a collection of servers - not a single server. If the first server is unavailable, the next one handles your request. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
P3R
Guru
Posts: 13190
Joined: Sat Dec 29, 2007 1:39 am
Location: Stockholm, Sweden (UTC+01:00)

Re: Second/backup NTP server option

Post by P3R »

OneCD wrote:The NTP pool is a collection of servers - not a single server. If the first server is unavailable, the next one handles your request. ;)
But not until the DNS entry times out, does it?

Also many run their own ntp servers, I have two. It isn't important to me but I would definitely have use for the feature requsted here.
RAID have never ever been a replacement for backups. Without backups on a different system (preferably placed at another site), you will eventually lose data!

A non-RAID configuration (including RAID 0, which isn't really RAID) with a backup on a separate media protects your data far better than any RAID-volume without backup.

All data storage consists of both the primary storage and the backups. It's your money and your data, spend the storage budget wisely or pay with your data!
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Second/backup NTP server option

Post by schumaku »

New time concept currently in the works will allow to configure up to four NTP IP unicast address or a DNS resolvable names for NTP servers on a higher stratum, and probably also one or multiple peers which must only be that of a system known to be a member of the same stratum. Peers should have at least one time source that is different to each other, ie. one NAS run of a local time source, and one from a public or government NTP source.

I'd expect about the same capabilities as we have it on Windows 2016 systems - where the NAS is (or are) becoming core in the customers time/NTP concept.
fabriziorizzo
Starting out
Posts: 34
Joined: Tue Sep 20, 2016 6:40 am

Re: Second/backup NTP server option

Post by fabriziorizzo »

OneCD wrote:Why do you need a backup?

The NTP pool is a collection of servers - not a single server. If the first server is unavailable, the next one handles your request. ;)
Here's what I remember from reading the NTP whitepapers from Sun Microsystems back in the day (before they got absorbed into Oracle and can no longer find the whitepapers)...

The ntpd daemon does a MUCH better job computing drift and making adjustments, etc... with at least 3 separate servers providing data simultaneously. Configuring a single server entry against a pool only provides the connection redundancy for that single server source - NO protection if the one time server you end up on happens to goes nuts. It does not provide your ntpd with more than one source of data.

Suggest always configuring at least 3 (or more) servers for any ntp.conf. Run ntpdate against the base pool (e.g. north-america.pool.ntp.org), and set four server entries for 0. 1. 2. 3.north-america.pool.ntp.org to get the advantage of better protection against an unstable time server (it happens...) as well as better clock stability and statistical modeling.

I turn OFF the NTP client in the Control Panel - General Settings - Time options, setting it to manual (and being careful about hitting apply again)
Then ENABLE the NTP server under Control Panel -> Applications - NTP Server, leaving all three checkboxes for broadcast/etc... unchecked.

Hop into an SSH shell as the admin user and modify /etc/init.d/ntpf.sh (and ntpd.sh) to code things accordingly and remove the idiotically complex QNAP code that has never worked ...)
(if you want to PEER with other servers on your local net, add any additional peer your-other-local-server-address lines too.

Note, Before this level of hacking, I did try to leverage QNAP's current code by uncommenting the serverip query lines (e.g. srvip1=`/sbin/getcfg NTP "Server1 IP" -d ""`) that QNAP left commented. IT DIDN'T WORK.
Note: I also had to go SET the NTP "Server1 IP", "Server2 IP", etc... manually. WOULD BE NICE FOR QNAP TO GIVE US THE UI FOR THIS PER THE OP!!!

Code: Select all

[/etc/init.d] # /sbin/setcfg NTP "Server1 IP" "0.north-america.pool.ntp.org"
[/etc/init.d] # /sbin/setcfg NTP "Server2 IP" "1.north-america.pool.ntp.org"
[/etc/init.d] # /sbin/setcfg NTP "Server3 IP" "2.north-america.pool.ntp.org"
[/etc/init.d] # /sbin/setcfg NTP "Server4 IP" "3.north-america.pool.ntp.org"
So instead of current code, here's the hacked section from /etc/init.d/ntpf.sh.
After hacking it up, simply run

Code: Select all

[/etc/init.d] # ./ntpf.sh stop
[/etc/init.d] # ./ntpf.sh start
Example Code FRAGMENT (not complete file):

Code: Select all

case "$1" in
  start)
	mypid=`/bin/pidof ntpd`
	if [ ! -z $mypid ]; then
		echo "NTP server has been started."
		exit 1
	else
		#check if it is necessary to startup NTP server : ntpd
		if [ `/sbin/getcfg NTP ntpd_enable -u -d FALSE` = TRUE ]; then
				
			if [ -f /etc/config/ntp.conf ]; then
				echo "Remove the old ntp.conf"
				rm -f /etc/config/ntp.conf
			fi
			echo "Create the new ntp.conf"
			echo > /etc/config/ntp.conf
			


                        ###  HACK TO REPLACE ALL THE BRAINDEAD CRAP...
                        echo "Syncronize one-off time to eliminate any huge skew via ntpdate from north-america.pool.ntp.org"
                        /usr/sbin/ntpdate north-america.pool.ntp.org 2>/dev/null
        
                        echo "Adding north-america.pool.ntp.org servers to /etc/config/ntp.conf"
                        echo "server 0.north-america.pool.ntp.org" >> /etc/config/ntp.conf
                        echo "server 1.north-america.pool.ntp.org" >> /etc/config/ntp.conf
                        echo "server 2.north-america.pool.ntp.org" >> /etc/config/ntp.conf
                        echo "server 3.north-america.pool.ntp.org" >> /etc/config/ntp.conf

			### #if [ `/sbin/getcfg NTP "Use NTP Server" -u -d FALSE` = TRUE ]; then
			### #	NTPSVR=`/sbin/getcfg NTP "NTP Server IP"`
			### #	NTPSVR_IPS=`/usr/bin/nslookup $NTPSVR | /bin/sed 's/[^0-9. ]//g'| /usr/bin/tail -n 1| /bin/awk -F " " '{print $1" "$2" "$3}'`
			### #	NTPSVR1=`echo $NTPSVR_IPS | /bin/cut -d " " -f 1`
			### #	NTPSVR2=`echo $NTPSVR_IPS | /bin/cut -d " " -f 2`
			### #	NTPSVR3=`echo $NTPSVR_IPS | /bin/cut -d " " -f 3`
	                ### #fi
                        ### 
			### #srvip1=`/sbin/getcfg NTP "Server1 IP" -d ""`
			### [ ! -z $NTPSVR1 ] && srvip1=$NTPSVR1
			### if [ "$srvip1" != "" ]; then
			### 	/usr/sbin/ntpdate -q $srvip1 2>/dev/null 1>/dev/null
			### 	srvip1ok=$?
			### 	if [ "$srvip1ok" == "0" ]; then 
			### 		echo "server $srvip1" >> /etc/config/ntp.conf
			### 	fi
			### fi
                        ### 
			### #srvip2=`/sbin/getcfg NTP "Server2 IP" -d ""`
			### [ ! -z $NTPSVR2 ] && srvip2=$NTPSVR2
			### if [ "$srvip2" != "" ]; then
			### 	/usr/sbin/ntpdate -q $srvip2 2>/dev/null 1>/dev/null
			### 	srvip2ok=$?
			### 	if [ "$srvip2ok" == "0" ]; then
			### 		echo "server $srvip2" >> /etc/config/ntp.conf
			### 	fi
			### fi
                        ### 
			### #srvip3=`/sbin/getcfg NTP "Server3 IP" -d ""`
			### [ ! -z $NTPSVR3 ] && srvip3=$NTPSVR3
			### if [ "$srvip3" != "" ]; then
			### 	/usr/sbin/ntpdate -q $srvip3 2>/dev/null 1>/dev/null
			### 	srvip3ok=$?
			### 	if [ "$srvip3ok" == "0" ]; then
			### 		echo "server $srvip3" >> /etc/config/ntp.conf
			### 	fi
			### fi
			### if [ "$srvip1" == "" -a "$srvip2" == "" -a "$srvip3" == "" ] || 
			###    [ "$srvip1ok" != "0" -a "$srvip2ok" != "0" -a "$srvip3ok" != "0" ]; then
			### 	echo > /etc/config/ntp.conf
			### 	echo "server 127.127.1.0" >> /etc/config/ntp.conf
			### 	echo "fudge 127.127.1.0 stratum 8" >> /etc/config/ntp.conf
			### fi

                        ### END HACK

			echo "driftfile /etc/ntp.drift" >> /etc/config/ntp.conf
			#
			# windows AD member cannot auto sync time with NAS DC
			# because ntpd no signd support.
			#
			ROLE_CHECK=`/sbin/getcfg global "server role" -d "x" -f /etc/config/smb.conf`
			
-
Fabrizio
TVS-1282T (Intel I7-6700 @ 3.4GHz, 32GB RAM, 8x 16TB Seagate Exos ST16000NM001G RAID-6, 4x 960GB Corsair Force LE SSD RAID-10, 2x Samsung 512GB M.2 Flash RAID1 cache, 40gbps bonded eth0+1+2+3)
User avatar
OneCD
Guru
Posts: 12137
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Second/backup NTP server option

Post by OneCD »

fabriziorizzo wrote:Configuring a single server entry against a pool only provides the connection redundancy for that single server source - NO protection if the one time server you end up on happens to goes nuts. It does not provide your ntpd with more than one source of data.
Cool, I've learned something new. :geek:

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
fabriziorizzo
Starting out
Posts: 34
Joined: Tue Sep 20, 2016 6:40 am

Re: Second/backup NTP server option

Post by fabriziorizzo »

OneCD wrote:
fabriziorizzo wrote:Configuring a single server entry against a pool only provides the connection redundancy for that single server source - NO protection if the one time server you end up on happens to goes nuts. It does not provide your ntpd with more than one source of data.
Cool, I've learned something new. :geek:
Sweet. Happy to help. Can definitely relate. Every time I think I know something about how to deal with the QNAP NAS, I'm forced to learn a few new things just to deal with their half-arsed software design (or total lack thereof).

Cheers!
-
Fabrizio
TVS-1282T (Intel I7-6700 @ 3.4GHz, 32GB RAM, 8x 16TB Seagate Exos ST16000NM001G RAID-6, 4x 960GB Corsair Force LE SSD RAID-10, 2x Samsung 512GB M.2 Flash RAID1 cache, 40gbps bonded eth0+1+2+3)
Post Reply

Return to “Features Wanted”