restart network interface after editing /etc/network/interfaces [duplicate]

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?

2

2 Answers

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.

7

Please be aware that starting with 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.

IMPORTANT: If you are doing this through an SSH connection, it's important that you chain the commands together as shown below, because you may lose the connection to the server immediately after you flush the network interface.

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

(Source)

1

You Might Also Like