Check Your IP Address in Mac Terminal

Your Mac has both an internal (private) IP address, used to communicate with devices on your local network, and an external (public) IP address, which is used to communicate with devices outside your network.

In this tutorial, we’ll cover how to find both your internal and external IP addresses using the Mac Terminal.

Checking Your Internal (Local) IP Address

Your internal IP address is the one assigned to your Mac by your router for communication within your local network. To check your local IP address, you can use the ipconfig command in the Terminal.

Using ipconfig to Check Local IP Address

To find the IP address of your Wi-Fi or Ethernet connection, you will need to specify the correct network interface.

You can get the list of interfaces using the command:

ipconfig getiflist

Use the following commands to get your local IP address:

ipconfig getifaddr en1

This will return your internal IP address for your Wi-Fi connection, such as:

192.168.1.101
Check Your IP Address in Mac Terminal - Internal (Local) IP Address

If en1 interface did not return IP address, then with other interface names.

ipconfig getifaddr en0

Checking Your External (Public) IP Address

Your external (public) IP address is assigned by your Internet Service Provider (ISP) and is used when communicating with devices outside your local network. You can easily find this address using the curl command to query an external service.

Using curl to Check External IP

To check your public IP address, run the following command in the Terminal:

curl ifconfig.me

This will return your public IP address, such as:

123.45.67.89
Check Your IP Address in Mac Terminal - External (Public) IP Address

Other similar services include:

  • curl icanhazip.com
  • curl ident.me

These commands will also return your public IP address by querying an external web service.

Conclusion

By using simple Terminal commands, you can easily check both your internal and external IP addresses on a Mac. Whether you need to troubleshoot network issues or simply understand your network configuration, these commands provide a quick and effective way to access the necessary information.