Redhat中网络启动错误解决办法( Failed to start LSB: Bring up/down networking RTNETLINK answers: File exists)

关于Redhat系列中网络启动失败的解决办法

报错: Failed to start LSB: Bring up/down networking.

            RTNETLINK answers: File exists

Redhat中网络启动错误解决办法( Failed to start LSB: Bring up/down networking RTNETLINK answers: File exists)

方法一:

  • 错误原因:和 NetworkManager 服务有冲突
  • 解决办法:关闭 NetworkManger 服务, systemct  stop  NetworkManager,并且禁止开机启动 systemctl  disable  NetworkManager

方法二:(Centos系列)

  • 错误原因:/etc/udev/rules.d/70-persistent-net.rules 文件里的MAC地址和 /etc/sysconfig/network-scripts/ifcfg-eth0的MAC地址不一致
  • 解决办法:修改 /etc/udev/rules.d/70-persistent-net.rules 文件的MAC地址,保持和 ifcfg-eth0 中的MAC地址一致

注:因为Redhat中没有 /etc/udev/rules.d/70-persistent-net.rules 这个文件

方法三: (Redhat系列)

  • 解决办法:也还是MAC地址不一致
  • 解决办法: ip  addr  查看 MAC地址, 然后把 /etc/sysconfig/network-scripts/ifcfg-enoxxxx 里的MAC地址改成一致

Redhat中网络启动错误解决办法( Failed to start LSB: Bring up/down networking RTNETLINK answers: File exists)

Redhat中网络启动错误解决办法( Failed to start LSB: Bring up/down networking RTNETLINK answers: File exists)

方法三脚本实现

#!/bin/bash
# Author: 谢公子
# Date: 2018-10-10
# Function: 对于启动网卡失败,出现 RTNETLINK answers:File exists 的解决脚本
NAME=`ifconfig | awk -F: 'NR==1{print $1}'`
MAC=`ifconfig |awk 'NR==4{print $2}'`
path="/etc/sysconfig/network-scripts/ifcfg-$NAME"
sed -i '/^HWADDR/d' $path
sed -i '$a HWADDR='$MAC'' $path
systemctl start network
status=`systemctl status network | awk 'NR==3{print $2}'`
if [ $status == 'active' ];then
echo "修复成功,网卡已经启动"
else
echo "修复失败!!"
fi

相关文章:Linux中的网络配置(nmcli、Team)

上一篇:HP Onboard Administrator 固件升级


下一篇:Python学习小纪