无法在 Ubuntu 16.04 上启动提升网络接口

无法在 Ubuntu 16.04 上启动提升网络接口

我突然failed to start raise network interface在 Ubuntu 中收到错误消息。任何反馈都将非常有帮助。

我尝试了以下步骤,但问题仍然存在:

root@storage:~# systemctl stop network
Failed to stop network.service: Unit network.service not loaded.

root@storage:~# systemctl disable network
Failed to execute operation: No such file or directory

root@storage:~# /etc/init.d/networking restart
[....] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.
 failed!

root@storage:~# ping 192.168.0.227
PING 192.168.0.227 (192.168.0.227) 56(84) bytes of data.
64 bytes from 192.168.0.227: icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from 192.168.0.227: icmp_seq=2 ttl=64 time=0.059 ms
64 bytes from 192.168.0.227: icmp_seq=3 ttl=64 time=0.054 ms
^C
--- 192.168.0.227 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.022/0.045/0.059/0.016 ms
root@storage:~# 

root@storage:/home/bsaitechnosales# systemctl status networking.service
● networking.service - 提升网络接口
已加载:已加载(/lib/systemd/system/networking.service;已启用;供应商预设:已启用)
插入:/run/systemd/generator/networking.service.d
└─50-insserv.conf-$network.conf
活动:失败(结果:退出代码)自 2018-01-11 星期四 12:50:20 +0545 起; 10 分钟前
文档:man:interfaces(5)
进程:15534 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
进程:15529 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm
Main PID:15534 (code=exited, status=1/FAILURE)

1 月 11 日 12:50:20 storage ifup[15534]: 无法启动 lo。1
月 11 日 12:50:20 storage ifup[15534]: RTNETLINK 回答:文件存在
**1 月 11 日 12:50:20 存储 ifup[15534]: 无法启动 enp1s0。**
1 月 11 日 12:50:20 storage ifup[15534]: run-parts: 无法执行 /etc/network/if-up.d/iptables: 可执行格式错误
1 ​​月 11 日 12:50:20 storage ifup[15534]: run-parts: /etc/network/if-up.d/iptables 退出,返回代码为 1
1 月 11 日 12:50:20 storage systemd[1]: networking.service: 主进程退出,代码=exited,状态=1/FAILURE
1 月 11 日 12:50:20 storage ifup[15534]: /sbin/ifup: 启动后脚本失败。
1 月 11 日 12:50:20 存储 systemd[1]:无法启动提升网络接口。
1 月 11 日 12:50:20 存储系统 [1]: networking.service: 设备进入故障状态。
1 月 11 日 12:50:20 存储系统 [1]: networking.service: 故障,结果为“退出代码”。

答案1

可能有点晚了,但我遇到了同样的问题,但使用 ip6tables 时出现了错误:

$ sudo ifup ens160
run-parts: failed to exec /etc/network/if-pre-up.d/ip6tables: Exec format error
run-parts: /etc/network/if-pre-up.d/ip6tables exited with return code 1
Failed to bring up ens160.

我的/etc/network/if-pre-up.d/ip6tables看起来像这样:

ip6tables-restore < /etc/ip6tables.conf

我通过在脚本顶部添加 shebang 解决了这个问题,使其看起来像这样:

#!/bin/sh
ip6tables-restore < /etc/ip6tables.conf

现在我的界面已经可以打开了。我希望这个解决方案能帮到你(以及偶然发现这篇文章的其他人)。

答案2

就我的情况而言,这是因为一个系统中有多个网关。只需删除其中一个接口上的网关,然后尝试重新启动网络服务即可。我成功了

答案3

如果您在 VMware 中安装 Ubuntu 16.04,则可能会出现此问题。我的 Ubuntu 16.04 安装在 VMware 中,当我卸载 wincap 并在 Win7 中安装 Npcap 时,我遇到了同样的问题。因此,我卸载Npcap并安装了Wincap,这样就没问题了!

相关内容