Ubuntu重启网络/etc/init.d/networking restart报错
Linux版本:Ubuntu 12.04
配置网口后重启网络,提示/etc/init.d/networking restart is deprecated。
$ sudo /etc/init.d/networking restart
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces... [ OK ]
在网上搜了半天,找到几种方法试了下。
一种说法是/etc/init.d/networking restart已被废弃,只保留/etc/init.d/networking start|stop,但测试结果表明stop|start可用性更差。
执行sudo /etc/init.d/networking stop后,除了loopback其它网卡都被停掉(有时会直接死机……),而且无法通过sudo /etc/init.d/networking start再启动,只能重启系统。
一种方法是先更新iptables再重启网卡
$ sudo iptables-save
$ sudo /etc/init.d/networking restart
但结果依然报错,跟直接执行/etc/init.d/networking restart一样。
还有一种方法是用命令service networking restart替代/etc/init.d/networking restart。
zlf@zlf:/etc/init.d$ service networking restart
stop: Unknown instance:
start: Rejected send message, matched rules; type="method_call", sender=":1.94" (uid= pid= comm="start networking ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="" destination="com.ubuntu.Upstart" (uid= pid= comm="/sbin/init")
zlf@zlf:/etc/init.d$ sudo service networking restart
stop: Unknown instance:
networking stop/waiting
区别是报错信息不同了,但目测也不起作用。
只好撸起袖子自己干了,打开/etc/init.d/networking看了看,这是个shell脚本,对restart的处理实际用的命令是ifdown -a和ifup -a。
case "$1" in
start)
/lib/init/upstart-job networking start
;;
stop)
check_network_file_systems
-------略过------- force-reload|restart)
process_options log_warning_msg "Running $0 $1 is deprecated because it may not enable again some interfaces"
log_action_begin_msg "Reconfiguring network interfaces"
ifdown -a --exclude=lo || true
if ifup -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
;;
man一下ifdown和ifup,ifdown可以停止正在运行的网口,而ifup可以启动在/etc/network/interfaces文件中配置并标有auto的网口,auto表示开机自动启动。
ifdown -a
Bring down all interfaces that are currently up.
ifup -a
Bring up all the interfaces defined with auto in /etc/network/interfaces
于是试了试sudo ifdown -a,sudo ifup -a,网卡重启成功。
所以,对需要重启的网口,先确认/etc/network/interfaces配置中有auto标识,然后用ifdown -a | ifup -a实现重启。
比如eth0的配置
auto eth0
iface eth0 inet dhcp
----下略----
严重吐槽:一个小小的网卡重启功能,被Ubuntu改得鸡飞狗跳!
参考资料
http://www.jscto.net/html/109.html
http://comments.gmane.org/gmane.linux.debian.user/390797
Ubuntu重启网络/etc/init.d/networking restart报错的更多相关文章
- ubuntu重启网络报错
执行:gw@ubuntu:/$ /etc/init.d/networking restart 报错:stop: Rejected send message, 1 matched rules; type ...
- ubuntu 重启网络方法--通过杀死进程重启网络
重启网络方法(通过杀死进程方式,达到网络重启) zh@zh:~$sudo NetworkManager restart //查看进程idNetworkManager 已正运行(pid 10254)zh ...
- ubuntu 下service php5-fpm restart 报错 stop: Unknown instance: 解决
问题描述: 在安装完扩展后,重启php-fpm,发现一直停止报错 stop: Unknown instance: 通过查看进程,也查询不到该主进程 解决办法: 干掉现在正在执行的进程 pkill ph ...
- Ubuntu下安装了java但启动eclipse报错说没装java
参考资料:http://blog.csdn.net/happyteafriends/article/details/8290950 一.问题 在Ubuntu下安装了java并在~/.bashrc配置了 ...
- ubuntu安装mysql遇到的坑----解决Mysql报错缺少libaio.so.1
最近学习大数据,涉及到hive的部分需要安装mysql,于是就在linux环境下尝试安装,对于我这个linux小白来说,中间遇到很多坑爹问题,在这里做一个记录. 我参考的mysql安装博客: http ...
- service network restart 报错重启失败
Job for network.service failed because the control process exited with error code. See “systemctl st ...
- Centos7网络配置,vsftpd安装及530报错解决
今天在虚拟机安装CentOS7,准备全新安装LTMP,结果又是一堆问题,不过正好因为这些出错,又给自己长了见识. 1,CentOS7网络配置 最小化安装CentOs7后,ifconfig提示comma ...
- Ubuntu下开启php调试模式,显示报错信息
在Ubuntu下php的缺省设置是不显示错误信息的,如果程序出错会显示“无法处理此请求的错误提示”,这在开发环境下非常不方便. 其实我们只要编辑下apache的配置文件就好 1.我的apache 配置 ...
- 【Linux】Ubuntu vi 上下左右变ABCD及 apt-get install报错问题解决方法
新装的ubuntu12.04,本人绝对新手,在使用VI编辑器编辑文本时觉得实在是难用,因此找了几个解决方法如下: 1. 安装vim full版本 由于Ubuntu预安装的是tiny版本,就会导致我们在 ...
随机推荐
- 跟我一起玩转FineUI之嵌套表格
最近一直在研究FineUI(http://www.fineui.com/),那么什么是FineUI呢,FineUI是基于 ExtJS 的专业 ASP.NET 控件库.创建 No JavaScript, ...
- WebSocket在ASP.NET MVC4中的简单实现 (该文章转自网络,经尝试并未实现,请大神指点。)
WebSocket 规范的目标是在浏览器中实现和服务器端双向通信.双向通信可以拓展浏览器上的应用类型,例如实时的数据推送.游戏.聊天等.有了WebSocket,我们就可以通过持久的浏览器和服务器的连接 ...
- Zend studio 12.5.1安装aptana
aptana是zend studio的一个插件.解决zend对于前台html支持,加亮的问题. 安装方法其实很简单 ,直接给出aptana的地址了. http://download.aptana.co ...
- 使用jquery插件报错:TypeError:$.browser is undefined的解决方法
关于$.browser browser就是用来获取浏览器基本信息的. jQuery 从 1.9 版开始,移除了 $.browser 和 $.browser.version , 取而代之的是 $.sup ...
- 怎么手写Ajax实现异步刷新
所谓的异步刷新,就是不刷新整个网页进行更新数据. 只有通过js才能实现Ajax,进而实行异步刷新 表单提交数据和Ajax提交数据的区别:表单提交是提交的整个页面中的数据,提交数据之后会抛弃之前的页面( ...
- Swift - Property ''not initialized at super.init call
Property ''not initialized at super.init call 这个错误应该挺常见的的,为什么在百度上没有找到呢,stack over flow找到了,也不能说是什么解决办 ...
- (转)对DotNet分布式应用搭建的考虑
设计前的考虑和准备工作 1 对业务需求的理解重要性远远胜于对技术架构的理解 2 架构包含技术架构和业务架构 3 没有万能和通用的架构,只有符合自身业务需求的架构 4 架构本身的复杂性要截至在架构设计阶 ...
- python自定义日志函数测试
#!/user/bin/python # -*- encoding: UTF-8 -*- import sys def logs(): print sys._getframe().f_code.co_ ...
- 《Apache服务之php/perl/cgi语言的支持》RHEL6——服务的优先级
安装php软件包: 安装文本浏览器 安装apache的帮助文档: 测试下是否ok 启动Apache服务关闭火墙: 编辑一个php测试页测试下: perl语言包默认系统已经安装了,直接测试下: Apac ...
- EDK中如何使用ISE中生成的IP
EDK中如何使用ISE中生成的IP: 网上上有说这个的文章,但是很复杂,也就是添加bdd文件,其实这些都不需要自己操作的,我们可以在EDK中import 中添加ngc文件,ngc文件就是core ge ...