Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to setup an NTP server in Ubuntu 10.04.4 LTS that other PC's on LAN can sync with, and have now spend three days trying to make it work without luck.
At some point the guide tells me to check the syslog for a sync message which never arrives I only get this:
Code:
Sep 15 14:54:31 h218 ntpd[14442]: ntpd exiting on signal 15
Sep 15 14:54:33 h218 ntpd[14607]: ntpd 4.2.4p8@1.1612-o Fri Feb 6 16:49:14 UTC 2015 (1)
Sep 15 14:54:33 h218 ntpd[14608]: precision = 1.000 usec
Sep 15 14:54:33 h218 ntpd[14608]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #1 wildcard, ::#123 Disabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #2 lo, 127.0.0.1#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #3 eth0, 10.122.3.1#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #4 eth1, 10.122.4.1#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #5 eth2, 172.27.91.87#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #6 br0, 10.122.2.1#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #7 eth3, fe80::d6ae:52ff:fed0:1576#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #8 lo, ::1#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #9 eth2, fe80::d6ae:52ff:fed0:1575#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: Listening on interface #10 eth1, fe80::20a:f7ff:fe3a:6bce#123 Enabled
Sep 15 14:54:33 h218 ntpd[14608]: kernel time sync status 2040
Sep 15 14:54:33 h218 ntpd[14608]: frequency initialized 29.691 PPM from /var/lib/ntp/ntp.drift
I then run
Code:
ntpq -c lpeer
and get:
Code:
remote refid st t when poll reach delay offset jitter
==============================================================================
gw.net5.klient. .INIT. 16 u - 64 0 0.000 0.000 0.000
My ntp.conf looks like this:
Code:
# NTP server entries received from DHCP server
server nist1-dc.WiTime.net iburst
server ntp0.mcs.anl.gov
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# 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
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Allow LAN machines to synchronize with this ntp server
restrict 10.122.2.0 mask 255.255.255.0 nomodify notrap
The information provided in the link is a few years old and the non pool servers might not be valid anymore. As stated use the pool closest to your location. http://www.pool.ntp.org/en/
If you want to use the US pool then:
Quote:
server 0.us.pool.ntp.org iburst
server 1.us.pool.ntp.org iburst
server 2.us.pool.ntp.org iburst
server 3.us.pool.ntp.org iburst
Restart the server and see if it now syncs. It might take a few minutes. Post the output of the command:
ntpq -p
@michaelk:
Thank you! I have previously tried different servers with no luck, so I went back to following the guide to the letter. I did try changing the server list, however, after several minutes ntpq -p still only gives me:
Code:
remote refid st t when poll reach delay offset jitter
==============================================================================
gw.net5.klient. .INIT. 16 u - 64 0 0.000 0.000 0.000
@cyent:
The machine is part of a test setup where it is used to emulate network using Kaunet which is only supported on the 2.6 kernels, so changing operating system is not really an option for me.
If you need a 2.6 kernel then I suggest CentOS 6.7. It is still active and receives updates. If the only requirement is 2.6 then kaunet should work.
I would expect the output of the ntpq -pn command to be similiar to the below. I do not know why you are only seeing one line and in addition not seeing the server itself (127.127.1.0). Are you restarting ntp after making changes to ntp.conf?
Code:
remote refid st t when poll reach delay offset jitter
==============================================================================
92.242.140.2 .INIT. 16 u - 64 0 0.000 0.000 0.000
*96.44.142.5 127.67.113.92 2 u 3 64 17 30.282 12.540 1.592
66.79.167.34 131.107.13.100 2 u 2 64 17 78.339 4.827 0.579
104.41.150.68 129.6.15.30 2 u 61 64 7 64.858 -10.788 1.512
69.64.45.119 66.228.38.73 3 u 64 64 2 444.649 -176.23 0.000
127.127.1.0 .LOCL. 10 l 65 64 16 0.000 0.000 0.000
Again at least from my location nist1-dc.WiTime.net nor ntp0.mcs.anl.gov are valid ntp servers
Quote:
sudo ntpdate -q -u nist1-dc.WiTime.net
Error resolving nist1-dc.WiTime.net: Name or service not known (-2)
16 Sep 06:04:55 ntpdate[4297]: Can't find host nist1-dc.WiTime.net: Name or service not known (-2)
16 Sep 06:04:55 ntpdate[4297]: no servers can be used, exiting
sudo ntpdate -q -u ntp0.mcs.anl.gov
server 92.242.140.2, stratum 0, offset 0.000000, delay 0.00000
16 Sep 06:08:04 ntpdate[4307]: no server suitable for synchronization found
Try the command
sudo ntpdate -q -u 0.us.pool.ntp.org
If that works then at least we know that outgoing time requests are working. If so then stop ntp and try
ntpdate 0.us.pool.ntp.org. Post the output. If that does not work then we know you could have a network problem.
Trying to resolv the server ntpd is using I failed. Propably cause its an internal one to your network. Definitely recheck the availability of the server. Maybe just stick with the pool.ntp.org servers. Also make sure that ntp is allowed at your gateway and all the way up the used ntp servers.
Im missing a default policy of iptables configuration within /etc/network/interfaces. Please check what it is set to.
If you need a 2.6 kernel then I suggest CentOS 6.7. It is still active and receives updates. If the only requirement is 2.6 then kaunet should work.
I would expect the output of the ntpq -pn command to be similiar to the below. I do not know why you are only seeing one line and in addition not seeing the server itself (127.127.1.0). Are you restarting ntp after making changes to ntp.conf?
Code:
remote refid st t when poll reach delay offset jitter
==============================================================================
92.242.140.2 .INIT. 16 u - 64 0 0.000 0.000 0.000
*96.44.142.5 127.67.113.92 2 u 3 64 17 30.282 12.540 1.592
66.79.167.34 131.107.13.100 2 u 2 64 17 78.339 4.827 0.579
104.41.150.68 129.6.15.30 2 u 61 64 7 64.858 -10.788 1.512
69.64.45.119 66.228.38.73 3 u 64 64 2 444.649 -176.23 0.000
127.127.1.0 .LOCL. 10 l 65 64 16 0.000 0.000 0.000
Again at least from my location nist1-dc.WiTime.net nor ntp0.mcs.anl.gov are valid ntp servers
Try the command
sudo ntpdate -q -u 0.us.pool.ntp.org
If that works then at least we know that outgoing time requests are working. If so then stop ntp and try
ntpdate 0.us.pool.ntp.org. Post the output. If that does not work then we know you could have a network problem.
Yes, I restart every the service every time, this is also reflected in syslog.
As previously suggested I did remove the first 2 servers from the list and is only using the us.pool.ntp.org servers. And ntpdate does seem to work:
Code:
root@h218:~# ntpdate -q -u 0.us.pool.ntp.org
server 97.107.128.58, stratum 2, offset -0.170835, delay 0.12335
server 108.59.2.24, stratum 2, offset -0.169937, delay 0.15591
server 132.163.4.102, stratum 1, offset -0.173463, delay 0.17871
server 24.56.178.140, stratum 1, offset -0.171146, delay 0.18280
16 Sep 13:47:25 ntpdate[18736]: adjust time server 132.163.4.102 offset -0.173463 sec
root@h218:~# ntpdate 0.us.pool.ntp.org
16 Sep 13:47:45 ntpdate[18737]: adjust time server 24.56.178.140 offset -0.168206 sec
Trying to resolv the server ntpd is using I failed. Propably cause its an internal one to your network. Definitely recheck the availability of the server. Maybe just stick with the pool.ntp.org servers. Also make sure that ntp is allowed at your gateway and all the way up the used ntp servers.
Im missing a default policy of iptables configuration within /etc/network/interfaces. Please check what it is set to.
What I posted earlier is everything that is all the iptables setup in /etc/network/interfaces.
iptables -L gives me:
ping gw.net5.klient
PING gw.net5.klient (92.242.140.2) 56(84) bytes of data.
sudo ntpdate -q -u ntp0.mcs.anl.gov
server 92.242.140.2, stratum 0, offset 0.000000, delay 0.00000
16 Sep 06:08:04 ntpdate[4307]: no server suitable for synchronization found
I do not understand why the bad server is still is being used if you deleted it from your ntp.conf file. What are you using to edit the file?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.