华子雄 發表於 2023-7-21 00:00:00

Centos7更改网卡名称Eth0的方法

<p>
        本文介绍了centos7更改网卡名称eth0的方法,分享给大家,希望对大家有所帮助</p>
<p>
        安装完centos7系统,网卡命名跟之前发生了变化,例如!</p>
<p>
        就是看着不爽也不会影响使用,只是个网卡名称而已。</p>
<p>
        eno16777736<img style="max-width:100%!important;height:auto!important;"title="Centos7更改网卡名称Eth0的方法" alt="Centos7更改网卡名称Eth0的方法" src="https://zhuji.jb51.net/uploads/img/202305/969462805900e2d50a49ece0fb7f1cc3.jpg"></p>
<p>
        1.先编辑网卡的配置文件将里面的name device项修改为eth0</p>
<p>
        vim /etc/sysconfig/network-scripts/ifcfg-eno16777736 </p>
<p>
        <img style="max-width:100%!important;height:auto!important;"title="Centos7更改网卡名称Eth0的方法" alt="Centos7更改网卡名称Eth0的方法" src="https://zhuji.jb51.net/uploads/img/202305/5d8dcb1b77b4af721df93816c77659ee.jpg"></p>
<p>
        2.重命名该配置文件。</p>
<p>
        #  cd /etc/sysconfig/network-scripts/<br>
        # mv ifcfg-eno16777736 ifcfg-eth0</p>
<p>
        3.禁用该可预测命名规则。对于这一点,你可以在启动时传递“net.ifnames=0 biosdevname=0 ”的内核参数。这是通过编辑/etc/default/grub并加入“net.ifnames=0 biosdevname=0 ”到grubcmdlinelinux变量来实现的。</p>
<p>
        # vim /etc/default/grub </p>
<p>
        <img style="max-width:100%!important;height:auto!important;"title="Centos7更改网卡名称Eth0的方法" alt="Centos7更改网卡名称Eth0的方法" src="https://zhuji.jb51.net/uploads/img/202305/60d7280787bec6aa0a6977640d9b6d43.jpg"></p>
<p>
        4.运行命令grub2-mkconfig -o /boot/grub2/grub.cfg 来重新生成grub配置并更新内核参数。</p>
<p>
        # grub2-mkconfig -o /boot/grub2/grub.cfg </p>
<p>
        <img style="max-width:100%!important;height:auto!important;"title="Centos7更改网卡名称Eth0的方法" alt="Centos7更改网卡名称Eth0的方法" src="https://zhuji.jb51.net/uploads/img/202305/827a72e2bc0fe7fd3a3f40dc2853b89e.jpg"></p>
<p>
        5.重新启动机器,启动完之后网卡名称就变成了eth0</p>
<p>
        # init 6</p>
<p>
        <img style="max-width:100%!important;height:auto!important;"title="Centos7更改网卡名称Eth0的方法" alt="Centos7更改网卡名称Eth0的方法" src="https://zhuji.jb51.net/uploads/img/202305/2206127f5dc1b1a91115d3f11275fcad.jpg"></p>
<p>
        重启完之后,验证!</p>
<p>
        <img style="max-width:100%!important;height:auto!important;"title="Centos7更改网卡名称Eth0的方法" alt="Centos7更改网卡名称Eth0的方法" src="https://zhuji.jb51.net/uploads/img/202305/2dd5bb9bbec44f344d101610fd7ae88e.jpg"></p>
<p>
        重启系统,验证!技术一般 水平有限 还望以后大家多多指点! </p>
<p>
        以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。</p>
<p>
        原文链接:http://blog.csdn.net/fanhonooo/article/details/53494100</p>
頁: [1]
查看完整版本: Centos7更改网卡名称Eth0的方法