Centos7重新命令网卡名
很常时间大家都在使用Centos7以前的版本,对于网卡的名称ETH0在熟悉不过了,可版本7以后改变了命名规则,很多人想用回原来的方式,缺不知道怎么修改,方法如下:
1、查看现在卡网名称
[root@xuexi ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255
2、修改网络配置文件
[root@xuexi ~]# cd /etc/sysconfig/network-scripts [root@xuexi network-scripts]# mv ifcfg-ens33 ifcfg-eth0
[root@xuexi network-scripts]# vim ifcfg-eth0 DEVICE=eth0 NAME=eth0 #修改这两项名称为eth0
3、禁用系统网络命名规则
[root@xuexi ~]#vim /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
在以上行末位添加 net.ifnames=0 biosdevname=0 #设置网络设备命名禁用,bios设备命名禁用
4、重新生成引导文件grub
[root@xuexi ~]#grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-f729f1200593457cae9fab40150fa62a Found initrd image: /boot/initramfs-0-rescue-f729f1200593457cae9fab40150fa62a.img done
5、重启验证
[root@xuexi ~]#reboot
[root@xuexi ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255
温馨提示:如无特殊说明,本站文章均为作者原创,转载请注明出处!