首页 > 系统相关 >Centos7修改默认网卡名(改为eth0)以及网卡启动报错RTNETLINK answers File exists处理

Centos7修改默认网卡名(改为eth0)以及网卡启动报错RTNETLINK answers File exists处理

时间:2024-03-27 22:36:32浏览次数:36  
标签:03 20 network web 网卡 报错 File root

安装好centos7版本的系统后,发现默认的网卡名字有点怪,为了便于管理,可以手动修改。下面对centos7版本下网卡重命名操作做一记录:

1.编辑网卡信息
[root@web~]# 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@web~]# 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@web~]# 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)验证是否修改成功
[root@web~]# reboot     #必须重启系统生效[root@web~]
[root@web~]# yum install net-tools          #默认centos7不支持ifconfig 需要看装net-tools包

[root@web~]# 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”的解决方法

 [root@web] # 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@web] # 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@web] # service NetworkManager stop 
Redirecting to  /bin/systemctl stop NetworkManager.service  [root@web] # systemctl start network.service 

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

标签:03,20,network,web,网卡,报错,File,root
From: https://www.cnblogs.com/nwq1101/p/18100465

相关文章

  • Java 程序性能分析利器:IDEA Profiler,相见恨晚
    一个javawebapi,耗时2s,但是db300ms就返回了,时间到底耗费在哪里呢。当我最终定位下来,是因为db返回了5M数据跨局域网传输大概需要1s,导致的。一行行跟踪源码,很耽误时间。后来遇到了IDEAProfiler(IDEAIDE自带的性能分析工具),简直太好用了。https://www.jetbrains.com/pag......
  • How to use the smb function of Babyfile App (connect Mac computer)
    1.Mac computer "SystemSettings"->"General"->"Sharing" reachthepagebelow(ordirectlysearchfor"FileSharing"onthesystemsettingspagetoreachthepage).Thenclickthebuttonshownin①2.Then......
  • Dockerfile
    DockerfileDockerfile简介Dockerfile是用来构建Docker镜像的文件,可以理解为命令参数脚本。Dockerfile是面向开发的,想要打包项目,就要编写Dockerfile文件。命令以上面的centos官方镜像的Dockerfile为例。FROMscratchADDcentos-7-docker.tar.xz/LABELorg.lab......
  • 【Azure Cloud Service】部署云服务时候遇见 Last exit code: 0. Last role exception
    问题描述部署云服务时候遇见Lastexitcode:0.Lastroleexception:(System.IO.FileNotFoundException)错误,提示无法加载System.Runtime。Recoveringrole...Applicationstartuptask0finishedsuccessfully.Lastexittime:[2024/03/27,20:23:31.142].Lastexit......
  • 关于QGIS报错问题
    一·QGIS下载官网:WelcometotheQGISproject!(一些可用的旧版本下载地址:Indexof/downloads)点击进入下载页面:进入下载界面后你会看到有两个QGIS版本(3.36,3.34),3.36是最新的版本,3.34是相对稳定的版本,下载完成后双击文件,根据引导进行QGIS文件(建议将文件保存位置为D盘,一般......
  • tomcat 启动报错javax.naming.NameNotFoundException: 名称[xxx.LoginFilter/xxxServi
    本地测试没问题,部署到服务器上的tomcat,启动报错javax.naming.NameNotFoundException:名称[xxx.LoginFilter/xxxService]未在此上下文中绑定可能是由于在Tomcat的配置文件中,资源名称[xxxx]没有正确配置或者引用。为了解决这个问题,你可以尝试以下步骤:1、检查你的Tomcat配置文......
  • 下载folium库的时候使用pip命令持续报错
    解决方案pip3install-ihttps://pypi.tuna.tsinghua.edu.cn/simpleyou-get(是你要安装的库的名字)吐血了按了一个小时,总是显示 但是更新嘛有更新不了,Python中使用pip安装一些库时出现ERROR:Couldnotfindaversionthatsatisfiestherequirementyou-get-知乎(zhi......
  • WARN o.a.t.util.scan.StandardJarScanner - Failed to scan [file:/D:/Mavencangku/
    1、SpringBoot项目启动突然报错2024-03-2714:57:41[restartedMain]WARNo.a.t.util.scan.StandardJarScanner-Failedtoscan[file:/D:/Mavencangku/com/sun/xml/bind/jaxb-core/2.3.0/jaxb-api.jar]fromclassloaderhierarchyjava.io.FileNotFoundException:D:\Maven......
  • dolphinscheduler任务报错,日志显示dataX说脏数据过多了?
    经DataX智能分析,该任务最可能的错误原因是: com.alibaba.datax.common.exception.DataXException:Code:[Framework-14],Description:[DataX传输脏数据超过用户预期,该错误通常是由于源端数据存在较多业务脏数据导致,请仔细检查DataX汇报的脏数据日志信息,或者您可以适当调大......
  • .net6 core web项目发布部署到IIS,以Windows服务的形式部署启动,报错1053,报1067错误解
    安装NuGet包Microsoft.Extensions.Hosting.WindowsServices  varbuilder=WebApplication.CreateBuilder(newWebApplicationOptions{ContentRootPath=AppContext.BaseDirectory,Args=args});//Addservicestothecontainer.builder.Services.Add......