X Chen笔记---Centos下无法上网,启动网卡时bring up interface报错

这种情况一般出现在克隆的KVM虚拟机,目前还不知道出现这种状况具体原因,问题的具体表现就是无法上网,重启网卡的时候会在bring up interface那步出错,提示“正忙稍后再试”。输入ifconfig -a显示的是eth1,但是网卡配置目录下/etc/system/network-scripts/的配置文件却是eth0,由于这种不对称才会产生这种情况。

另一种可能是第一次启动的网卡,网卡配置文件里必须要有网卡的硬件地址,否则也会无法启动网卡。


解决方法1:查看 输入ifconfig -a 命令后显示的是哪个网卡,例如eth1,然后在/etc/system/network-scripts/目录下新建一个eth1的网卡配置文件。


解决方法2: vi /etc/udev/rules.d/70-persistent-net.rules , 此文件内容类似如下:

# vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:97", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:17", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

如上黑色加粗字体为关键部分,将eth0那句删掉,将“eth1”改为“eth0”,使用 service network restart重启网卡/虚拟机即可。如果还不得,进入/etc/system/network-scripts/eth0 查看是否有网卡硬件地址,如果有则删除后再次重启网卡/虚拟机。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值