大网数据广告活动
服务器运维问答

standalone NTP config

· 52CE 我爱测

I am trying to setup local NTP server for some testing. I have installed NTP on Ubuntu 18.04 and commented server-pool block in the config file Here is the full config : driftfile /var/lib/ntp/ntp.drift leapfile /usr/share/zonein…

问题原文

原帖链接 · rp346 · CC BY-SA 4.0

I am trying to setup local NTP server for some testing. I have installed NTP on Ubuntu 18.04 and commented server-pool block in the config file

Here is the full config :

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

Used this command to set the time I want sudo timedatectl set-time "2013-06-02 23:26:00"

I also tried to see if service is ntp service is running by sudo systemctl status ntp.service which is running, but when grepped on port 123 I didn't find anything running. Found with 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

When client tries to get time from NTP running on this server, it timeouts. Also Dont see any messages in /var/log/syslog

More info :

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 [email omitted] (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

I tried this script to get time from real NTP server, where it worked, but not on the standalone NTP.

What I am missing here ?

已采纳解答

原帖链接 · Manuel Florian · CC BY-SA 4.0

One way to see the ports opened by services is:

netstat -an

Of course you can filter the output with grep command like this:

netstat -an|grep 123.

I sometimes use lsof too, like this:

lsof -i udp -nP in RedHat based distros.

See man lsof and man netstat for more info.

I hope this helps.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-01-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。