安装好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. java同步和互斥【用具体程序说明】

    java同步和互斥[用具体程序说明]            所有对象都自动含有单一的锁,也就是所有对象都有且只有唯一的锁,所以当某个任务(线程)访问一个类A中含有sycnhronized的方法是,那么 ...

  2. blueprint的使用

    第一步:导入蓝图模块: from flask import Blueprint 第二步:创建蓝图对象: #Blueprint必须指定两个参数,admin表示蓝图的名称,__name__表示蓝图所在模块 ...

  3. word中编辑论文公式对齐问题

    这里只说在word中编辑公式时,公式居中,编号右对齐的情况. 在编辑公式时,我平时就是右对齐,然后通过敲击空格键进行公式的居中,然而这样并不美观.所以接下来学习一下: 1)首先打开视图-->标尺 ...

  4. Python Redis中Scan遇到问题

    在项目启动中需要删除redis原先相同key储存的值,所以使用scan_iter来便利相关的key,并删除. 这里需要注意两个性能问题 1. scan_iter的模糊匹配的过滤器要正确,否则会带来很多 ...

  5. BarCodeUtile

    package com.rscode.credits.util; import java.awt.image.BufferedImage; import java.io.ByteArrayOutput ...

  6. excle中表引用

  7. 解题报告 『[USACO08NOV]Mixed Up Cows(状压动规)』

    原题地址 观察数据范围:4 ≤ N ≤ 16. 很明显,这是一道状压DP. 定义:dp[i][j]表示队尾为奶牛i,当前含奶牛的状态为j,共有多少组符合条件的队伍. 代码实现如下: #include ...

  8. 入学java的第一天

    登录http://www.oracle.com,下载JDK(J2SE) JDK 1.0,1.1,1.2,1.3,1.4 1.5(JDK5.0) 支持注解.支持泛型 1.6(JDK6.0)Server2 ...

  9. Python练习六

    1.写函数,计算传入字符串中[数字].[字母].[空格].以及[其他]的个数,并返回结果. def day06_1(s): dic = {'num': 0, 'alpha': 0, 'space': ...

  10. 学习笔记TF057:TensorFlow MNIST,卷积神经网络、循环神经网络、无监督学习

    MNIST 卷积神经网络.https://github.com/nlintz/TensorFlow-Tutorials/blob/master/05_convolutional_net.py .Ten ...