NTPD 似乎删除了所有网络接口

NTPD 似乎删除了所有网络接口

我们在 CentOS 上的 eth0 上配置了几个虚拟接口,它们时不时地会突然关闭。现在,在查看日志文件后,我发现 ntpd 似乎删除了所有 eth0 接口,而 dhclient 会自动将 eth0 恢复。然而,虚拟接口一直处于关闭状态,这导致我们的几个网站无法访问。

有人能解释一下为什么 ntpd 会删除接口吗?可以/应该关闭该功能吗?或者我是否也可以/应该配置 dhclient 以自动恢复虚拟接口?

编辑//我应该发布的日志文件:

Nov 12 13:10:28 raptor dhclient[20048]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x6a825e97)
Nov 12 13:10:42 raptor dhclient[20048]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x24554092)
Nov 12 13:10:42 raptor dhclient[20048]: DHCPOFFER from 96.126.108.78
Nov 12 13:10:42 raptor dhclient[20048]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x24554092)
Nov 12 13:10:42 raptor dhclient[20048]: DHCPACK from 96.126.108.78 (xid=0x24554092)
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #31 eth0, 50.116.50.97#123, interface stats: received=3255, sent=3256, dropped=0, active_time=1559394 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #32 eth0:0, 50.116.53.56#123, interface stats: received=3, sent=0, dropped=0, active_time=1559391 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #33 eth0:1, 66.175.211.192#123, interface stats: received=2, sent=0, dropped=0, active_time=1559389 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #34 eth0:2, 50.116.53.95#123, interface stats: received=3, sent=0, dropped=0, active_time=1559387 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #35 eth0:3, 97.107.132.32#123, interface stats: received=2, sent=0, dropped=0, active_time=1559385 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #36 eth0:4, 50.116.56.201#123, interface stats: received=2, sent=0, dropped=0, active_time=1559383 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #37 eth0:5, 66.175.212.121#123, interface stats: received=2, sent=0, dropped=0, active_time=1559381 secs
Nov 12 13:10:42 raptor ntpd[2109]: Deleting interface #38 eth0:6, 66.175.215.137#123, interface stats: received=2, sent=0, dropped=0, active_time=1559379 secs
Nov 12 13:10:44 raptor NET[1573]: /sbin/dhclient-script : updated /etc/resolv.conf
Nov 12 13:10:44 raptor dhclient[20048]: bound to 50.116.50.97 -- renewal in 32692 seconds.
Nov 12 13:10:45 raptor ntpd[2109]: Listening on interface #39 eth0, 50.116.50.97#123 Enabled

eth0 配置:

DEVICE="eth0"
ONBOOT="yes"
BOOTPROTO="dhcp"
IPV6INIT="no"
IPADDR=50.116.50.97
NETMASK=255.255.255.0
GATEWAY=50.116.50.1

以及虚拟接口(我只发布了第一个,它们大部分看起来都一样):

# Configuration for eth0:0
DEVICE=eth0:0
BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.
ONBOOT=yes

# eth0:0
IPADDR=50.116.53.56
NETMASK=255.255.255.0

答案1

BOOTPROTO="dhcp"表示您有 DHCP。

如果您仔细观察,就会发现 DHCP 客户端在 ntp 更改任何内容之前立即运行。我认为您的 DHCP 客户端正在删除 eth0 上的所有静态地址。当 NTP 注意到这一点时,它知道需要停止监听它正在监听的所有套接字以获取静态地址。

答案2

问题

ntpd 正在删除接口

Nov  9 01:10:09 localhost ntpd[27847]: Deleting interface #16 ethX, x.x.x.x#123, interface stats: received=0, sent=0, dropped=0, active_time=522 secs
Nov  9 01:10:09 localhost ntpd[27847]: Deleting interface #17 ethX, x.x.x.x#123, interface stats: received=0, sent=0, dropped=0, active_time=522 secs

解决

使用 -L 选项告诉 ntpd 不要监听虚拟接口。您可以在 中设置 -L /etc/sysconfig/ntpd

当接口down或者被移除的时候,ntpd会根据当前接口状态更新监听接口。

来源:https://access.redhat.com/solutions/261123

相关内容