|
|
simpler way
just type
ipconfig getifaddr <interfacename>Where interface name is one of the interfaces listed by typing ifconfig -aif you have a broadband or network connection, you're probably using your ethernet connection and your interface name is probably 'en0' (Ethernet card 0) This method is fast and completely local, i.e. you don't need to go make an HTTP request to get your own IP address.
Confused...
But this seems to only return the internal IP address. What if I want the external IP address? My machine sits behind a hardware router; all my internal IPs are "192.168.1.x", but my public IP is provided by AT&T. So when I hit a web site, the actual value returned is my true IP, not the internal-only (obviously) 192 version.
When I tried these commands in my terminal, all that ipconfig getifaddr en0 returned was my "192" address. I don't see any way to pull the public IP from the ipconfig data?
-rob.
Confused...
You're right, that will give you the local address. If you're behind a firewall and your address is being translated, the only way I can think of to get your address is to make a request out like you did with wget or a similar utility. That's what many dynamic DNS clients do. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|