Reply
Thread Tools Display Modes
#1
Old 01-17-2007, 03:00 PM
Charter Member
Join Date: May 2000
Location: SW Side, Chicago
Posts: 41,660
How do I find my local IP on a Mac?

With Windows boxes, I type "ipconfig" to figure out what my local IP address is (in the form of 192.168.1.xxx). What would I do on a Mac or through the terminal (Unix)?
#2
Old 01-17-2007, 03:01 PM
Guest
Join Date: May 2000
Location: Brooklyn
Posts: 23,402
In the terminal, type ifconfig. The first Ethernet device is called en0 and it's probably the one you want.
#3
Old 01-17-2007, 03:02 PM
Charter Member
Join Date: Nov 2000
Location: Southeast Michigan, USA
Posts: 10,285
Open up your networking control panel. It'll be right there. Or in terminal use ifconfig with no parameters.
#4
Old 01-17-2007, 03:14 PM
Charter Member
Join Date: May 2000
Location: SW Side, Chicago
Posts: 41,660
Quote:
Originally Posted by Balthisar
Open up your networking control panel. It'll be right there. Or in terminal use ifconfig with no parameters.
Thanks much for both solutions!
#5
Old 01-17-2007, 03:41 PM
Charter Member
Charter Member
Join Date: Jan 2004
Location: Albany/Corvallis, OR
Posts: 4,211
And realize that the concept of "my IP address" is pretty dated at this point. It's very likely that you have multiples, even on a simple home machine. Parallels, for example, installs a "ghost" network adaptor with it's own IP, Bluetooth may have one depending on how you're set up, and of course there are the simple cases of having more than one network adaptor enabled.
#6
Old 01-17-2007, 04:11 PM
Charter Member
Join Date: May 2000
Location: SW Side, Chicago
Posts: 41,660
Quote:
Originally Posted by TimeWinder
And realize that the concept of "my IP address" is pretty dated at this point. It's very likely that you have multiples, even on a simple home machine. Parallels, for example, installs a "ghost" network adaptor with it's own IP, Bluetooth may have one depending on how you're set up, and of course there are the simple cases of having more than one network adaptor enabled.
I needed to know it for setting up port forwarding. It's still applicable there, right?
#7
Old 01-17-2007, 04:33 PM
Charter Member
Charter Member
Join Date: Jan 2004
Location: Albany/Corvallis, OR
Posts: 4,211
Quote:
Originally Posted by pulykamell
I needed to know it for setting up port forwarding. It's still applicable there, right?
Yes, you just need to get (a/the) right one for whatever purpose you're using. In your case, one of the ones associated with the primary network adaptor.

But if your machines are set up to get addresses dynamically, your port forwarding will only work for as long as the machines have the same address (which may change at shutdown and other times). If you want (extended time) port forwarding, you probably want to give your computers static addresses -- in which case it's easy to look up the IP address in the control panel where you set it, rather than going to the command line.
#8
Old 01-17-2007, 04:42 PM
Guest
Join Date: Aug 2001
Location: Outside of Boston
Posts: 36
This is probably more than you need, and if so, just disregard it. But recently I needed to write an AppleScript that would pop up a message with their IP address without them even having to know what System Preferences are.

In any case, I found that running the command "ipconfig getifaddr en0" was the easiest to handle--it simply returns the IP address for the default ethernet device, without all the other confusing things to sift through. It sure made it easier to write a quick AppleScript--no parsing necessary.
#9
Old 01-17-2007, 05:37 PM
Guest
Join Date: Jul 2000
Location: Philadelphia, PA
Posts: 1,177
"Default internet device" may be somewhat confusing. en0 is the built-in Ethernet. If your machine has multiple built-in Ethernet ports, then they will be numbered en1 and so on. The AirPort card, if present, is numbered after the built-in Ethernet devices. Since most Macs have one Ethernet port and AirPort capability, en0 will be the Ethernet device and en1 will be the AirPort card. You may see a fw0, that's for networking over FireWire; lo0, that's the loopback interface; and gif0 and stf0, used for IPv6 tunneling. If a dial-up link is active, there will be a ppp0 interface.
#10
Old 01-18-2007, 08:28 AM
Charter Member
Join Date: Nov 2000
Location: Southeast Michigan, USA
Posts: 10,285
Quote:
Originally Posted by Cleophus
"Default internet device" may be somewhat confusing. en0 is the built-in Ethernet. If your machine has multiple built-in Ethernet ports, then they will be numbered en1 and so on. The AirPort card, if present, is numbered after the built-in Ethernet devices. Since most Macs have one Ethernet port and AirPort capability, en0 will be the Ethernet device and en1 will be the AirPort card. You may see a fw0, that's for networking over FireWire; lo0, that's the loopback interface; and gif0 and stf0, used for IPv6 tunneling. If a dial-up link is active, there will be a ppp0 interface.
If you look at the network control panel, it will tell you which via device you are connected to the internet, if in fact your are. Not sure how to glom that programatically, though.
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:08 PM.

Copyright © 2017
Best Topics: muhammad ali iq inuit boobs superhero exclamations sexual requests tinted green chinatown hookers champagne expiry coffee sour monomolecular blade typical christmas bonus lethal dose tylenol hot girl job switchblade legality it's too quiet qvc message board snot vacuum tolkien cat charla rhines como tally vous time versus newsweek laney intervention rich passive sexually basic instinct vag sperry and hutchinson knockout drugs immune to poison susan dey anorexia amphora shape hawaii south park shinbone town ziplock microwave army batman chinese restaurant songs water bottle silencer csi bad to the bone bat shit crazy origin how heavy is chainmail usps can i pick up package at post office how did prostitutes keep from getting pregnant how to open a car trunk without a key gabriel iglesias not funny heparin shots in the stomach why are car dealerships closed on sundays does mrs dash have msg windows xp setup music sarah brightman nessun dorma youtube is the wyoming incident real it's so hot outside quotes carpet pad stuck to hardwood floor snap on tool reviews how much is a 10 pence coin worth best version of lunar where to get free scrap wood does your masters have to be related to your bachelors united states district court juror qualification questionnaire what does mamcita mean send money to paypal without paypal account columbus ohio noise ordinance can i get prescription lenses in my ray bans how many beers a day is bad for your liver ortho home defense spiders different brand tires on front and back did george washington have an accent long war terror missions what does it mean if you are never thirsty