Hi,

I have an NTP server (Cent OS IP 192.168.102.129) which is configured to sync time from Singapore NTP, the client is from Europe (also a Cent OS 192.168.102.140), I want the client to sync its time from the NTP server, but it doesnt not sync.

I have changed the NTP server’s timezone to Singapore, thus not sure if it is the right way, googled and got the NTP server to sync from Singapore NTP server pool, this part works, I can’t get the client to sync from the Cent OS NTP Server.

Could some one guide me how to get the client to sync it’s time from Singapore while being in Europe.

I tried the settings I used for the NTP server, on the client, with server address of the NTP server, I get this error: no server suitable for synchronization found all the time when I try the ntpq -p command.

Both Cent OS are VM machines

Thank You

2 Spice ups

If you are using NTPD or Chrony, you need to allow clients in the config file (/etc/ntp.conf or /etc/chrony.conf). You also need to allow TCP and UDP access to port 123 in the firewall.

Thanks for the reply, this is for the client or the server or both…

The server config file needs to allow access by clients on specific subnets. The server also needs to allow incoming traffic on port 123 in the firewall. Chrony is the replacement for NTPD (at least in the RHEL/CentOS world). I find it easier to use.

Tried to allow with the following using IP Tables, the client still does not sync with the server…

iptables -A INPUT -p udp -m state --state NEW -m udp --dport 123 -j ACCEPT # Allowing NTP via UDP port
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 123 -j ACCEPT # Allowing NTP via TCP port

Thank you

This is what I get…

[root@localhost ~]# ntpq -pn
remote refid st t when poll reach delay offset jitter

192.168.102.129 .INIT. 16 u - 128 0 0.000 0.000 0.000

[root@localhost ~]# netstat

unsynchronised

time server re-starting
polling server every 8 s
Its been like this for a very long time now…

From the client, run ntpdate like this (substitute the correct server name) to see what response you get.

ntpdate -v myserver

This should show something like this:

26 Dec 15:59:13 ntpdate[18377]: ntpdate 4.2.6p5@1.2349-o Fri Jan 26 02:18:05 UTC 2018 (1)
26 Dec 15:59:13 ntpdate[18377]: adjust time server 192.168.0.1 offset 0.020776 sec

You may need to install the ntpdate package.

Thanks, I got the below reply…

root@localhost ~]# ntpdate -v 192.168.102.129
26 Dec 21:07:07 ntpdate[4056]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1)
26 Dec 21:07:07 ntpdate[4056]: the NTP socket is in use, exiting

This is from ntp.log

26 Dec 21:00:00 ntpd[3577]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
26 Dec 21:00:00 ntpd[3577]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
26 Dec 21:00:00 ntpd[3577]: Listen and drop on 1 v6wildcard :: UDP 123
26 Dec 21:00:00 ntpd[3577]: Listen normally on 2 lo 127.0.0.1 UDP 123
26 Dec 21:00:00 ntpd[3577]: Listen normally on 3 ens33 192.168.102.140 UDP 123
26 Dec 21:00:00 ntpd[3577]: Listen normally on 4 virbr0 192.168.122.1 UDP 123
26 Dec 21:00:00 ntpd[3577]: Listen normally on 5 lo ::1 UDP 123
26 Dec 21:00:00 ntpd[3577]: Listening on routing socket on fd #22 for interface updates
26 Dec 21:00:01 ntpd[3577]: 0.0.0.0 c016 06 restart
26 Dec 21:00:01 ntpd[3577]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
26 Dec 21:00:01 ntpd[3577]: 0.0.0.0 c011 01 freq_not_set
26 Dec 21:00:08 ntpd[3577]: 0.0.0.0 c61c 0c clock_step +67.542247 s
26 Dec 21:01:16 ntpd[3577]: 0.0.0.0 c614 04 freq_mode
26 Dec 21:01:18 ntpd[3577]: 0.0.0.0 c618 08 no_sys_peer
26 Dec 21:03:36 ntpd[3830]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
26 Dec 21:03:36 ntpd[3830]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
26 Dec 21:03:36 ntpd[3830]: Listen and drop on 1 v6wildcard :: UDP 123
26 Dec 21:03:36 ntpd[3830]: Listen normally on 2 lo 127.0.0.1 UDP 123
26 Dec 21:03:36 ntpd[3830]: Listen normally on 3 ens33 192.168.102.140 UDP 123
26 Dec 21:03:36 ntpd[3830]: Listen normally on 4 virbr0 192.168.122.1 UDP 123
26 Dec 21:03:36 ntpd[3830]: Listen normally on 5 lo ::1 UDP 123
26 Dec 21:03:36 ntpd[3830]: Listening on routing socket on fd #22 for interface updates
26 Dec 21:03:36 ntpd[3830]: 0.0.0.0 c016 06 restart
26 Dec 21:03:36 ntpd[3830]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
26 Dec 21:03:36 ntpd[3830]: 0.0.0.0 c011 01 freq_not_set
26 Dec 21:03:44 ntpd[3830]: 0.0.0.0 c614 04 freq_mode
26 Dec 21:04:32 ntpd[3830]: ntpd exiting on signal 15
26 Dec 21:04:32 ntpd[3877]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
26 Dec 21:04:32 ntpd[3877]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
26 Dec 21:04:32 ntpd[3877]: Listen and drop on 1 v6wildcard :: UDP 123
26 Dec 21:04:32 ntpd[3877]: Listen normally on 2 lo 127.0.0.1 UDP 123
26 Dec 21:04:32 ntpd[3877]: Listen normally on 3 ens33 192.168.102.140 UDP 123
26 Dec 21:04:32 ntpd[3877]: Listen normally on 4 virbr0 192.168.122.1 UDP 123
26 Dec 21:04:32 ntpd[3877]: Listen normally on 5 lo ::1 UDP 123
26 Dec 21:04:32 ntpd[3877]: Listening on routing socket on fd #22 for interface updates
26 Dec 21:04:32 ntpd[3877]: 0.0.0.0 c016 06 restart
26 Dec 21:04:32 ntpd[3877]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
26 Dec 21:04:32 ntpd[3877]: 0.0.0.0 c011 01 freq_not_set

Could you let me know what clarification I need to do on the Server and what on the client, this is what I have done:

Server

timedatectl set-timezone “Asia/Singapore” # Set timezone to Singapore
yum install ntp -y
systemctl start ntpd
systemctl enable ntpd
systemctl status ntpd

Firewall
iptables -A INPUT -p udp --dport 123 -j ACCEPT
iptables -A OUTPUT -p udp --sport 123 -j ACCEPT

ntp.conf file

For more information about this file, see the man pages

ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

Permit time synchronization with our time source, but do not

permit the source to query or modify the service on this system.

restrict default nomodify notrap nopeer noquery

Permit all access over the loopback interface. This could

be tightened as well, but to do so would effect some of

the administrative functions.

restrict 127.0.0.1
restrict ::1

Hosts on local network are less restricted.

restrict 192.168.102.0 mask 255.255.255.0 nomodify notrap # The nomodify options changing the configuration, The notrap option prevents ntpdc control message protocol traps.

Use public servers from the pool.ntp.org project.

Please consider joining the pool ( pool.ntp.org: Join the NTP Pool!) .

server 0.sg.pool.ntp.org iburst
server 1.sg.pool.ntp.org iburst
server 2.sg.pool.ntp.org iburst
server 3.sg.pool.ntp.org iburst

#broadcast 192.168.1.255 autokey
#broadcastclient
#broadcast 224.0.1.1 autokey
#multicastclient 224.0.1.1
“ntp.conf” 62L, 2133C

ntpq -p
systemctl restart ntpd
ntpstat

Client

What do I need to do on the client, haven’t been able to find anything on it, so I tried the same with the client, except in place of time servers I added the IP of NTP server created above, am I correct ?

Thank You

I’m not an IP Tables wizard but you might try adding the state ESTABLISHED to your firewall state tables for both UDP and TCP

I get the below message when I try ntpq -p 192.168.102.129

ntpq: read: No route to host

To run ntpdate, you’ll need to stop the ntpd service on the client.

I’m not seeing a problem with your configs. I used to have issues with ntpd in the past with clients, so I would use “ntpdate myserver > /dev/null” in crontab every hour to sync the time.

You could try using chrony instead (chronyd is the service chronyc is the CLI access). I’ve found it to work more reliably (at least for me). The syntax in /etc/chrony.conf is similar.

yum install -y chrony

systemctl enable chronyd

systemctl start chronyd

Appreciate that, receiving the below error with ntpdate…
26 Dec 22:05:55 ntpdate[3330]: no servers can be used, exiting

On the client, can you run an nmap scan:

nmap -sU myserver -p 123

The result should be something like:

PORT STATE SERVICE
123/udp open|filtered ntp

BTW, run chronyd on the server and the client as a replacement for ntpd.

Again, appreciate your consistent help…