Debian

為什麼 ntpd 監聽大部分 192.168.1.X/192.168.2.X

  • August 2, 2020

ntp在 debian 擠壓中使用該軟體包,並且 ntpd 程序正在偵聽數百個未在伺服器上配置的 rfc1918 地址。

看一下這個:

Mar 26 10:07:24 server ntpd[14701]: ntpd 4.2.6p2@1.2194-o Sun Oct 17 13:45:13 UTC 2010 (1)
Mar 26 10:07:24 server ntpd[14702]: proto: precision = 0.986 usec
Mar 26 10:07:24 server ntpd[14702]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen and drop on 1 v6wildcard :: UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 2 lo 127.0.0.1 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 3 eth0 66.xxx.xxx.xxx UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 4 eth0 192.168.1.1 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 5 eth0 192.168.1.2 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 6 eth0 192.168.1.3 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 7 eth0 192.168.1.4 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 8 eth0 192.168.1.5 UDP 123
...
...
...
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 499 eth0 192.168.2.240 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 500 eth0 192.168.2.241 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 501 eth0 192.168.2.242 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 502 eth0 192.168.2.243 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 503 eth0 192.168.2.244 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 504 tun0 10.13.37.1 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 505 tun1 10.13.42.2 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 506 lo ::1 UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 507 eth0 2600:xxxx::xxxx UDP 123
Mar 26 10:07:24 server ntpd[14702]: Listen normally on 508 eth0 fe80::xxxx UDP 123

我的配置文件:

driftfile /var/lib/ntp/ntp.drift
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
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1

ifconfig eth0:

eth0      Link encap:Ethernet  HWaddr f2:xx:xx:xx:xx:xx
inet addr:66.xxx.xxx.xxx  Bcast:66.xxx.xxx.xxx  Mask:255.255.255.0
inet6 addr: 2600:xxxx::xxxx/64 Scope:Global
inet6 addr: fe80::xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:69898198 errors:0 dropped:0 overruns:0 frame:0
TX packets:55539406 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25263193357 (23.5 GiB)  TX bytes:41787470527 (38.9 GiB)
Interrupt:76

任何想法為什麼?

我沒有完整的輸出 pre-grep 因為我的滾動緩衝區已滿,但是:

# ip addr show dev eth0 |grep 192.168.[12]
inet 192.168.1.1/16 scope global eth0
inet 192.168.1.2/16 scope global secondary eth0
inet 192.168.1.3/16 scope global secondary eth0
inet 192.168.1.4/16 scope global secondary eth0
inet 192.168.1.5/16 scope global secondary eth0
...

這解決了它:

ip addr del 192.168.1.1/16 dev eth0

這很可能是我不久前對 openvpn 配置進行的一些擺弄的副作用。

引用自:https://unix.stackexchange.com/questions/121580