[mdlug] NTP server on Android for updating pi

Drew drew4096 at gmail.com
Sun Mar 22 22:04:16 EDT 2020


I'm upgrading the raspberry pi-s, and have a base system set up to
connect to either of two Android phones. As pi-s don't have real time
clocks, and the phone that I use for it may or may not be connected to
the internet, I've been trying to get a time server running on one  of
the phones (https://apkpure.com/time-server/com.icecoldapps.timeserver).

Of course, due to the douchebaggery of phone manufacturers, all ports
below a certain number - 1000? I forget which, but it includes port
123 which NTP uses. So the Android app mentioned above has provision
to use a port that (supposedly) is NOT blocked, and recommends port
forwarding via iptables.

By some trial and error, I've managed to get a couple of rules inserted:

pi at nx13:~ $ sudo iptables -t nat -S
-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P POSTROUTING ACCEPT
-P OUTPUT ACCEPT
-A PREROUTING -s 192.168.43.1/32 -p udp -j REDIRECT --to-ports 123
-A OUTPUT -d 192.168.43.1/32 -p udp -j REDIRECT --to-ports 39865

But when I attempt a time sync to the app, I get (after a few seconds
of silence)

pi at nx13:~ $ sudo ntpdate 192.168.43.1
22 Mar 21:02:32 ntpdate[4555]: no server suitable for synchronization found


pi at nx13:~ $ sudo ntpdate 192.168.43.1
22 Mar 21:03:39 ntpdate[4617]: no server suitable for synchronization found

What do I need to do to get this to work?


More information about the mdlug mailing list