centos7修改网卡命名规则eth0

CentOS7是CentOS项目的一个发行版,它是一个基于Red Hat Enterprise Linux(RHEL)7的社区支持的操作系统。CentOS是一个免费的、开源的操作系统,它与RHEL兼容,但由社区维护。

解决

1.修改grub命名规则
/etc/sysconfig/grub
在"GRUB_CMDLINE_LINUX"变量最后新增 net.ifnames=0 biosdevname=0

2.重新生成grub配置并更新内核参数
grub2-mkconfig -o /boot/grub2/grub.cfg

3.重启
reboot/systemctl reboot

4.nmcli修改网卡显示名字及设置网络
nmcli dev
nmcli connection modify Gi0 connection.id ethx  //rename network name

nmcli connection modify eth0 ipv4.addresses '172.25.X.10/24' ipv4.gateway 172.16.0.1
nmcli connection modify eth0 ipv4.dns '172.24.254.254'
nmcli connection modify eht0 ipv4.method manual

reference