macOS
Apple’s macOS is the operating system used by every Macintosh computer. There are three ways to display physical and interface addresses on macOS computers: the GUI, the CLI, and the System Information application.
System Preferences
Open the System Preferences app and select the Network icon. Figure 4-8 illustrates the resulting dialog.
FIGURE 4-8 The macOS Network Configuration Dialog
Select either the Ethernet port or a port labeled LAN (Local Area Network) for the wired connection. Fields of note include
IPv4 Address: The IPv4 address assigned to the interface.
Subnet Mask: The subnet mask, which indicates the network prefix. In this case, the subnet mask is 255.255.255.0, so the prefix length is /24.
Router: The default gateway.
DNS Server: The IP address of the server this host will use to resolve domain names.
If you remember the reserved IP addresses from Chapter 2, you will recognize the address 127.0.0.1 as a loopback address; any packets sent to this address loop back to the host. Some hosts set the DNS server to a loopback address and then use an internal process to capture and process DNS packets.
If you select the dropdown next to Configure IPv4, you can select to configure the IPv4 address either Using DHCP or
Using DHCP with a manual address, which means you will manually configure an IP address on this interface, but DHCP will be used to discover the correct DNS server and default gateway.
Using BootP, which uses an older, largely deprecated protocol called BootP to configure the IP address, default gateway, etc.
Manually, which means you will insert the correct IP address, default gateway, and other information in the fields in the dialog.
Selecting the Advanced option and then the Hardware tab results in the dialog shown in Figure 4-9.
FIGURE 4-9 The Advanced Hardware Tab
The Hardware tab shows the physical address for this interface.
The Terminal Command Line
Like most other hosts, Apple Macintosh computers have a command line you can use to examine and configure network parameters. You can typically find an application called Terminal under Applications, Utilities in the Finder app. Once you have launched the terminal, you can display the network configuration using ifconfig, as shown in Figure 4-10.
FIGURE 4-10 macOS ifconfig
A lot of information here will not look familiar because macOS provides a lot more information from the physical interfaces than Windows does (there are ways to get this information in Windows, but they involve using different commands than ifconfig). Most of this information, however, is not very useful for the average operator.
The important fields are
en0 is the service name of the interface.
ether bc contains the physical address.
inet6 contains the IPv6 interface address and prefix length.
inet contains the IPv4 interface address and subnet mask.
The output does not include the default gateway.
If you need to release and renew the DHCP-assigned IP address in macOS, you use a pair of commands:
sudo ipconfig set en0 BOOTP; sudo ipconfig set en0 DHCP
Make sure you replace en0 with the correct interface name. This first command sets the interface to retrieve a new IP address via the bootp protocol and forces the interface to release the DHCP learned address. Since bootp is no longer widely used, the interface will (most likely) not have an address once the first command is run.
The second command tells the host to request a new DHCP address from the server.
In macOS, unlike Windows 11, you can use the ifconfig command to set the IP address for an interface manually. However, because macOS manages IP addresses as part of a central configuration system configd, any address you set using ifconfig will be overwritten by configd.
You can tell configd to change the IP address on an interface using the command networksetup.
System Information
Finally, you can find information about network configuration in the System Information application, customarily located under Utilities in Finder. Two sections contain information on wired network interfaces: Ethernet and Network Locations.
Figure 4-11 shows the information in the System Information Ethernet section.
FIGURE 4-11 Ethernet Section of System Information
The Ethernet section of System Information displays information about the physical connection. This Ethernet port connects through a USB port, has a physical interface (MAC) address, and can support up to a 5 Gb/s data rate and the physical interface (MAC) address.
Figure 4-12 shows the correct section of the Locations tab, located under the Network portion of the System Information app.
FIGURE 4-12 Network Locations Section of System Information
The information displayed here is like that displayed in other places in macOS.