CentOS7修改网卡为eth0

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7修改网卡为eth0相关的知识,希望对你有一定的参考价值。

CentOS7修改网卡为eth0


1.编辑网卡信息

[[email protected]~]# cd /etc/sysconfig/network-scripts/  #进入网卡目录
[[email protected]]# mv ifcfg-eno16777728 ifcfg-eth0  #重命名网卡名称
[[email protected] network-scripts]# cat ifcfg-eth0  #编辑网卡信息
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=eth0  #name修改为eth0
ONBOOT=yes
IPADDR=192.168.56.12
NETMASK=255.255.255.0
GATEWAY=192.168.56.2
DNS1=192.168.56.2


2.修改grub

[[email protected] ~]# cat /etc/sysconfig/grub  #编辑内核信息,添加红色字段的
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet"
GRUB_DISABLE_RECOVERY="true"
[[email protected] ~]# grub2-mkconfig -o /boot/grub2/grub.cfg  #生成启动菜单
Generatinggrub configuration file ...
Foundlinux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Foundinitrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Foundlinux image: /boot/vmlinuz-0-rescue-1100f7e6c97d4afaad2e396403ba7f61
Foundinitrd image: /boot/initramfs-0-rescue-1100f7e6c97d4afaad2e396403ba7f61.img
Done


3.验证是否修改成功

[[email protected] ~]# reboot  #必须重启系统生效
[[email protected] ~]# yum install net-tools  #默认centos7不支持ifconfig 需要看装net-tools包
[[email protected] ~]# ifconfig eth0  #在次查看网卡信息
eth0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.12  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:fe5c:7bb1  prefixlen 64scopeid 0x20<link>
        ether 00:0c:29:5c:7b:b1  txqueuelen 1000  (Ethernet)
        RX packets 152  bytes 14503 (14.1 KiB)
        RX errors 0  dropped 0overruns 0  frame 0
        TX packets 98  bytes 14402 (14.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0collisions 0


本文出自 “阳光总在风雨后!” 博客,转载请与作者联系!

以上是关于CentOS7修改网卡为eth0的主要内容,如果未能解决你的问题,请参考以下文章

Centos7.4修改网卡为eth0

修改CentOS7网卡名称为传统名称eth0格式

CentOS7修改网卡为eth0

centos7 修改网卡名称为eth0

CentOS7修改网卡名称为eth0

CentOS7修改网卡为eth0