CentOS 7默認的網卡名稱是eno16777736,讓人看上去很是不爽,且一些網卡相關的操做須要輸入一長串數字,也是很是不方便。下面,將描述如何將CentOS 7網卡名稱改成咱們熟悉的eth0樣式。linux
grub
配置文件vi /etc/sysconfig/grub
找到GRUB_CMDLINE_LINUX
這行,在後面添加net.ifnames=0 biosdevname=0
,最終效果以下:ios
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" GRUB_DISABLE_RECOVERY="true"
緊接着執行以下命令:centos
grub2-mkconfig -o /boot/grub2/grub.cfg
結果以下:bash
Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-960f6a38a735453e95ee6c9d58823cb0 Found initrd image: /boot/initramfs-0-rescue-960f6a38a735453e95ee6c9d58823cb0.img done
mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 ifcfg-eth0
此時,若是須要靜態ip,橋接等網絡功能,也能夠順便一塊兒設置了,此處不表。網絡
systemctl reboot