Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

OldMarketMeg

macrumors member
Original poster
Dec 19, 2016
83
3
Omaha
From Terminal, how do I find my IP address?

Based on some things I was researching last night, it appears there are a bunch of different types of IPs. :eek:
 
Last edited:
You'll need to be specific with Terminal. Your command should be "ipconfig getifaddr" then then interface name (such as en0, which you can get from ifconfig). It will come back with only the IP address.
 
You'll need to be specific with Terminal. Your command should be "ipconfig getifaddr" then then interface name (such as en0, which you can get from ifconfig). It will come back with only the IP address.

What is en0? I could use a little more guidance, please.
 
en0 is your ethernet port. If you use 802.11, the relevant interface might be en1.

Code:
Typhon:~ jeremy$ ipconfig getifaddr en0

Typhon:~ jeremy$ ipconfig getifaddr en1

192.168.1.151

However, if your ip address belongs to a private network block, you'll need to query your router for the public facing address. Routers vary.

I'm able to access mine by typing http://192.168.1.1 in my browser. Obviously, this varies depending on which private network you're on, but it's very often obtained by replacing the last octet with a one.- 10.0.0.1, 172.16.0.1 etc, etc.
 
It is a private IP address being handed out by the router. It is not visible from the internet.

Exactly what is it you are trying to find out and why?

If you want to know the IP address that is exposed to the internet, just go to http://whatismyip.com

Just be aware, that that is actually the IP address assigned to your router. The router acts as a gateway and then uses Network Address Translation ("NAT") to provide individual private IP addresses to all devices on the local LAN. These IP addresses will have IP's in the form 192.168.x.x, but are used only on the local LAN and are not visible to the internet.
 
  • Like
Reactions: OldMarketMeg
It is a private IP address being handed out by the router. It is not visible from the internet.

Exactly what is it you are trying to find out and why?

Yesterday I reading up about DNS and found some very interesting (and scary) websites about privacy. Unfortunately I accidentally closed my browser last night before bed and erased some of these unbookmarked sites. However, one that I remember was a site called DoILeak.

This site or another related one talked about this thing called "WebRTC IP Leak".

The first thing I am trying to understand is what are the different types of IP addresses a person can have?

For example, on my Mac I use a wireless hotspot to connect to the Internet since I travel a lot and like the security that my own hot spot provides.

When I ran that test above, combined with trying various commands in Terminal, I saw all of these different IP addresses and don't understand what they represent.

Does that help you understand where I am going with my questions? :(
 
According to this: https://www.privateinternetaccess.c...ome-and-mozilla-firefox-while-using-private-i WebRTC IP Leak applies only to Windows computers, not to Macs.

It must apply because I leaked!
[doublepost=1482790204][/doublepost]
It is a private IP address being handed out by the router. It is not visible from the internet.

Exactly what is it you are trying to find out and why?

If you want to know the IP address that is exposed to the internet, just go to http://whatismyip.com

Just be aware, that that is actually the IP address assigned to your router. The router acts as a gateway and then uses Network Address Translation ("NAT") to provide individual private IP addresses to all devices on the local LAN. These IP addresses will have IP's in the form 192.168.x.x, but are used only on the local LAN and are not visible to the internet.

I am lost...

I do not have a router. I have my Mac and a hot spot!

Does my hot spot have an IP address?
 
It must apply because I leaked!
[doublepost=1482790204][/doublepost]

I am lost...

I do not have a router. I have my Mac and a hot spot!

Does my hot spot have an IP address?
Everything connected to the internet has an IP address and everything that can share an Internet connection (at the consumer level anyway) works as a router.
 
Everything connected to the internet has an IP address and everything that can share an Internet connection (at the consumer level anyway) works as a router.

So you imply that my Mac has an IP, and my hot spot has an IP, and if I use a VPN then that has an IP, right?

Does anything else I use have an IP?

If I go to Starbucks to have a coffee and respond to posts on MacRumors, then does the free Wi-Fi I am using have an IP too?

(Trying to learn more an=bout how networking works.) ;)
 
So you imply that my Mac has an IP, and my hot spot has an IP, and if I use a VPN then that has an IP, right?

Does anything else I use have an IP?

If I go to Starbucks to have a coffee and respond to posts on MacRumors, then does the free Wi-Fi I am using have an IP too?

(Trying to learn more an=bout how networking works.) ;)
Yes.

(If it's online it has an IP address. Think of IP addresses like physical mailing addresses, you need one to get mail, or data)
 
Yes.

(If it's online it has an IP address. Think of IP addresses like physical mailing addresses, you need one to get mail, or data)

So an IP of 192.168.1.xx is a "private" IP and that is used by my "router" to identify computers in my personal network?
 
Last edited:
Yes, everything connected to the Internet must have an IP address. But, believe me, it gets complicated quickly.
Because IPv4 addresses have essentially been used up, there are "public" IPv4 addresses and "private" IPv4 addresses. Those computers with private IPv4 addresses must be connected to routers that have public addresses. Often times when your computer is using a private address there's no direct way for another computer to talk to your computer unless your computer talked to it first. As I said, it gets complicated. It also provides some level of security.
Then there is IPv6. A newer form of addressing that alleviates the public/private routing issue. Your computer may have multiple IPv6 addresses. For example, your cellphone likely has several IPv6 addresses associated with it already. My iPhone currently has 3 global IPv6 addresses associated with it from Verizon.
[doublepost=1482796889][/doublepost]Yes, 192.168.x.y is one range of addresses assigned to mean private addresses. There are a few other ranges as well.
 
  • Like
Reactions: OldMarketMeg
Yes, everything connected to the Internet must have an IP address. But, believe me, it gets complicated quickly.
Because IPv4 addresses has essentially been used up, there are "public" IPv4 addresses and "private" IPv4 addresses. Those computers with private IPv4 addresses must be connected to routers that have public addresses. Often times when your computer is using a private address there's no direct way for another computer to talk to your computer unless your computer talked to it first. As I said, it gets complicated. It also provides some level of security.
Then there is IPv6. A newer form of addressing that alleviates the public/private routing issue. Your computer may have multiple IPv6 addresses. For example, your cellphone likely has several IPv6 addresses associated with it already. My iPhone currently has 3 global IPv6 addresses associated with it from Verizon.
[doublepost=1482796889][/doublepost]Yes, 192.168.x.y is one range of addresses assigned to mean private addresses. There are a few other ranges as well.

So in the IPv4 world, my hot spot servess as a router, and any computer connected to it has a "private" IP that the hot spot/router uses to identify it?

So if I had three computers hooked up to my hot spot, then they might have private IPs like 192.168.1.1 and 192.168.1.2 and 192.168.1.3, right?
 
Exactly, although 192.168.1.1 is usually the private IP address of the router. (The router has two IP addresses -- a public IP address to connect to the internet and a private IP address to connect to the devices on the internal LAN.)
 
  • Like
Reactions: OldMarketMeg
IP addresses are generally associated with IP interfaces. Every active interface will have at least one IP address associated with it. For example, your cellphone will have an address assigned to the WiFi interface and a different one assigned to the cellular interface assuming both are active. The routing rules help determine which interface (and thus which address) to use with every connection.
 
  • Like
Reactions: OldMarketMeg
So in the IPv4 world, my hot spot servess as a router, and any computer connected to it has a "private" IP that the hot spot/router uses to identify it?

So if I had three computers hooked up to my hot spot, then they might have private IPs like 192.168.1.1 and 192.168.1.2 and 192.168.1.3, right?
Yes. There's also, confusingly, THREE different private address spaces. 192.168.0.0 to 192.168.255.255 is one of them. 172.16.1.1 to 172.31.255.255 is another one that's less commonly used. The third one is the entire 10.x.x.x space, frequently found in enterprise settings (or anywhere else where there's MANY computers). Have you heard of the "tracert" (trace route) command? Try it with a domain, like, say, "forums.macrumors.com", and the Terminal will print out the route your packets are taking to get there from here (your computer). Each one of those stops along the way is either a router or server of some sort, and has an IP address of its own.

And then there's the whole world of IPv6... which is a similar, yet WAY larger beast than IPv4.
 
  • Like
Reactions: OldMarketMeg
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.