我在位于美国东西海岸的两个数据中心有几台Linux(Debian)服务器。 我从每个位置select一台服务器作为NTP服务器。 NTP服务器与0-3.us.pool.ntp.org服务器同步时间。 这似乎迄今运作良好。
客户端被configuration为使用ntp1和ntp2。 我在客户端上设置了防火墙规则(UDP 123)。
我的问题是,如何configuration服务器,以便客户端可以使用我的NTP服务器,并防止我的NTP服务器成为公共时间服务器给其他人?
我不知道如何configuration服务器上的/etc/ntp.conf文件,以限制只有我的服务器,因为将有公共/私有IP地址的混合。
现在我有restrict 10.0.0.0 netmask 255.255.255.0 nomodify notrap这将限制每个NTP所在的本地子网。
本质上,你要做上面描述的内容:
restrict 10.0.0.0 netmask 255.255.255.0 nomodify notrap
对于您想要服务的每个子网或IP地址,然后允许您的服务器(即从您获得时间的那些机器)略微减less特权:
restrict 128.118.25.3 noquery nomodify notrap nopeer restrict 130.88.202.49 noquery nomodify notrap nopeer restrict 128.59.59.177 noquery nomodify notrap nopeer restrict 2a01:8000:0:4::123:123 noquery nomodify notrap nopeer
然后明确否认其他人:
restrict default ignore
请注意,这与使用池服务器不兼容,因为每次NTP重新启动时,这些服务器都会更改。 如果你想完全忽略世界其他地方,你需要使用特定的NTP服务器,以便列出他们的地址; ISP经常为此提供服务器。 如果您必须使用池服务器,则没有特定的时间服务器条目,而是将“其余的世界”行更改为
restrict default noquery nomodify notrap nopeer