Ubuntu Restart Network/etc/init.d/networking restart error

Source: Internet
Author: User
Tags deprecated

Linux version: Ubuntu 12.04

After configuring the gateway, restart the network, prompting/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]


Search on the internet for half a day, found several ways to try the next.

One argument is that/etc/init.d/networking restart has been discarded, leaving only/etc/init.d/networking Start|stop, but the test results show that stop|start availability is worse.
After the execution of Sudo/etc/init.d/networking stop, except for the loopback other network cards are stopped (sometimes directly crashes ...). ), and cannot be restarted by sudo/etc/init.d/networking start, only rebooting the system.

One way is to update the iptables and restart the NIC

sudo iptables-sudo /etc/init.d/networking restart

But the results are still error, as with the direct implementation of/etc/init.d/networking restart.

Another way is to replace/etc/init.d/networking restart with a command service networking restart.

[Email protected]:/etc/init.d$ Service Networking restartstop:unknown instance:start:Rejected send Message,1Matched rules; Type="Method_call", sender=": 1.94"(uid= +Pid=3847comm="Start Networking") interface="Com.ubuntu.Upstart0_6.Job"Member="Start"Error name="(unset)"requested_reply="0"destination="Com.ubuntu.Upstart"(uid=0Pid=1comm="/sbin/init")
[Email protected]:/etc/init.d$sudoService Networking Restartstop:unknown instance:networking Stop/waiting

The difference is that the error message is different, but visual inspection does not work.

Had to roll up the sleeves of their own dry, open/etc/init.d/networking looked, this is a shell script, the restart of the actual processing command is IFDOWN-A and ifup-a.

Case "$" in
Start
/lib/init/upstart-job Networking Start
;;
Stop
Check_network_file_systems
-------Skip-------

force-reload|restart) process_options log_warning_msg"Running $ 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; ThenLog_action_end_msg $?ElseLog_action_end_msg $?fi ;;


Man, Ifdown and Ifup,ifdown can stop a running network port, and Ifup can start the network port configured in the/etc/network/interfaces file and labeled Auto, Auto starts automatically.

Ifdown-a       -a       in/etc/network/interfaces


So try sudo ifdown-a,sudo ifup-a, the NIC restarts successfully.

So, for a network port that needs to be restarted, first confirm that the/etc/network/interfaces configuration has auto ID and then use ifdown-a | The IFUP-A implements a reboot.
Like Eth0 's configuration.

Auto Eth0iface eth0 inet DHCP
----slightly----

Serious spit Slot: A small network card restart function, was modified by Ubuntu chicken Fly Dog Jump!


Resources
Http://www.jscto.net/html/109.html
http://comments.gmane.org/gmane.linux.debian.user/390797

Ubuntu Restart Network/etc/init.d/networking restart error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.