Ubuntu上的服务工具deoes不能正常工作

这是我的情况
root@skd:~# service networking restart
restart: Unknown instance:

当我这样做
root@skd:~# service networking stop
stop: Unknown instance:

现在如果我这样做

 /etc/init.d/networking stop * Deconfiguring network interfaces... Ignoring unknown interface eth1=eth1. [ OK ] 

注意上面我没有使用服务命令,它显示工作。

现在如果我以同样的方式启动它,我会收到警告。

 /etc/init.d/networking start Rather than invoking init scripts through /etc/init.d, use the service(8) utility, eg service networking start Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the start(8) utility, eg start networking networking stop/waiting 

在任何情况下, service命令或使用/etc/init.d/networking重启都不会做任何事情。 它不起作用,也没有启动。它是与Ubuntu 10.04的问题,服务实用工具无法正常工作?

我深入了解了这个问题,发现以下两条命令将帮助您find系统上的活动。

 status networking status network-manager 

(状态是“initctl状态”的简称)或

 service networking status service network-manager status 

就我而言,这是上面的第二个命令

 status network-manager network-manager start/running, process 1096 

一旦你确定哪一个是主动的(以适用者为准):

 restart networking/restart network-manager 

(重启是“initctl restart”的简称)或者

 service networking restart/service network-manager restart network-manager = Network Manager controls the NIC configuration networking = /etc/network/interfaces controls the NIC's configuration 

两者都是不同的。所以如果我重新启动networking,它不会有任何作用,因为networkingpipe理器是活跃的。值得一看的文件是/ etc / init(这不同于init.d)

Ubuntu 10.04使用networking启动脚本的新贵系统,所以理论上restart networking应该是重启的方法。 但它似乎没有工作。 /etc/init.d/networking stop; /etc/init.d/networking start /etc/init.d/networking stop; /etc/init.d/networking start工作。 (从这个话题来看,这个问题似乎是新手对某种程序的需求 – http://osdir.com/ml/ubuntu-users/2009-11/msg03490.html

从一开始就显示的错误,我认为你可能在/ etc / network / interfaces中有一个错字。 有关设置文件的信息,请参阅此链接:

https://help.ubuntu.com/10.04/serverguide/C/network-configuration.html#static-ip-addressing

请参阅接口手册页以了解选项的完整分类。 一旦你运行一个启动时,这个错误不存在,你应该是好的。

另一种select是使用ifdown和ifup来重新启动接口。 所以像这样:

 ifdown eth0 && ifup eth0 

或者,如果您当前使用SSH,则使用no​​hup可能是个好主意,因此即使SSH丢失,也可以重新启动:

 nohup sh -c "ifdown eth0 && ifup eth0"