I am trying to setup local NTP server for some testing. I have installed NTP on Ubuntu 18.04 and commented server-pool block in the config file

Here is the full config :

driftfile /var/lib/ntp/ntp.drift

leapfile /usr/share/zoneinfo/leap-seconds.list

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

restrict ::1

restrict source notrap nomodify noquery

restrict mask notrust

fudge stratum 10

Used this command to set the time I want sudo timedatectl set-time "2013-06-02 23:26:00"

I also tried to see if service is ntp service is running by sudo systemctl status ntp.service which is running, but when grepped on port 123 I didn't find anything running. Found with ps

ubuntu@ntp:~$ ps auxww | grep '[n]tp'
ntp      13517  0.0  0.8 103212  4136 ?        Ssl  Jun02   0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 111:115

When client tries to get time from NTP running on this server, it timeouts. Also Dont see any messages in /var/log/syslog

More info :

ubuntu@ntp:~$ ps auxww | grep '[n]tp'
ntp        807  0.0  0.7 103212  3480 ?        Ssl  Jan28   0:02 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 111:115

ubuntu@ntp:~$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
*     .LOCL.          10 l    2   64  377    0.000    0.000   0.000

ubuntu@ntp:~$ ntpq -c rv
associd=0 status=0515 leap_none, sync_local, 1 event, clock_sync,
version="ntpd 4.2.8p10@1.3728-o (1)", processor="x86_64",
system="Linux/4.15.0-1019-aws", leap=00, stratum=11, precision=-24,
rootdelay=0.000, rootdisp=11.016, refid=LOCAL(0),
reftime=de1977a0.2605c5ad  Mon, Jan 29 2018  5:36:16.148,
clock=de1977a6.758ae7fc  Mon, Jan 29 2018  5:36:22.459, peer=57525, tc=6,
mintc=3, offset=0.000000, frequency=0.000, sys_jitter=0.000000,
clk_jitter=0.000, clk_wander=0.000, tai=37, leapsec=201701010000,

I tried this script to get time from real NTP server, where it worked, but not on the standalone NTP.

What I am missing here ?


One way to see the ports opened by services is:

netstat -an

Of course you can filter the output with grep command like this:

netstat -an|grep 123.

I sometimes use lsof too, like this:

lsof -i udp -nP in RedHat based distros.

See man lsof and man netstat for more info.

I hope this helps.

  • looks like service is running. – roy Jan 17 at 14:21
  • Nice. Do you have any firewall between server and clients? – Manuel Florian Jan 17 at 14:24
  • I checked the firewall status sudo ufw status verbose , which is Status: inactive Also full communication is allowed in AWS-SG from client ( to NTP server – roy Jan 17 at 14:48
  • In the NTP server identify the network interface ntp traffic should be going through and put a tcpdump to see if any traffic is actually reaching the server. e.g tcpdump -i eth0 port 123 -n -nn and from a client nc -u NTPSERVERIP 123. – Manuel Florian Jan 18 at 13:24
  • I commented restrict mask notrust and it worked – roy Jan 18 at 21:24

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.