修改CentOS 7網卡名稱

CentOS 7默認的網卡名稱是eno16777736,讓人看上去很是不爽,且一些網卡相關的操做須要輸入一長串數字,也是很是不方便。下面,將描述如何將CentOS 7網卡名稱改成咱們熟悉的eth0樣式。linux


1. 修改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

2. 重命名網卡配置文件

mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 ifcfg-eth0

此時,若是須要靜態ip,橋接等網絡功能,也能夠順便一塊兒設置了,此處不表。網絡

3. 重啓系統

systemctl reboot
相關文章
相關標籤/搜索