A network location is a set of network services in a particular order. So two network locations can differ by including different sets of network services or by including the same networking services but in a different order.
You might have only one network location, “Automatic”. networksetup -listallnetworkservices
will list the network services of your current network location. There’s also a GUI in System Preferences. There’s more info at How to Use Network Location and Create and manage Network Location.
The service order of the network services determines which service macOS will prefer if multiple services are connected. A connected service gets a green indicator in Network preferences. (Services can also b enabled/disabled from the CLI, or made active/inactive from the GUI.)
A network service is a group of settings for a particular network port (see Add a Network Service). So for instance, one network service could represent the WiFi port configured to use DHCP, while another service represents the same WiFi port configured with a particular static IP address.
networksetup -getinfo “Wi-Fi”
will list the information associated with the network service Wi-Fi
, for example.
networksetup -listnetworkserviceorder
will list the network services of your current network location, in service order, along with their associated hardware port, device, and whether they are enabled. You can also modify the service order from the gear icon in Network preferences.
A network port represents a physical networking device which is available on the system and might be configured by a network service. A hardware network port represents a physical device and has a user-facing name, like “Wi-Fi” or “Thunderbolt 1”. Every hardware port is associated with one network interface device.
networkstup -listallhardwareports
will list all the machine’s hardware ports with their associated interface devices and Ethernet addresses.
An interface device is a network interface, either physical or virtual, as defined at the Darwin level of the OS.
ifconfig
will show the names and statuses of all these interfaces. These are the names used by netstat
and route
to explore and modify the routing table, or by scutil
when it reports on network interfaces. Physical Wi-Fi or ethernet interfaces often have names like en0
. The virtual interface ppp0
appears to represent a point-to-point interface, e.g., to a VPN network. Various obscure interfaces hang around innocuously for the system’s own purposes, like gif0
, stf0
, utun0
, etc..