Skip to content
statance
MenuClose
← All ports

Port 123: NTP

Medium risk

UDP port 123 is the Network Time Protocol, used to keep system clocks in sync. Clients query time servers on it and time servers answer on it. It should not be reachable from the public internet.

Port
123
Protocol
UDP
Service
NTP
Expose to internet?
No
Also used by
chrony, ntpd, systemd-timesyncd, Windows Time

Is port 123 safe to open?

Ordinary servers only need outbound NTP and do not have to accept inbound queries. Older ntpd versions answered the monlist command, which was widely abused for amplification attacks. A public time server is fine if it is configured to serve time only and refuse management queries.

How to secure NTP

  • Use chrony, which does not serve time to other machines unless you add an allow directive.
  • On ntpd, restrict queries with restrict default kod nomodify notrap nopeer noquery and make sure monlist is disabled.
  • Block inbound UDP 123 on hosts that are only NTP clients.

Check if port 123 is open

Linux: what is listening on this port

sudo ss -ulpn | grep ':123 '

Windows (PowerShell): what is listening

Get-NetUDPEndpoint -LocalPort 123

From another machine: is it reachable

sudo nmap -sU -p 123 HOST

Test the NTP service itself

ntpdate -q HOST

Restrict port 123 in the firewall

Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:123:123) instead of relying on the host firewall.

ufw: allow only your private network, deny everyone else

sudo ufw allow from 10.0.0.0/8 to any port 123 proto udp sudo ufw deny 123/udp

firewalld: allow one source network only

sudo firewall-cmd --permanent --remove-port=123/udp sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="123" protocol="udp" accept' sudo firewall-cmd --reload

iptables

sudo iptables -A INPUT -p udp --dport 123 -s 10.0.0.0/8 -j ACCEPT sudo iptables -A INPUT -p udp --dport 123 -j DROP

Windows Firewall (PowerShell, as Administrator)

New-NetFirewallRule -DisplayName "Block 123 from internet" -Direction Inbound -Protocol UDP -LocalPort 123 -RemoteAddress Internet -Action Block

Monitor port 123

Run a TCP port monitor against your public IP on port 123: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.

Related ports

Port 53DNSMedium risk
Port 161SNMPHigh risk

FAQ

Do I need to open port 123 on my firewall?

Only outbound, for the server to sync its clock. Inbound UDP 123 is only needed if the machine is itself a time server for other hosts.

What is port 123 used for?

UDP port 123 is the Network Time Protocol, used to keep system clocks in sync. Clients query time servers on it and time servers answer on it. It is also used by chrony, ntpd, systemd-timesyncd, Windows Time.

Is port 123 TCP or UDP?

NTP uses UDP on port 123.

How do I check if port 123 is open?

On the server, run sudo ss -tulpn | grep ':123 ' (Linux) or Get-NetTCPConnection -LocalPort 123 (Windows) to see what is listening. From another machine, run nc -zv HOST 123 or Test-NetConnection HOST -Port 123.

All ports →

Know the moment a port stops answering.

TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.