CentOS7修改网卡名称,禁用ipv6

时间:2021-11-01 14:29:08

有时候新装的CentOS7系统网卡默认名称是eno16777736,为方便改成传统eth0

修改网络配置文件

# cd /etc/sysconfig/network-script/
# vim ifcfg-eno16777736
#修改NAME和DEVICE为eth0
# mv ifcfg-eno16777736 ifcfg-eth0

修改grub参数

# vim /etc/default/grub
#添加net.ifnames=0 biosdevname=0
GRUB_TIMEOUT=
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 net.ifnames=0 biosdevname=0 ipv6.disable=1 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

重新加载grub,重启生效

# grub2-mkconfig -o /boot/grub2/grub.cfg
# shutdown -r now