restrict控制可以访问的ip地址
#restrict default kod nomodify notrap nopeer noquery
#restrict -6 default kod nomodify notrap nopeer noquery
默认这样的配置,所有的IP地址都能连上来同步时间
如果要限定指定的IP或网段,就按如下方式
1、要屏蔽所有IP地址,使用
restrict default ignore
2、然后再后面可以指定相应的IP地址来同步
restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap nopeer noquery
注意:
1、如果设置了restrict default ignore,那么与上级服务器之间的同步也必须用restrict来显式指定,否则无法同上级服务同步时间。
如配置了server time.windows.com,那么就要加上restrict time.windows.com nomodify notrap nopeer noquery
2、如果修改/etc/sysconfig/ntpd,在OPTIONS增加-4参数,即使用IPv4,那么ntpq命令也要用-4参数执行