Skip to main content

When troubleshooting network issues or configuring devices, knowing your IP address can be essential. Whether you're connected via Wi-Fi, Ethernet, or tethering through a mobile provider, macOS offers powerful built-in tools to quickly identify your IP address. Here's a practical guide tailored to Australian users with step-by-step instructions.

 

Finding your IP address on Wi-Fi

If you're connected to the internet via Wi-Fi, you can retrieve your IP address with a simple command in Terminal:

ipconfig getifaddr en0

In most macOS setups, `en0` corresponds to the Wi-Fi interface. This command will return your local IP address, such as `192.168.1.10`.

 

Finding your IP address on Ethernet

For wired Ethernet connections, the interface changes to `en1` in many configurations. Use the following command:

ipconfig getifaddr en1

If this doesn't return an address, verify that your Ethernet connection is active and that the interface mapping hasn't been customised.

 

Finding your IP address when tethered to a mobile device

Mobile tethering introduces unique interfaces that differ from standard Wi-Fi or Ethernet. Depending on the connection type (USB or Wi-Fi tethering), macOS will assign an appropriate interface name, such as `en2` or `bridge0`.

1. Identify the correct interface
  Run the following command to list all active network interfaces

ifconfig

Look for an interface associated with the tethered connection. For example:

  • USB tethering may appear as en2
  • Wi-Fi tethering usually uses the same interface as regular Wi-Fi (en0)
  • Bluetooth tethering may show up as bridge0 or another variation

 

2. Retrieve the IP address

Replace `en2` in the command below with the interface identified

ipconfig getifaddr en2

This will display the local IP address assigned by your tethered device.

For Wi-Fi tethering, since it uses the same interface as Wi-Fi, the command remains

ipconfig getifaddr en0

 

3. Matching IPv4 with public IP

If your IPv6 matches but you want the IPv4 address to align with what is shown on websites like WhatIsMyIPAddress, use the following command:

curl -4 ifconfig.me

This forces the query to return your IPv4 public address rather than the IPv6 address.

Additionally, you can check both IPv4 and IPv6 together

curl ifconfig.me/all

 

Finding the primary network interface dynamically

If you're unsure which interface is currently active, you can dynamically retrieve the IP address of the default network interface

ipconfig getifaddr $(route get default | awk '/interface/ {print $2}')

This command detects the primary interface and returns the associated IP address, making it a versatile solution for various setups.

 

Checking your public IP address

Sometimes, you may need to identify your public IP address—the one visible to the internet. To do this, use a command that queries an external service

curl ifconfig.me

This will return your public IP address, which is often different from your local IP and provided by your internet service provider or mobile carrier.

To specifically retrieve the IPv4 address

curl -4 ifconfig.me

 

Tips for troubleshooting

1. List all hardware ports

If you're unsure of the mapping between interfaces and connections, use the following command

networksetup -listallhardwareports

This displays all available network ports and their corresponding interfaces.

2. Verify network status

Ensure your connection is active and properly configured. Use `System Preferences > Network` to check for errors.

3. Local vs public IPs

Remember that local IP addresses (e.g., `192.168.x.x`) are used within your network, while public IP addresses are used for external communication.

 

Related articles