For my home LAN, I'm running a ntpd server which uses the NTP pool service (thanks for it by the way!!), and I'm using this local NTP server for my other devices on the LAN.
I want to improve the containment of my ntpd server. Instead of chrooting it, I decided to use Docker. Everything works fine but I cannot monitor the server anymore (timeout). I suspect NAT/masquerading to be the problem.
So is my monitoring time-outing just because the client is on a different subnet than the server (due to NAT)? If yes, how can I solve that?
**Some background/context**:
For monitoring I used collectd (
https://collectd.org/) and the ntpd plugin. Basically it calls something equivalent to 'ntpdc -c kerninfo <host>' and a few other queries. When ntpd was running on the host directly, this used to work fine. However when running inside the container the same ntpd version using the same ntpd configuration (with just updated IPs for restrict statements) fails due to timeout. Strangely everything else works as expected (ntpdate or ntpq from the LAN works when using the containerised ntpd server), but not when using the above ntpdc command.
I've tested it inside the container with some reasonable restrict statements and also without any. But in both cases I timeout. Running tcpdump in the container shows that the UDP packet arrives, but nothing is answered. Of course, using tcpdump I see both request and response when using ntpq which is working.
If I run the ntpd server on the host directly, using the same ntp.conf file, the 'ntpdc -c kerninfo <host>' succeed from the host and other computers on the LAN I authorised!
So the only difference is the Docker networking (NAT/masquerading as far as I understood). I've set it up that the UDP port 123 is forwarded. But the
ntp.org documentation does not mention anything really about NAT/masquerading in combination with querying.
Note: my container image is based on ubuntu:16.04 which runs ntpd 4.2...@1.3265-o (from the Ubuntu official repositories). The host runs Ubuntu 16.04 as well. Amd I also did run the ntpd inside the container with the -ddd option to get a more verbose output. The only relevant data that were logged are:
read_network_packet: fd=19 length 192 from 192.168.1.3
receive: at 26 172.17.0.2<-192.168.1.3 flags 19 restrict 000
(the address 172.17.0.2 is the one inside the container where the ntpd server is running; the address 192.168.1.3 is on my LAN)