4

There is this nettop tool which shows the IP address but it doesn't show the public IP address when the Mac is connected via router - it shows the same address as we can see using System Preferences' Network option. Does anyone know how to see the public IP address of outgoing internet traffic leaving my computer?

7 Answers 7

7

Another quick service is curl ifconfig.me

Add an echo afterwards to complete the line:

curl ifconfig.me && echo

enter image description here

0
5

You can pick one of the many external services who parrot your public IP address back to you when you query them. For example,

curl -s http://ipecho.net/plain; echo

I personally use it often enough so I wrap it in a shell function called myip, inspired by a shell function from the Bash-it library:

function myip()
{
    res=$(curl -s http://ipecho.net/plain)
    echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
}

Update: I edited the answer to use curl instead of wget because the latter does not come with macOS (thanks to user klanomath for pointing this out.)

0
3

We (at work and while troubleshooting family/friends) always go to http://myipaddress.com in a web browser. As Synoli stated, there are dozens of sites out there that show you the IP address the world sees when you browse and perform other tasks.

You may find that some ISP's, especially mobile network operators like AT&T, Verizon, etc. proxy everything behind a pool of IP addresses, and very often web traffic goes through a different set of proxies than everything else.

If your network is IPv6 capable, that could complicate things, with some providers doing 6to4, carrier-grade NAT, and others passing IPv6 straight through.

0
1

Beyond

You can use the Beyond application, which I wrote, to get a list of all your IPv4 and IPv6 addresses:

Beyond.app > Window (menu) > Beyond Network

Miln Beyond

Paid users of the application can test if incoming traffic will also be routed to the Mac.

1

Another remote IP API is https://ip2location.com/ip

%> curl https://ip2location.io/ip
1.2.3.4
0

To see IPv4 (v6 not yet supported by all systems where IP address could be used, e.g. Binance won't accept v6), save to your profile:

alias myip='curl https://ipinfo.io/ip && echo'

then use:

myip
-2

Finally, I found the solution what I was looking for: nettop -L 0 > test.csv This will take infinite logs and store in test.csv file for all the applications sending/receiving traffic over network. Note that some applications when set to use proxy can use different IP address. (This is to falsify one of the comments posted here which says all the applications use the same IP address).

3
  • None of the comments or answers are wrong in my eyes. How would you have more than one public IP address with a standard network setup? There is one default gateway (two if you consider IPv6 in some cases). Perhaps an edit to show actual (or simulated but routable public IP addresses) might clarify what you see as more than one address.
    – bmike
    Commented Jan 1, 2019 at 15:34
  • Even when using a proxy, „the public IP address of outgoing internet traffic leaving my computer“ will always be the same. What will change is the IP address the target computer sees as the origin of traffic.
    – nohillside
    Commented Jan 1 at 8:35
  • Also, where in the output of nettop -L 0 to you see any public facing source IP? All I get there is the local IP (192.168.0.x) of the Mac I run this on.
    – nohillside
    Commented Jan 1 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .