What's new

Why is NTP socket in use?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

MuppetSoul

Occasional Visitor
Hardware: RT-N66U
Firmware: Merlin 378.52_2
Issue: Cannot sync NTP
Error:
Code:
27 May 12:31:59 ntpdate[3108]: the NTP socket is in use, exiting

I keep getting this error while trying to sync NTP on Slackware. I've tried forwarding and triggering port 123/UDP but it hasn't resolved the issue.

Under Connections, the state of the connections (UDP/Port 123) appears as UNREPLIED.

Code:
udp   192.168.1.122:123              24.102.6.62:123             UNREPLIED
udp   192.168.1.122:123              173.243.192.18:123          UNREPLIED
udp   192.168.1.122:123              69.28.67.150:123            UNREPLIED
udp   192.168.1.122:123              67.215.197.149:123          UNREPLIED

The only way NTP syncs is through command line by using an alternative port:

Code:
ntpdate -u pool.ntp.org

This doesn't solve the issue I'm having as I'm left with an IPMI that can't sync with external NTP servers either and I can't use command line on IPMI to force a sync with an alternative port.

Any help would be appreciated.

EDIT: The router has NTP enabled and it syncs just fine.
 
Last edited:
Update:
Disabling the router firewall allows NTP to sync but I don't think this is a solution necessarily.

@RMerlin: Could this possibly be a bug?

EDIT: Spoke too soon :(
Code:
udp   192.168.1.122:123              24.102.6.62:123               UNREPLIED
udp   192.168.1.122:123              69.28.67.150:123              UNREPLIED
udp   192.168.1.122:123              142.137.247.109:123           UNREPLIED
udp   192.168.1.122:123              192.95.25.79:123              UNREPLIED
udp   192.168.1.122:123              192.99.10.15:123              UNREPLIED
udp   192.168.1.122:123              198.27.65.66:123              UNREPLIED
udp   192.168.1.122:123              206.108.0.131:123             UNREPLIED
 
Last edited:
This has nothing to do with the router. Check if your server isn't already running an ntpd, most distros tend to.
 
Thanks for the reply.

I can verify that ntpd service is running on all systems (IPMI + VM). It just won't sync with servers on the web. I've tried various ntp providers (pool.ntp.org, time.nist.gov, etc.) for both (IPMI + VM) and couldn't sync. Only when I disabled the firewall on the router was ntpd able to sync. Though I'd prefer to avoid disabling the firewall altogether.

With firewall enabled, I get the following error while trying to sync:

Code:
27 May 12:31:59 ntpdate[3108]: the NTP socket is in use, exiting

Even after I stop ntpd service, I can't manually sync unless I use an alternative port i.e.

Code:
ntpdate -u 1.ca.pool.ntp.org

In short,
Firewall ON ---> Can't sync ntpd with server (unless I manually request an alternative port)
Firewall OFF ---> ntpd syncs
 
Last edited:
Works just fine for me:

Code:
merlin@mint-dev ~ $ sudo ntpdate -u 1.ca.pool.ntp.org
27 May 22:03:24 ntpdate[9477]: adjust time server 206.108.0.132 offset -0.001743 sec

You need to stop your ntpd server first if you want to manually run the client. A quick Google search on your error message returned the same answer on the first result:

http://www.linuxquestions.org/quest...nchronisation-not-working-762593/#post3736496
 
Last edited:
@RMerlin: I didn't want to waste your time any further so I took my time to investigate. Here's what I found.

Exhibit A: Syncing while ntpd service isn't running

NGXSVwP.jpg


1. I stopped the ntpd service (/etc/rc.d/rc.ntpd stop)

2. I attempted to sync ntpd on port 123/udp with 1.ca.pool.ntp.org (ntpdate 1.ca.pool.ntp.org). Didn't work.

3. I then used -u to sync on an unprivileged port with 1.ca.pool.ntp.org (ntpdate -u 1.ca.pool.ntp.org). It worked.


Exhibit B (Line#8 from the top, Command#3 from the top): Syncing while ntpd service is running

9dizceN.jpg


1. I started the ntpd service (/etc/rc.d/rc.ntpd start)

2. I attempted to sync ntpd on port 123/udp with 1.ca.pool.ntp.org (ntpdate 1.ca.pool.ntp.org). Didn't work.

3. I then used -u to sync on an alternative port with 1.ca.pool.ntp.org (ntpdate -u 1.ca.pool.ntp.org). It worked.

Exhibit C: Debugging

With ntpd service stopped, I used the -d option to debug. Here's the output:

Code:
root@NAS:~# ntpdate -d 1.ca.pool.ntp.org
28 May 06:13:48 ntpdate[1593]: ntpdate 4.2.8p2@1.3265-o Fri Apr 10 18:50:37 UTC 2015 (1)
Looking for host 1.ca.pool.ntp.org and service ntp
162.244.25.186 reversed to hoenir.neoretro.net
host found : hoenir.neoretro.net
transmit(162.244.25.186)
receive(162.244.25.186)
transmit(206.108.0.132)
receive(206.108.0.132)
transmit(173.243.192.18)
receive(173.243.192.18)
transmit(67.215.197.149)
receive(67.215.197.149)
transmit(162.244.25.186)
receive(162.244.25.186)
transmit(206.108.0.132)
receive(206.108.0.132)
transmit(173.243.192.18)
receive(173.243.192.18)
transmit(67.215.197.149)
receive(67.215.197.149)
transmit(162.244.25.186)
receive(162.244.25.186)
transmit(206.108.0.132)
receive(206.108.0.132)
transmit(173.243.192.18)
receive(173.243.192.18)
transmit(67.215.197.149)
receive(67.215.197.149)
transmit(162.244.25.186)
receive(162.244.25.186)
transmit(206.108.0.132)
receive(206.108.0.132)
transmit(173.243.192.18)
receive(173.243.192.18)
transmit(67.215.197.149)
receive(67.215.197.149)
server 162.244.25.186, port 123
stratum 2, precision -23, leap 00, trust 000
refid [162.244.25.186], delay 0.08600, dispersion 0.00020
transmitted 4, in filter 4
reference time:    d9116ef4.fe8632e8  Thu, May 28 2015  5:39:48.994
originate timestamp: d91176f3.15746505  Thu, May 28 2015  6:13:55.083
transmit timestamp:  d91176f3.00e34d17  Thu, May 28 2015  6:13:55.003
filter delay:  0.08827  0.08711  0.08754  0.08600
         0.00000  0.00000  0.00000  0.00000
filter offset: 0.050166 0.049812 0.049832 0.050109
         0.000000 0.000000 0.000000 0.000000
delay 0.08600, dispersion 0.00020
offset 0.050109

server 206.108.0.132, port 123
stratum 1, precision -23, leap 00, trust 000
refid [PPS], delay 0.07259, dispersion 0.00023
transmitted 4, in filter 4
reference time:    d91176ca.8001b961  Thu, May 28 2015  6:13:14.500
originate timestamp: d91176f3.4379651d  Thu, May 28 2015  6:13:55.263
transmit timestamp:  d91176f3.3415b40f  Thu, May 28 2015  6:13:55.203
filter delay:  0.07501  0.07275  0.07306  0.07259
         0.00000  0.00000  0.00000  0.00000
filter offset: 0.036544 0.036945 0.036868 0.036602
         0.000000 0.000000 0.000000 0.000000
delay 0.07259, dispersion 0.00023
offset 0.036602

server 173.243.192.18, port 123
stratum 2, precision -29, leap 00, trust 000
refid [173.243.192.18], delay 0.07759, dispersion 0.00017
transmitted 4, in filter 4
reference time:    d9114bc8.4b9387ff  Thu, May 28 2015  3:09:44.295
originate timestamp: d91176f3.76d2dfff  Thu, May 28 2015  6:13:55.464
transmit timestamp:  d91176f3.674deee1  Thu, May 28 2015  6:13:55.403
filter delay:  0.07872  0.07759  0.07823  0.07825
         0.00000  0.00000  0.00000  0.00000
filter offset: 0.034465 0.034558 0.034769 0.034305
         0.000000 0.000000 0.000000 0.000000
delay 0.07759, dispersion 0.00017
offset 0.034558

server 67.215.197.149, port 123
stratum 2, precision -23, leap 00, trust 000
refid [67.215.197.149], delay 0.08377, dispersion 0.00023
transmitted 4, in filter 4
reference time:    d91174fe.55714aa0  Thu, May 28 2015  6:05:34.333
originate timestamp: d91176f3.ac8a9098  Thu, May 28 2015  6:13:55.673
transmit timestamp:  d91176f3.9a7ca1e7  Thu, May 28 2015  6:13:55.603
filter delay:  0.08614  0.08507  0.08377  0.08449
         0.00000  0.00000  0.00000  0.00000
filter offset: 0.041025 0.040319 0.040439 0.040734
         0.000000 0.000000 0.000000 0.000000
delay 0.08377, dispersion 0.00023
offset 0.040439

28 May 06:13:55 ntpdate[1593]: adjust time server 206.108.0.132 offset 0.036602 sec

As you can see, there were no issues syncing.

However, when I tried to sync on port 123/udp, I couldn't.
Code:
root@NAS:~# ntpdate 1.ca.pool.ntp.org
28 May 06:14:16 ntpdate[1636]: no server suitable for synchronization found

Again, I'm able to sync using an unprivileged port.
Code:
root@NAS:~# ntpdate -u 1.ca.pool.ntp.org
28 May 06:14:33 ntpdate[1675]: adjust time server 206.108.0.132 offset 0.036680 sec

According to ntpdate man page, -u and -d use unprivileged ports which is why I was able to sync on both.
Code:
-u Direct ntpdate to use an unprivileged port for outgoing packets.
This is most useful when behind a firewall that blocks incoming
traffic to privileged ports, and you want to synchronise with
hosts beyond the firewall. Note that the -d option always uses
unprivileged ports.

It seems to be a firewall issue: https://unix.stackexchange.com/ques...essful-but-ntpdate-returns-no-server-suitable

Problem: Firewall blocks sync to ntp servers on port 123/udp

On this VM, I can make ntpd use -u. However, I can't do the same for IPMI where I'm having the exact same issue. This machine is behind an unmanaged switch. Not sure if this is contributing in some way. Both IPMI and the VM have their own static IP address so it really shouldn't matter. And as noted earlier, I was able to sync on port 123/udp once I disabled the firewall though again I rather not do that.

Regards.

P.S. I'd appreciate if you can move this thread to Asuswrt-Merlin.
 
Last edited:

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top