The IP address is an important part of today’s IT systems. As a standard and popular protocol TCP/IP is also used for the MacOSX operating systems. The IP address is used to address a specific host in a network environment. If we are using MacOSX we may require different reasons like accessing remotely to the MacOSX or solve a network-related problem or enabling specific site access for our MacOSX.
IP or IPv4 or IPv6 Address
Before starting to explain how to find the IP addresses in MacOSX we need some general information about different IP address types.
IPv4 is the defacto and most popular protocol used for IP addresses. When the IP address is expressed it is generally referred to as IPv4. IPv4 consists of four block numbers which can start from 0 to 255. 192.168.10.200 is an IPv4 address. In the tutorial, we will list the IPv4 addresses.
IPv6 is a newer version over IPv4 which has more address range but currently not used popularly because of slow adaptation. In the tutorial, we will list the IPv6 addresses.
Find/Display IP Address with Network Manager (GUI)
The MacOSX Network Manager GUI tool provides the IP address of the system. Both the IPv4 and IPv6 are displayed on the Interfaces list. But generally, the IPv6 is not assigned and does not display. In order to open the IP address screen follow Apple Menu->System Preferences->Network.
Find/Display IP Address with ifconfig Command
The ifconfig command is a Unix command which is also used the Unix like operating systems Linux and MacOSX. In order to run ifconfig command open the Terminal command line interface via Apple Menu->Applications->Utilities->Terminal.
The output will be like below where the inet line displays IPv4 and inet6 lines displays the IPv6 addresses of the MacOSX.
ens33: flags=4163 mtu 1500 inet 192.168.146.136 netmask 255.255.255.0 broadcast 192.168.146.255 inet6 fe80::b322:6250:58a5:cf9d prefixlen 64 scopeid 0x20 ether 00:0c:29:09:b9:45 txqueuelen 1000 (Ethernet) RX packets 531927 bytes 651584563 (651.5 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 138748 bytes 11401435 (11.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Find/Display IP Address with ip Command
The ifconfig is old style command and replaced with the ip command which can be also found all Linux distributions and MacOSX. Just issue the ip command to the MacOSX terminal to get IPv4 and IPv6 addresses.
The output is like below. The inet line shows IPv4 and inet6 lines shows IPv6 addresses.
Find/Display Public IP Address with curl Command
Previously described commands will list the local system IP address which is assigned to the local MacOSX system. But systems accessing the internet generally use public IP addresses provided via their routers or internet gateway. This is called public IP address because it is addressable over the internet. This Public IP address can be displayed by using the curl command via terminal and with the help of the web site named ipecho.net.
curl ipecho.net/plain ; echo