安装好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. Python matplotlib.pyplot

    Customize the label, title, and ticks. Add Color to bubbles Add Text & Grid

  2. [LeetCode&Python] Problem 703. Kth Largest Element in a Stream

    Design a class to find the kth largest element in a stream. Note that it is the kth largest element ...

  3. 使用Docker搭建LNMP开发环境

    1.什么是Docker Docker 使用 Google 公司推出的 Go 语言 进行开发实现,基于 Linux 内核的 cgroup,namespace,以及 AUFS 类的 Union FS 等技 ...

  4. jmeter 获取登录token

    1.在登录的请求下新建正则表达式,获取token 2.正则表达式的写法 注意:apply to 默认是选择第二个,但是有获取不到token的情况就选第一个 "accessToken" ...

  5. 连接mysql用mysql_connect不能连接

    用mysqli_connect就可以解决. mysqli_array()有连个参数,第一个是连接mysql名. php遇到这个警告Warning: Use of undefined constant ...

  6. uniapp如何将微信小程序API封装为Promise

    var SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/; var CALL ...

  7. 在java代码中控制UI界面

    public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle saved ...

  8. 在进行多次scanf时,printf输出错误

    随便一处代码,经过改正后,输出正确的 ''' #include <stdio.h> int main(){    int T;    scanf("%d",&T ...

  9. Elasticsearch2.3.4使用手册(使用存储过程做增量同步的探索)

    一.工具安装 访问官网https://www.elastic.co/downloads/elasticsearch和http://xbib.org/repository/org/xbib/elasti ...

  10. hive 非等值连接, 设置hive为nonstrict模式

    1 数据准备 create table stocks(id int, date string,price string, company string); insert into table stoc ...