1818IP-服务器技术教程,云服务器评测推荐,服务器系统排错处理,环境搭建,攻击防护等

当前位置:首页 - Linux系统 - centos - 正文

君子好学,自强不息!

CentOS7系统更改网卡名为eth0

2023-02-24 | centos | gtxyzz | 6321°c
A+ A-

centOS7系统更改网卡名为eth0

1、编辑grub参数

[root@localhost ~]# vim /etc/sysconfig/grub

2、在GRUB_CMDLINE_LINUX行中添加以下红色部分参数(双引号一定要加

GRUB_CMDLINE_LINUX="crashkernel=auto "net.ifnames=0 biosdevname=0" rhgb quiet"

3、重新生成grub配置文件

[root@localhost ~]# grub2-mkconfig /boot/grub2/grub.cfg 
Generating grub configuration file ...
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

4、重启系统

[root@localhost ~]# reboot

此时运行ip addr 可以看到eth0

[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:7d:68:5e brd ff:ff:ff:ff:ff:ff
    inet 192.168.43.43/24 brd 192.168.43.255 scope global noprefixroute dynamic eth0
       valid_lft 3257sec preferred_lft 3257sec
    inet6 fe80::caaa:d49f:54d3:32cd/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    link/ether 52:54:00:6e:c8:cc brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
    link/ether 52:54:00:6e:c8:cc brd ff:ff:ff:ff:ff:ff

5、在网卡参数配置文件中修改网卡名

[root@localhost ~]#cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-ens33 ifcfg-eth0
[root@localhost network-scripts]# vim ifcfg-eth0 

修改文件中的NAME和DEVICE为eth0。其余参数不变。最后重启网络服务。

NAME=eth0
DEVICE=eth0
[root@localhost ~]# systemctl restart network.service

完成

CentOS7系统更改网卡名为eth0

 

本文来源:1818IP

本文地址:https://www.1818ip.com/post/32514.html

免责声明:本文由用户上传,如有侵权请联系删除!

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。