Difference between network service and network interface


I'm a little bit confused about the difference between a network interface and network service. For example, the ifconfig utility documentation talks in terms of the network interface:

ifconfig en0

While "networksetup" is using network service:

networksetup -getinfo %network service name%

Can a single network interface have multiple network services?

Best Answer

networksetup is the CLI interface for network settings panel in System Preferences. From the man page:

The networksetup command is used to configure network settings typically configured in the System Preferences application.

ifconfig is the utility to set up a network interface. From the man page

The ifconfig utility is used to assign an address to a network interface and/or configure network interface parameters.

What you are seeing is two different methods with different nomenclature for the same thing.

networksetup is specific to macOS where ifconfig is more generic and part of the BSD core

As to your question...

Can a single network interface have multiple network services?

Yes. For instance, you can have an alias for that interface. Using actual System Prefs (because it's visually easier), I created a new service called "Ask Different Demo" to my existing interface "Ethernet"

enter image description here