Ubuntu换网卡或mac地址改变时网络不可用时的解决办法

查看原文:http://www.hellonet8.com/1383.html
这篇文章主要解决ubuntu换网卡或者mac地址改变时网络不可用,网卡启动不起来的问题,特别是在我们使用虚拟机的时候。

在ubuntu系统中,网络接口的名称被记录在/etc/udev/rules.d/70-persistent-net.rules文件中。以下是正常系统中的网卡信息。

[code language="bash"]

# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.

# PCI device 0x168c:/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0 (ath9k)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="2c:d0:5a:54:3e:8
0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# PCI device 0x1969:/sys/devices/pci0000:00/0000:00:1c.3/0000:04:00.0 (alx)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="3c:97:0e:f9:ab:c
6", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

[/code]

在Ubuntu 中,通常有线网卡为eth0,无线网卡则为wlan0,后续增加的以此类推。上面记录了两张网卡信息,有线网卡的信息在最后叫“eth0”的记录里面。如果我们换了网卡或者mac地址,eth0肯定就启动不起来了。所以解决办法很简答,删除这个记录或者直接删除/etc/udev/rules.d/70-persistent-net.rules这个文件,然后重启一下系统就可以了。

[code language="bash"]

root@test:~#  rm f /etc/udev/rules.d/70-persistent-net.rules

root@test:~# reboot

[/code]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值