kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

linux菜鸡的时候,总是为了配置网络而烦恼,重启网卡的原因有很多,我这次是因为配置了固定IP【使用第三方工具连接】所以需要重启网卡,出现 Job for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details,网上搜索了一大堆,发现是自己的问题,下面一个个开始排查,centos网卡配置固定IP的可以参考此链接:https://www.cnblogs.com/pandana/p/15013554.html

1.首先重启网卡 systemctl restart networking 出现如下故障

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 2.解决方案【两个配置文件信息错误】,第一个文件是 /etc/network/interfaces【管理IP配置】,第二个文件是 /etc/resolv.conf【管理DNS】,首先查看当前的网卡信息 ifconfig 命令,如下图当前IP地址为192.168.190.137

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 3.解决第一个配置文件问题,键入命令gedit /etc/network/interfaces【使用gedit是以文本编辑器的形式打开,方便菜鸡对vi和vim是不熟练】

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 

 可以看到,上面的 interfaces 配置文件错漏百出,怎么可能重启网络服务,只能使用当前DHCP的服务了,固定ip无法配置,下面开始解决问题

①把etho【字母o】改为eth0【数字0】

②把当前的address 192.168.139.130改为192.168.190.137【当然你这里可以乱改,只要是192.168.190网段就行,具体的看个人配置,我这里改为ifconfig的就行】

③吧当前的gateway 192.168.139.1改为192.168.190.2,如何查看网关地址,如下图,先点击虚拟机菜单栏的1编辑——2虚拟机编辑器【因为我选择的是NAT模式,子网的网段为192.168.190,桥接模式需要点击右下角的更改配置】——3NAT设置

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

可以看见当前的默认网关为192.168.190.2,你也可以修改,但是我这里就不操作了。修改完成后点击右上角的Save保存然后右上角小叉退出即可

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error codkali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 为了方便水友们打错了,把etc/network/interfaces配置文件贴上,修改具体参数就行

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.190.137
netmask 255.255.255.0
gateway 192.168.190.2

 4.修改第二个配置文件,配置DNS服务的,键入命令 gedit /etc/resolv.conf

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 可以加一个外网的谷歌DNS进入,当然也可以不加,加完就保存退出。

# Generated by NetworkManager
search localdomain
nameserver 192.168.190.2
nameserver 8.8.8.8

5.两个文件修改完毕,开始重启网卡配置,命令 systemctl restart networking,发现还是不行!!不要慌,重启kali即可,键入reboot命令重启服务

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 重启之后,网络的IP地址固定下来了,当前ip确实为刚才修改的静态ip地址192.168.190.137,且重启网卡命令systemctl restart networking不再出错;

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

注:如果reboot重启之后还是出现无法获取IP的行为,那就,,,,,那就证明你的/etc/network/interfaces配置文件错了,麻烦你再认真看一遍!!!!!

kali linux重启网卡失败:Job for networking.service failed because the control process exited with error cod

 

最后,如果还是不行,麻烦你私信我,我就不信邪了,,,,。。

 

上一篇:数据结构题目1 判断括号是否准确闭合


下一篇:Netty学习之实战RPC框架