我在 /var/log/messages 中显示了数百个没有意义的频繁重复的条目。更多内容请参见下面的示例。
这是一个在日志文件中重复出现的示例:
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 1 of 5 (Device Prepare) scheduled...
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 1 of 5 (Device Prepare) started...
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 2 of 5 (Device Configure) scheduled...
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 1 of 5 (Device Prepare) complete.
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 2 of 5 (Device Configure) starting...
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> (em2): device state change: 4 -> 5 (reason 0)
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 2 of 5 (Device Configure) successful.
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 3 of 5 (IP Configure Start) scheduled.
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 2 of 5 (Device Configure) complete.
Oct 15 15:14:01 mybox NetworkManager[2570]: <info> Activation (em2) Stage 3 of 5 (IP Configure Start) started...
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 4 of 5 (IP4 Configure Timeout) scheduled...
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 4 of 5 (IP4 Configure Timeout) started...
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 5 of 5 (IP Configure Commit) scheduled...
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 4 of 5 (IP4 Configure Timeout) complete.
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 5 of 5 (IP Configure Commit) started...
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 5 of 5 (IP Configure Commit) failed (no IP configuration found)
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> (em2): device state change: 7 -> 9 (reason 5)
Oct 15 15:14:46 mybox NetworkManager[2570]: <warn> Activation (em2) failed.
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> Activation (em2) Stage 5 of 5 (IP Configure Commit) complete.
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> (em2): device state change: 9 -> 3 (reason 0)
Oct 15 15:14:46 mybox NetworkManager[2570]: <info> (em2): deactivating device (reason: 0).
我原本在这台机器上有两个接口,但现在只使用一个(em1)。第二个接口 (em2) 不再存在于/etc/sysconfig/network-scripts/
网络服务已重新启动,计算机本身也已重新启动。仍在获取对em2
.
我在 /etc 中查找了隐藏的配置条目
find /etc/ -exec grep -Hn em2 {} \;
但“em2”没有任何结果(除了 sha/md5 字符串中的垃圾文本)
情侣问题:
1)还能NetworkManager
从哪里提取配置数据?或者,即使网络接口脚本不存在,NM 是否会看到物理卡并尝试将其启动?
2)NetworkManager
管理网络接口是否绝对需要?这台机器使用最小安装的CentOS 6
.我认为 NM 很早就安装了,但后来我使用 vim 手动配置网络脚本。
主界面(em1)工作正常。
答案1
“管理网络接口绝对需要 NetworkManager 吗?”
不。如果您愿意,您可以禁用它并自行设置。我多年来一直在个人系统上这样做,因为几乎没有任何“网络管理”可做,而且我发现 NM 有点令人恼火。
你必须学习如何使用ifconfig
/ ip
、dhclient
/ dhcpcd
、wpa_supplicant
等。我遇到的唯一问题是在必要时自动重新连接 wifi。这个问题通过脚本解决了:
#!/bin/sh
. $UTIL_SRC_DIR/util-func.sh
checkForSame
. /etc/wifi.conf
exec 1> /dev/null
exec 2>> $log
echo $(date) > $log
# without check_interval set, we risk a 0 sleep = busy loop
if [ ! "$check_interval" ]; then
echo "No check interval set!" >> $log
exit 1
fi
startWifi () {
dhclient -v -r
killall dhclient
iwconfig $wlan essid $essid
dhclient -v $wlan
}
ifconfig $eth down
ifconfig $wlan up
startWifi
while [ 1 ]; do
ping -c 1 $router_ip & wait $!
if [ $? != 0 ]; then
echo -e "\n$(date) attempting restart..." >> $log
startWifi
sleep 1
else sleep $check_interval
fi
done
这checkForSame()
只是确保它还没有运行。我住在乡下,家里不使用 wifi 加密,所以startWifi()
很简单。我这里的要点是逻辑(在重新启动之前对路由器进行 ping 操作并杀死以前的 dhclient),我可以报告这就像一个魅力:它确实在日志中报告偶尔重新连接,但我从未注意到任何中断(似乎发生了断开连接)当接口空闲时)。