問題描述:
配置網(wǎng)絡(luò)時鼓黔,很多新手運行ifconfig命令查看網(wǎng)卡時央勒,會發(fā)現(xiàn)我們熟悉的eth0網(wǎng)卡沒有了,或是發(fā)現(xiàn)一些不規(guī)則命名的東東澳化,不錯崔步,那就是你的網(wǎng)卡。
因為內(nèi)核升級(忘記具體哪個版本了)從udev-197將自動分配更好的接口,網(wǎng)卡的命名改變了缎谷。
參考資料:http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
從開機(jī)信息中可以看到提示:
dmesg |grep network
[ 74.261872] systemd-udevd[14259]: renamed network interface wlan0 to wlp2s0
[ 74.391865] systemd-udevd[14259]: renamed network interface eth0 to enp0s4
解決方法:
- 使用老的命名方式(eth×):
使用原來的網(wǎng)卡名字eth0,重置udev的rules:
方法一: 在kernel命令行選項里使用net.ifnames=0
方法二:新建空文件文件/etc/udev/rules.d/80-net-name-slot.rules或注釋掉里面內(nèi)容
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
或
touch /etc/udev/rules.d/80-net-name-slot.rules
- 使用新的網(wǎng)卡名字:
rm /etc/udev/rules.d/80-net-name-slot.rules
rm /etc/init.d/net.eth0 #刪除不存在的引用
rc-update delete net.eth0 default #刪除不存在的開機(jī)啟動
cd /etc/init.d
ln -s net.lo net.enp0s3
rc-update add net.enp0s3 default #使用新名字