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

发布时间:2024-03-28 点击:102
这篇文章主要解决ubuntu换网卡或者mac地址改变时网络不可用,网卡启动不起来的问题,特别是在我们使用虚拟机的时候。
在ubuntu系统中,网络接口的名称被记录在/etc/udev/rules.d/70-persistent-net.rules文件中。以下是正常系统中的网卡信息。
# 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:80", 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:c6", attr{dev_id}=="0x0", attr{type}=="1", kernel=="eth*", name="eth0"在ubuntu 中,通常有线网卡为eth0,无线网卡则为wlan0,后续增加的以此类推。上面记录了两张网卡信息,有线网卡的信息在最后叫“eth0”的记录里面。如果我们换了网卡或者mac地址,eth0肯定就启动不起来了。所以解决办法很简答,删除这个记录或者直接删除/etc/udev/rules.d/70-persistent-net.rules这个文件,然后重启一下系统就可以了。
root@test:~# ?rm f?/etc/udev/rules.d/70-persistent-net.rulesroot@test:~# reboot


域名注册 1元陷阱有哪些
虚拟主机无备案
阿里云服务器上挂软件步骤
商家入驻小程序-其他问题
北京企业建站公司需要多长时间?如何自己建立一个公司网站?
华为云服务器怎么传文件在哪里
虚拟主机能远程桌面吗
云计算技术推动供应链管理发展的5个原因