61

This question already has an answer here:

restart the network service:

service networking restart

When I give the above command I get something like

stop: Unknown instance:
networking stop/waiting

I would like to know if the network services has restarted or is it showing some errors. if it is an error how to rectify it?

marked as duplicate by David Foerster, Eric Carvalho, Videonauth, George Udosen, pa4080 Oct 25 '17 at 6:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @DavidFoerster this post has been nearly 3x times as that one, and the answers there seem to be of similar quality, so why close this one instead of that? – muru Oct 25 '17 at 3:46
  • @muru: All the answers given here also exist on the linked question. We could also merge the questions which is what I requested through a mod flag. – David Foerster Oct 25 '17 at 9:32
68

After editing /etc/network/interfaces, the usual way to get the system to re-read the file and use the changes is to do:

sudo ifdown wlan0 && sudo ifup wlan0

Of course, substitute the relevant interface if it's not wlan0.

I assume Network Manager is not present on this system. If it is, you are better off to make your changes there rather than /etc/network/interfaces.

  • If within a local network managed by a firewall like shorewall, then most likely your network cards, eth0 and eth1, will have internal ip addresses, so will look something like: sudo ifdown eth0 && sudo ifup eth0 – JohnMerlino Jul 14 '14 at 22:32
  • NetworkManager isn't always could help. I.e. for unknown reasons my NetworkManager just ignores even a network existence(a network doesn't react on any change in the NetworkManager). Also I had a negative experience with NetworkManager in the fact that if a network was broken(relatively often thing in the case of my ISP), it doesn't even tell a reason. When I am configure manually I at least know that I can peek at a log file. – Hi-Angel Aug 31 '14 at 7:59
  • 1
    sudo ifdown eth0 && sudo ifup eth0 /etc/network ifdown: interface eth0 not configured RTNETLINK answers: File exists Failed to bring up eth0. – David Okwii Jun 29 '17 at 8:28
  • 1
    @DavidOkwii Please start your own new question and include your details. – chili555 Jun 29 '17 at 13:42
  • Good to know: if you're at a server restarting that same interface you are using it's NOT closing your connection (if your interface is configured ok, I guess). You are safe. – dr0i Sep 4 '17 at 9:50
16

Please be aware that at least on Ubuntu Server 16.04, you need to use the ip command to flush the interface address before restarting networking, otherwise changes in the interfaces file will not take effect:

$ sudo ip addr flush interface-name
$ sudo systemctl restart networking

I'm guessing ifdown/ifup would probably work, too, though I haven't confirmed.

This answer was taken from this helpful article

Not the answer you're looking for? Browse other questions tagged or ask your own question.