如果ufw上的传出和传入都被阻塞,是否需要打开任何用于NTP同步的端口?

我的一台生产服务器UFWconfiguration如下:

Status: active Logging: on (low) Default: deny (incoming), **deny (outgoing)**, disabled (routed) New profiles: skip To Action From -- ------ ---- 22/tcp ALLOW IN Anywhere 22/tcp (v6) ALLOW IN Anywhere (uv6) 80/tcp ALLOW IN Anywhere 80/tcp (v6) ALLOW IN Anywhere (v6) 

我已经通过安装ntp服务启用了NTP同步,目前正在运行。 当我运行ntpq -p ,我得到以下输出:

  remote refid st t when poll reach delay offset jitter ============================================================================== +209.114.111.1 132.163.4.103 2 u 52m 1024 374 44.591 3.390 0.983 +208.75.89.4 216.218.192.202 2 u 51m 1024 374 67.622 2.429 2.171 *204.9.54.119 .CDMA. 1 u 40m 1024 374 24.324 2.344 2.116 -72.14.183.239 200.98.196.212 2 u 41m 1024 374 41.822 4.611 2.649 -91.189.94.4 193.79.237.14 2 u 43m 1024 374 74.764 -0.407 3.417 

从上面的输出,显然它看起来ntp已经正常工作,没有打开ufw firewall上的任何额外的端口。 这种理解是正确的还是我需要打开任何端口NTP同步工作?

谢谢

你的'when'列告诉我ntp在40分钟前最后与这些服务器聊天,但是你的轮询间隔是1024秒(〜17分钟)。 ntp似乎没有正常运行,这是有道理的给你的防火墙configuration。

您需要一个出站和入站允许规则为UDP 123.因为UDP是无状态的,所以需要入站。 这就像接收你不认识的人的邮件。