Networking

NTPD 似乎刪除了所有網路介面

  • February 4, 2016

我們在 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

BOOTPROTO="dhcp"意味著你有 DHCP。

如果您看一下,DHCP 客戶端會在 ntp 更改任何內容之前立即執行。我認為您的 DHCP 客戶端正在刪除 eth0 上的所有靜態地址。當 NTP 注意到這一點時,它知道它需要停止偵聽它正在偵聽靜態地址的所有套接字。

問題

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

當介面關閉或移除時,ntpd 會根據目前介面狀態更新監聽介面。

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

引用自:https://serverfault.com/questions/554536