我正在尝试为一些测试设置本地NTP服务器。我已经在Ubuntu 18.04上安装了NTP,并在配置文件中注释了服务器池块。
下面是完整的配置:
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery
restrict 10.24.0.0 mask 255.255.0.0 notrust
server 127.127.1.0
fudge 127.127.1.0 stratum 10使用此命令设置我想要的sudo timedatectl set-time "2013-06-02 23:26:00"时间
我还试着查看ntp服务是否由正在运行的sudo systemctl status ntp.service运行,但在123端口上显示时,我没有发现任何正在运行的服务。与ps一起发现
ubuntu@ntp:~$ ps auxww | grep '[n]tp'
ntp 13517 0.0 0.8 103212 4136 ? Ssl Jun02 0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 111:115当客户端试图从此服务器上运行的NTP中获得时间时,就会超时。在/var/log/syslog中也看不到任何消息
更多信息:
ubuntu@ntp:~$ ps auxww | grep '[n]tp'
ntp 807 0.0 0.7 103212 3480 ? Ssl Jan28 0:02 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 111:115
ubuntu@ntp:~$ ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
*127.127.1.0 .LOCL. 10 l 2 64 377 0.000 0.000 0.000
ubuntu@ntp:~$ ntpq -c rv
associd=0 status=0515 leap_none, sync_local, 1 event, clock_sync,
version="ntpd 4.2.8p10@1.3728-o (1)", processor="x86_64",
system="Linux/4.15.0-1019-aws", leap=00, stratum=11, precision=-24,
rootdelay=0.000, rootdisp=11.016, refid=LOCAL(0),
reftime=de1977a0.2605c5ad Mon, Jan 29 2018 5:36:16.148,
clock=de1977a6.758ae7fc Mon, Jan 29 2018 5:36:22.459, peer=57525, tc=6,
mintc=3, offset=0.000000, frequency=0.000, sys_jitter=0.000000,
clk_jitter=0.000, clk_wander=0.000, tai=37, leapsec=201701010000,
expire=201812280000我尝试使用这脚本从真正的NTP服务器获得时间,而不是在独立的NTP上。
我在这里错过了什么?
发布于 2019-01-16 23:16:39
查看服务打开的端口的一种方法是:
netstat -an
当然,您可以使用grep命令过滤输出,如下所示:
netstat -an|grep 123。
我有时也使用lsof,如下所示:
lsof -i udp -nP在基于RedHat的发行版中。
有关更多信息,请参见man lsof和man netstat。
我希望这能帮到你。
https://serverfault.com/questions/949433
复制相似问题