Loading

linux环境下修改网卡为eth0

如果没有在安装系统之前传递内核参数将⽹卡名称更改为eth*,则可以在安装系统后修改
编辑vim /etc/default/grub加上这行内容net.ifnames=0 biosdevname=0

vim /etc/default/grub

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

# update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-55-generic
Found initrd image: /boot/initrd.img-4.15.0-55-generic
done

Ubuntu server还需修改网卡名称为eth0
vim /etc/netplan/01-netcfg.yaml

reboot重启即可
reboot
posted @ 2021-03-14 16:55  梨花海棠  阅读(204)  评论(0编辑  收藏  举报