debian无法手动重启网卡的解决方法

系统为debian9.9,Linux debian 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux

最近在使用过程中,发现无法通过命令手动重启网卡,在网络上搜索了很多帖子,都没有解决问题。只能慢慢排查。

首先修改配置文件以后,手动重启网卡,提示如下:

root@debian:~# service networking restart
Job for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.

根据提示,输入systemctl status networking.service继续排查问题,

root@debian:~# systemctl status networking.service
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-06-13 15:27:41 CST; 2min 22s ago
     Docs: man:interfaces(5)
  Process: 765 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 760 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --r
 Main PID: 765 (code=exited, status=1/FAILURE)

Jun 13 15:27:41 debian ifup[765]: than a configuration issue please read the section on submittin
Jun 13 15:27:41 debian ifup[765]: bugs on either our web page at www.isc.org or in the README fil
Jun 13 15:27:41 debian ifup[765]: before submitting a bug.  These pages explain the proper
Jun 13 15:27:41 debian ifup[765]: process and the information we find helpful for debugging..
Jun 13 15:27:41 debian ifup[765]: exiting.
Jun 13 15:27:41 debian ifup[765]: ifup: failed to bring up eth0
Jun 13 15:27:41 debian systemd[1]: networking.service: Main process exited, code=exited, status=1
Jun 13 15:27:41 debian systemd[1]: Failed to start Raise network interfaces.
Jun 13 15:27:41 debian systemd[1]: networking.service: Unit entered failed state.
Jun 13 15:27:41 debian systemd[1]: networking.service: Failed with result 'exit-code'.
lines 1-18/18 (END)

问题出现在这里:

Jun 13 15:27:41 debian ifup[765]: ifup: failed to bring up eth0

通过ifconfig命令,发现机器不存在这个网卡,于是又返回配置文件处寻找线索。注意下图红色箭头处的代码,表示立即执行interfaces.d目录下的所有配置文件。
在这里插入图片描述
打开interfaces.d目录,只有一个setup文件,打开文件可以看到报错的eth0网卡配置,这就是无法重启网卡的问题所在,两个办法解决,1.注释掉这个不存在的网卡,2.将这个网卡名改成本地网卡名字。
在这里插入图片描述
成功重启网卡。如下:

root@debian:/etc/network/interfaces.d# service networking restart
root@debian:/etc/network/interfaces.d# 
  • 2
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值