Command line method to enable or disable network connectivity in OSX

I often bind my iPhone using Wifi Hotspot, and from time to time the connection stops working. To fix this, I need to enable and disable the hotspot, and then enable / disable Wi-Fi on MBP (OSX 10.8.3).

I was hoping to automate this on MBP. Do you know a command line method for this? The team should turn off Wi-Fi (if it is turned on), and then turn it back on (slightly different from a simple Wi-Fi connection).

Thanks!

+4
source share
1 answer

You can do this with ifconfig :

$ sudo ifconfig en1 down    # take network interface down
$ sudo ifconfig en1 up      # bring it back up again

, WiFi en1 - , en1 en2 , .

+2

All Articles