Ipconfig set en1 BOOTP & ipconfig set en1 DHCPĮcho "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil Set the interface called Wi-Fi to obtain it if it isn’t already Networksetup -ordernetworkservices “Wi-Fi” “USB Ethernet”
Networksetup -setnetworkserviceenabled offĬhange the order of your network services:
Networksetup -renamenetworkservice Ethernet Wired Rename the network service called Ethernet to the word Wired: List all of the network interfaces on the system: Switch the active location to a location called Work, but also show the GUID of that location so we can make scripties with it laters: Switch the active location to a location called Work: Networksetup -createlocation Work populate Obtain the active location the system is using:Ĭreate a network location called Work and populate it with information from the active network connection:
Show a list of locations on the computer: Get information about how en0 got its dhcp on: Ipconfig getoption en0 domain_name_server Same thing, but setting and echoing a variable: For example, if you use your Ethernet port configured manually at work but via DHCP at home, you need to switch locations.After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. If you need to use the same network interface with different settings, you need to set up separate locations.
For example, if you use your Mac notebook computer with a Wi-Fi connection both at work and at home, you can just use the Automatic location, and the settings appropriate to each place is used. In many cases, you can just use the default Automatic location without setting up additional locations. (A network port, also known as a network interface, is a way your computer connects to the internet or a network-such as a modem, Ethernet, or Wi-Fi card.) The Location menu in Network Preferences lets you save and quickly switch between multiple network locations.īy default, your Mac uses the Automatic location, which automatically provides settings for any network ports that it detects are available. Connect a wireless keyboard, mouse, or trackpadĪ network location is a group of settings for a specific network port (your computer’s Ethernet port, modem port, or wireless networking port, for example).Get started with accessibility features.Use Sign in with Apple for apps and websites.Manage cookies and other website data in Safari.View Apple subscriptions for your family.Subscribe to podcast shows and channels.Sync music, books, and more between devices.Send files between devices with AirDrop.Make and receive phone calls on your Mac.Insert photos and documents from iPhone or iPad.