Linux修改网卡名为eth0

[root@server ~]# vim /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"  #在倒数第二行末尾加上"net.ifnames=0 biosdevname=0"这一串
GRUB_DISABLE_RECOVERY="true"
[root@server ~]# grub2-mkconfig -o /boot/grub2/grub.cfg #为grub.cfg文件生成刚刚配置的规则内容
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-e1c5eea352b84d7c8bc98aa1ae743769
Found initrd image: /boot/initramfs-0-rescue-e1c5eea352b84d7c8bc98aa1ae743769.img
done
[root@server ~]# reboot #重启系统
[root@server ~]# ifconfig |head -2 #改名成功,再次添加网卡,名字为eth1,eth2,eth3
eth0: flags=4163  mtu 1500
        inet 192.168.99.6  netmask 255.255.255.0  broadcast 192.168.99.255

你可能感兴趣的:(linux,linux)