1. 程式人生 > >centos7 修改網卡eth0 關閉ipv6

centos7 修改網卡eth0 關閉ipv6

repos ima config cfg mark IT gravity kconfig vim

1.

先編輯網卡的配置文件將裏面的NAME DEVICE項修改為eth0

vim /etc/sysconfig/network-scripts/ifcfg-eno16777736

技術分享圖片

2.

重命名該配置文件。

[root@localhost yum.repos.d]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-eno16777736 ifcfg-eth0

3.
禁用該可預測命名規則。對於這一點,你可以在啟動時傳遞“net.ifnames=0 biosdevname=0 ”的內核參數。這是通過編輯/etc/default/grub並加入“net.ifnames=0 biosdevname=0 ”到GRUBCMDLINELINUX變量來實現的。

禁止ipv6也是在這個文件裏增加內容

[root@localhost network-scripts]# vim /etc/default/grub

技術分享圖片

4.

運行命令grub2-mkconfig -o /boot/grub2/grub.cfg 來重新生成GRUB配置並更新內核參數。

[root@localhost network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg

技術分享圖片

5.重新啟動機器,啟動完之後網卡名稱就變成了Eth0

centos7 修改網卡eth0 關閉ipv6