2

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?

3

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)
    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.)

  • 2
    wget is no standard executable in OS X/macOS. So better use curl -s ... instead of wget -qO- .... – klanomath Jan 27 '17 at 22:45
  • @klanomath Thanks for the pointer. I have updated my answer accordingly. – Synoli Jan 28 '17 at 0:56
  • Looks like you missed my point. My purpose is not to "know" my public IP address but to see which programs on my computer are "projecting" me in front of outside world and by which address . I am looking for something which will show me a list of programs sending traffic over internet from my computer with the public IP address they are showing to the world. – happy_coder Jan 28 '17 at 5:55
  • 2
    @happy_coder Programs on your computer typically don’t know your public IP address. (This is because it’s not the programs on your computer that project you to the outside world; your router does it by means of IP masquerading and NAT.) In other words, there is no list with the properties you’re looking for. Even if there was, the IP address shown would in that case be the same one as ipecho.net would give you. – Synoli Jan 28 '17 at 9:50
3

Another quick service is curl ifconfig.me

Add an echo afterwards to complete the line:

curl ifconfig.me && echo

enter image description here

  • One-line answers tend to be voted down without some form of documentation that this command works. It does work, and is very useful, but perhaps a screen cap of the result of the curl command showing the external address and a screen cap of the System Preferences > Network showing the internal address would make a more complete answer. – IconDaemon Jan 1 at 3:30
  • Also - a lot of people like short answers, so I'll edit this to clean up the screen capture. This is a super quick service to return a public IP to the command line. – bmike Jan 1 at 15:32
2

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.

  • Looks like you missed my point. My purpose is not to "know" my public IP address but to see which programs on my computer are "projecting" me in front of outside world and by which address . I am looking for something which will show me a list of programs sending traffic over internet from my computer with the public IP address they are showing to the world. – happy_coder Jan 28 '17 at 5:56
  • All programs on your computer would use the same Public IP address as would be found above. If you want a list of programs communication outside, you should check your firewall logs. – mcchots Jan 28 '17 at 9:04
  • 2
    My answer addresses your question: "Does anyone know how to see the public IP address of outgoing internet traffic leaving my computer?" --- It looks like you found the solution to your real (unasked) question, and your own added caveats that weren't addressed in the first question. – Bryan Scott Jan 29 '17 at 3:51
  • @SirBryan Imagine a case when someone is using a proxy in an application (e.g. a torrent client). Obviously, the public IP address will be different for the traffic generated by that application than other applications. So your answer assumes that my question was a simple query which anyone could find an answer to by doing a simple Google search or by just typing "My IP address" on Google! (Google gives you your IP address when you type that and you don't even need to visit the website you mentioned!!) – happy_coder Jan 30 '17 at 2:51
  • Your original question was pretty straightforward. Of course the answers are going to be simplistic, because you didn't provide this level of detail to begin with. You cannot expect responders to assume more than what you provide. – Bryan Scott Jan 31 '17 at 0:55
0

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).

  • 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 Jan 1 at 15:34
0

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.

You must log in to answer this question.

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