Reputation: 1848
My OS is Ubuntu 18.04.02 - There is no NTP, I had to install it using apt-get. I have an application which I must use NTP for compatibility. I disabled and removed timesyncd to avoid conflicts.
I configured ntp.conf to use:
0.north-america.pool.ntp.org
1.north-america.pool.ntp.org
2.north-america.pool.ntp.org
I can ping them without issues. The internet connection is fine. NTP service is running but is in the soliciting state forever and it is not synchronizing the time.
This is just a client IoT device. I just need to synchronize the time to execute our tasks in sync with the other computers on the same network.
What am I missing ? Do I have to enable firewall or ports? I am blocking IPV6, I added -4 to NTPD_OPTS.
$ sudo service ntp status
● ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enab
Active: active (running) since Mon 2020-03-02 13:07:14 EST; 17h ago
Docs: man:ntpd(8)
Process: 2078 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=
Main PID: 2090 (ntpd)
Tasks: 2 (limit: 1600)
CGroup: /system.slice/ntp.service
└─2090 /usr/sbin/ntpd -p /var/run/ntpd.pid -4 -g -u 106:113
Mar 03 06:36:13 FD50-AE ntpd[2090]: Soliciting pool server 209.115.181.1
Mar 03 06:36:34 FD50-AE ntpd[2090]: Soliciting pool server 45.33.2.219
Mar 03 06:36:38 FD50-AE ntpd[2090]: Soliciting pool server 64.79.100.197
Mar 03 06:36:55 FD50-AE ntpd[2090]: Soliciting pool server 91.189.91.157
Mar 03 06:37:20 FD50-AE ntpd[2090]: Soliciting pool server 149.56.47.60
Mar 03 06:37:20 FD50-AE ntpd[2090]: bind(19) AF_INET 127.0.0.1#123 flags
Mar 03 06:37:20 FD50-AE ntpd[2090]: unable to create socket on lo (212)
Mar 03 06:37:20 FD50-AE ntpd[2090]: failed to init interface for address
Mar 03 06:37:38 FD50-AE ntpd[2090]: Soliciting pool server 45.63.54.13
Mar 03 06:37:43 FD50-AE ntpd[2090]: Soliciting pool server 173.255.140.3
[1]+ Stopped sudo service ntp status
$ ntpstat
unsynchronised
polling server every 8 s
$ timedatectl
Local time: Tue 2020-03-03 06:58:34 EST
Universal time: Tue 2020-03-03 11:58:34 UTC
RTC time: Tue 2020-03-03 11:58:34
Time zone: America/New_York (EST, -0500)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
$ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
0.north-america .POOL. 16 p - 64 0 0.000 0.000 0.000
1.north-america .POOL. 16 p - 64 0 0.000 0.000 0.000
2.north-america .POOL. 16 p - 64 0 0.000 0.000 0.000
ntp.ubuntu.com .POOL. 16 p - 64 0 0.000 0.000 0.000
$
$ sudo systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-timesyncd.service(8)
my ntp.conf below:
#interface listen IPv4
#interface ignore IPv6
interface ignore wildcard
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
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
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
#pool 0.ubuntu.pool.ntp.org iburst
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
pool 0.north-america.pool.ntp.org iburst
pool 1.north-america.pool.ntp.org iburst
pool 2.north-america.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.
pool ntp.ubuntu.com
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
#Changes recquired to use pps synchonisation as explained in documentation:
#http://www.ntp.org/ntpfaq/NTP-s-config-adv.htm#AEN3918
#server 127.127.8.1 mode 135 prefer # Meinberg GPS167 with PPS
#fudge 127.127.8.1 time1 0.0042 # relative to PPS for my hardware
#server 127.127.22.1 # ATOM(PPS)
#fudge 127.127.22.1 flag3 1 # enable PPS API
Upvotes: 0
Views: 3391
Reputation: 1
#timedatectl NTP synchronized: no
try server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org
if you are in US or server 0.uk.pool.ntp.org
server 1.uk.pool.ntp.org
server 2.uk.pool.ntp.org
server 3.uk.pool.ntp.org
in UK , It works when the server matches your region
Upvotes: 0
Reputation: 66
I had some problems setting up my Ubuntu 18.04 machine before. I just looked at the some logs and I might be able to help.
$ timedatectl
Local time: Wed 2020-03-18 18:01:20 GMT
Universal time: Wed 2020-03-18 18:01:20 UTC
RTC time: Wed 2020-03-18 18:01:20
Time zone: Europe/London (GMT, +0000)
System clock synchronized: yes
This is the my timedatectl output. I got to syncronize it by adding this to "/etc/systemd/timesyncd.conf" :
[Time]
NTP=10.199.999.99 10.999.999.999
Just put the ip addresses of the servers you are trying to synchronize with. The restart timedate and ntp and systemd timesync service. (or reboot :) ). And you should be fine, I don't remember doing anything else. Hope this helps.
Upvotes: 0