How to restart network services on Sierra?

On FreeBSD/Linux, it is possible to restart network services by restarting a daemon.

Is there something similar in macOS Sierra?


Solution 1:

You can tear down and start up the network interface using:

sudo ifconfig en0 down
sudo ifconfig en0 up

Solution 2:

Network interfaces can also be Disabled & Enabled in System Preferences‑Network.

Make Service Inactive

Solution 3:

The restarts Wi-Fi without sudo. Does anyone know how to do this with a single command?

networksetup -setairportpower en0 off
networksetup -setairportpower en0 on