I've been having a problem where my macbook won't reconnect to the internet after I turn off my work VPN. A simple reboot fixes this, but I was wondering if there was a way I could restart the network configs, or clear cache (not sure exactly what the problem is) from the command line - without having to do a reboot?
I've tried the following, without success
$ ifconfig en0 down && ifconfig en0 up
Is there a way to reset the network config to whatever the default values are after a reboot?
Edit: This doesn't happen every time, I'm not exactly sure what chain of events triggers it.
sudo networksetup -setnetworkserviceenabled Ethernet off; sleep 10; networksetup -setnetworkserviceenabled Ethernet onThat will disable your Ethernet, wait 10 seconds, then turn it back on.sudo networksetup -setadditionalroutes "Insert Name of Network Service here". The absence of any arguments following the service name clears all additional routes. P.S. I don't think macOS has given such low level access to interfaces that you might expect from usingifconfig, it is basically a wrapper left for compatibility at this point. Take a look atman scutilfor real fine grained control.