安装好centos7版本的系统后,发现默认的网卡名字有点怪,为了便于管理,可以手动修改。下面对centos7版本下网卡重命名操作做一记录:
1)编辑网卡信息
[root@linux-node2~]# cd /etc/sysconfig/network-scripts/                             #进入网卡目录
[root@linux-node2network-scripts]# mv ifcfg-eno16777728 ifcfg-eth0          #将默认的网卡名eno16777728改为eth0
[root@linux-node2network-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
[root@linux-node2~]# cat /etc/sysconfig/grub                  #编辑内核信息,添加红色字段的
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=autorhgb net.ifnames=0 biosdevname=0 quiet"
GRUB_DISABLE_RECOVERY="true"

[root@linux-node2~]# 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)验证是否修改成功

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@linux-node2~]# reboot                           #必须重启系统生效
[root@linux-node2~]# yum install net-tools                   #默认centos7不支持ifconfig 需要看装net-tools包
[root@linux-node2~]# 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 64 scopeid 0x20<link>
 
ether 00:0c:29:5c:7b:b1 txqueuelen 1000 (Ethernet)
 
RX packets 152 bytes 14503 (14.1 KiB)
 
RX errors 0 dropped 0 overruns 0 frame 0
 
TX packets 98 bytes 14402 (14.0 KiB)
 
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

centos7启动网卡服务报错“RTNETLINK answers: File exists”的解决方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@localhost network-scripts]# service NetworkManager stop
Starting network (via systemctl):  Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
 
[root@localhost network-scripts]# systemctl status network.service
?.network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network)
   Active: failed (Result: exit-code) since Mon 2017-03-20 18:41:03 CST; 3min 49s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 18880 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
 
Mar 20 18:41:03 localhost.localdomain network[18880]: RTNETLINK answers: File exists
Mar 20 18:41:03 localhost.localdomain network[18880]: RTNETLINK answers: File exists
Mar 20 18:41:03 localhost.localdomain network[18880]: RTNETLINK answers: File exists
Mar 20 18:41:03 localhost.localdomain network[18880]: RTNETLINK answers: File exists
Mar 20 18:41:03 localhost.localdomain network[18880]: RTNETLINK answers: File exists
Mar 20 18:41:03 localhost.localdomain network[18880]: RTNETLINK answers: File exists
Mar 20 18:41:03 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Mar 20 18:41:03 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Mar 20 18:41:03 localhost.localdomain systemd[1]: Unit network.service entered failed state.
Mar 20 18:41:03 localhost.localdomain systemd[1]: network.service failed.
 
原因分析和解决:
在centos下出现该故障的原因是启动网络的两个服务/etc/init.d/network 和 /etc/init.d/NetworkManager有冲突。
从根本上说是NetworkMaganager(NM)的带来的冲突,停用NetworkManager即可解决。重启即可。
[root@localhost network-scripts]# service NetworkManager stop
Redirecting to /bin/systemctl stop  NetworkManager.service
[root@localhost network-scripts]# systemctl start network.service
[root@localhost network-scripts]#
 

参考链接:https://www.cnblogs.com/kevingrace/p/5570274.html

Centos7修改默认网卡名(改为eth0)以及网卡启动报错RTNETLINK answers: File exists处理的更多相关文章

  1. Linux启动网卡时出现RTNETLINK answers: File exists错误解决方法

    这里说一下,如果复制了虚拟机,设置新的MAC地址为什么? 在虚拟机的网络设置中--->高级.然后找到如下窗口,生成新的MAC地址即可. ----------------------------- ...

  2. vbox克隆虚拟机,网卡启动报错“Device eth0 does not seem to be present”

    vbox克隆虚拟机,网卡启动报错"Device eth0 does not seem to be present". 须要看以下三个地方:确保文件名称,设备名.mac地址都一致. ...

  3. Win7下nginx默认80端口被System占用,造成nginx启动报错的解决方案

    Win7下nginx默认80端口被System占用,造成nginx启动报错的解决方案   在win7 32位旗舰版下,启动1.0.8版本nginx,显示如下错误:  [plain] 2012/04/0 ...

  4. linux查看与修改交换内存配置(解决zabbix-agent启动报错)

    问题 zabbix-agent在一台centos6.5上启动报错: cannot allocate shared memory of size 949056: [28] No space left o ...

  5. yum安装命令:遇到的问题报错如下: File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: 通过看报错可以了解到是使用了python2的语法,所以了解到当前yum使用的Python2,因为我单独安装了python3,且python3设置为默认版本了,所以导致语法问题 解决方法: 使用python2.6 yum install

    1.安装zip yum install -y unzip zip 2.安装lrszs yum -y install lrzsz 3.安装scp 遇到下面的问题: 结果提示: No package sc ...

  6. windows修改系统登录密码后,出现SQLserver服务无法启动,启动报错17051

    windows修改系统登录密码后,出现SQLserver服务无法启动,启动报错17051具体报错如下: 根据错误提示,去到windows的事件查看器.在win10上,右击左下角的菜单图标:然后依次点击 ...

  7. 修改Centos7的网卡ens32 改为eth0

    1. 修改网卡配置文件 vim /etc/sysconfig/network-scripts/ifcfg-eno16777984 修改下面两个配置项 NAME=ens32 DEVICE=ens32 改 ...

  8. centos7修改默认网卡名称

    问题场景: 使用centos7有好一阵子了,安装过centos7的朋友都会发现网卡命名跟6.x系统的不一样,类似ifcfg-eno16780032, ens192,或者enp2s0等其他不习惯的.不容 ...

  9. CentOS7修改默认启动级别

    如上个随笔所言,Linux分为7个启动级别: 0 - 系统停机状态 1 - 单用户工作状态 2 - 多用户状态(没有NFS) 3 - 多用户状态(有NFS) 4 - 系统未使用,留给用户 5 - 图形 ...

随机推荐

  1. 【消息中间件之RabbitMQ学习】-开篇-001

    写在前面的话 项目中因为要用到消息中间件,当初极力推荐RabbitMq.但因为种种原因,最终选型为java+mongodb自实现一套分布式的消.没有用RabbitMq工作过,实属遗憾.因为个人来说实在 ...

  2. Ubuntu 将其他盘挂载到/home的子目录下

    Ubuntu 14.04 将其他盘挂载到/home的子目录下当安装完Ubuntu系统,由于当时没有注意,分配的分区空间太小.经过一段时间安装了各式各样的软件后,常常会遇到/home目录下空间不够的情况 ...

  3. govendor 无法添加.h文件

    例如:github.com\ethereum\go-ethereum\crypto\secp256k1 是一个CGO项目 通过govendor add +external只能引入secp256k1下的 ...

  4. Python学习之路基础篇--07Python基础+编码、集合 和 深浅Copy

    1 小数据池(节省内存) 只有数字和字符串中内存,储存在同一个内存地址中 数字的范围在-5~256中,字符串有以下两个特点:不能含有特殊字符,还有就s*20 不是同一个地址,而要*21就不是了 2 编 ...

  5. contos7搭建syslog服务端与客户端

    搭建中心服务端1,编辑文件/etc/rsyslog.conf,找到以下内容,将前面的#注释符合去除#$ModLoad imtcp#$InputTCPServerRun 514 2,在/etc/rsys ...

  6. C++实验七

    #include <iostream> using namespace ::std; int main() { ios_base::fmtflags original_flags = co ...

  7. vue day8 table page

    @{ ViewBag.Title = "Home Page"; Layout = null; } <!DOCTYPE html> <html> <he ...

  8. Appium环境搭建——安装以及运行appium server失败点总结

    一.运行Appium失败:未安装.Net Framework 4.5 之前安装AppScan安全测试工具时,就要求.Net 4.5以上环境,我其中一台电脑的系统是Win7-32bit的,安装.Net ...

  9. 经典问题----最小生成树(kruskal克鲁斯卡尔贪心算法)

    题目简述:假如有一个无向连通图,有n个顶点,有许多(带有权值即长度)边,让你用在其中选n-1条边把这n个顶点连起来,不漏掉任何一个点,然后这n-1条边的权值总和最小,就是最小生成树了,注意,不可绕成圈 ...

  10. python练习题3:N的多次方

    N的多次方 描述 编写一个程序,计算输入数字N的0次方到5次方结果,并依次输出这6个结果,输出结果间用空格分隔.其中:N是一个整数或浮点数. print()函数可以同时输出多个信息,采用如下方法可以使 ...