CentOS 7 修改网卡名为eth0

标签: linux


笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流

CentOS7的网卡名称太长,这不符合我们的使用习惯,增加了管理难度,最简单粗暴的方法是在安装系统的时候就把网卡名改了。当然,安装好的系统也是可以修改的。下面分别介绍两种方法。

方法一:

在进入安装界面的时候把光标移动到Install CentOS7,按下tab键,在后面输入“ifnames=0 biosdevname=0”回车即可。

方法二:

进入网卡配置文件目录

[root@centos7 ~]# cd /etc/sysconfig/network-scripts/

重命名网卡

[root@centos7 network-scripts]# mv ifcfg-eno16777736 ifcfg-eth0

修改配置文件NAME、DEVICE

[root@centos7 network-scripts]# vim ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=eth0
UUID=552c01f7-fd9d-4f19-913e-379a2bf5a467
DEVICE=eth0
ONBOOT=yes
IPADDR=10.0.0.111
"ifcfg-eth0" 14L, 239C written

修改grub

sed -i.bak 's#crashkernel=auto rhgb quiet#crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet#g' /etc/sysconfig/grub
[root@centos7 network-scripts]# vim /etc/sysconfig/grub
GRUB_TIMEOUT=5
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 rhgb net.ifnames=0 biosdevname=0 quiet"
"/etc/sysconfig/grub" 7L, 263C written

生成启动菜单

[root@centos7 network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7ed5d4eebe4c43e3aadbda68cd0ef311
Found initrd image: /boot/initramfs-0-rescue-7ed5d4eebe4c43e3aadbda68cd0ef311.img
done

重启系统生效

[root@centos7 network-scripts]# reboot

查看是否成功

centos7默认没有ifconfig命令,需yum install net-tools -y安装

[root@centos7 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.111 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::20c:29ff:fe57:875c prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:57:87:5c txqueuelen 1000 (Ethernet)
RX packets 39 bytes 4887 (4.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 43 bytes 7502 (7.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

CentOS 7修改网卡名称的更多相关文章

  1. Centos 7 修改网卡名称、静态IP

    修改内核选项 # vim /etc/sysconfig/grub GRUB_TIMEOUT= GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc ...

  2. 如何在RHEL7或CentOS 7系统下修改网卡名称(亲测有效~!)

    亲测有效的更改RHEL7或CentOS 7的网卡名称的方法, 按照以下4步来操作就可以实现! Step 1 :网卡配置文件名称重命名为eth0[root@localhost ~]# ifconfige ...

  3. CentOS 7.2修改网卡名称

    #!/bin/bash #Centos7.2修改网卡名称ens33为eth0 #2017/05/19 if [ -f /etc/sysconfig/grub ];then cd cp /etc/sys ...

  4. 把CentOS 7.x网卡名称eno16777736改为eth0

    CentOS 7.x系统中网卡命名规则被重新定义,可能会是"eno167777xx"等,下面我们把网卡名称改为eth0这种. 一.cd  /etc/sysconfig/networ ...

  5. CentOS 7将网卡名称eno16777736改为eth0

    http://www.linuxidc.com/Linux/2015-09/123396.htm Linux系统版本:CentOS_7(64位) 一.前言: 今天将CentOS 6.5装回了CentO ...

  6. linux修改网卡名称

    本文转载自江一<linux修改网卡名称> 终端输入:vi /etc/udev/rules.d/70-persistent-net.rules 出现以下文件 # This file was ...

  7. Linux修改网卡名称、主机名

    Linux修改网卡名称.主机名 环境:VirtualBox 5.0.14 + RHEL 6.5 需求:个人实验搭建一套Standby RAC时,为了节约时间,直接复制之前安装RAC的主机模板. 但复制 ...

  8. ubuntu修改网卡名称ensX为eth0

    1.sudo nano /etc/default/grub 找到GRUB_CMDLINE_LINUX="" 改为GRUB_CMDLINE_LINUX="net.ifnam ...

  9. Ubuntu20 修改网卡名称

    Ubuntu 修改网卡名称 Ubuntu修改网卡名称 Ubuntu 版本: Ubuntu 20.04 查看当前网卡名称 root@it:~# ip add 1: lo: <LOOPBACK,UP ...

随机推荐

  1. 推荐一个比HtmlWebpackPlugin更灵活的插件

    插件:html-res-webpack-plugin https://github.com/lcxfs1991/html-res-webpack-plugin/blob/v3/README_ZH.md ...

  2. Java关于使用“final”修饰基本类型的注意事项

    今天无意发现这样一道题,可以先做做看: 正确答案是BCD. 至于原因有人给出了参考答案: 1.所有的byte,short,char型的值将被提升为int型: 2.如果有一个操作数是long型,计算结果 ...

  3. Nginx日常维护操作(3)

    一.简明nginx常用命令 1. 启动 Nginx /sbin/nginx   service nginx start   2. 停止 Nginx /sbin/nginx -s stop   /sbi ...

  4. Inception服务的安装以及使用Python 3 实现MySQL的审计

    Inception服务的安装以及使用Python实现MySQL的审计 Bison是Inception服务所依赖的包之一,但是某些Linux版本已安装的Bison,或者是通过yum安装的Bison,通常 ...

  5. CSS3中first-child、last-child、nth-child、nth-last-child

    1.单独指定第一个子元素.最后一个子元素的样式 <style type="text/css"> li:first-child{ background:yellow; } ...

  6. pm am 12小时格式化

    <div id="m_tiem">PM 14:26</div> tiem('m_tiem'); //pm am 12小时格式化function tiem(i ...

  7. poj_3281Dining(网络流+拆点)

    poj_3281Dining(网络流+拆点) 标签: 网络流 题目链接 题意: 一头牛只吃特定的几种食物和特定的几种饮料,John手里每种食物和饮料都只有一个,问最多能够满足几头牛的需求(水和食物都必 ...

  8. android新闻App源码、仿微信源码、地图音乐源码等

    Android精选源码 一款实用的休闲类App,新闻视频和技术应有尽有. android实现交互式K线图表源码 android新闻客户端和服务器源码 android MatetialDesign设计 ...

  9. linux下vi编辑某文件时,操作出现 错误提示: E325: ATTENTION 2, Found a swap file by the name ".p1.c.swp"

    当我在linux下用vi打开p1.c文件时 root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指针# vi p1.c 会出现如下信息: E325: ATTENTION Found ...

  10. eclipse(Version: Mars.2 Release (4.5.2)) groovy plugin install process.

    There are two way to install : First: 1.check your eclipse version:Help-->About Eclipse 2.open He ...