Results 1 to 8 of 8
  1. #1
    gatorparrots
    Guest
    If you are in a DHCP situation and find your IP address frequently changing, here is an easy way to determine it:
    ipconfig getifaddr en0
    and an alternate (albeit more convoluted method):
    ifconfig en0 inet | grep 'inet ' | awk ' { print $2 } '

    If you are behind a router and need your external IP address, issue this command:
    wget -q -O /dev/stdout http://checkip.dyndns.org/ | grep 'Current IP Address: ' | awk ' { print $4 } '
    (Of course, you would have to have wget installed in order for this to work.)

    Here is a shell script for checking your IP address and logging the results to a file:
    Code:
    #!/bin/sh
    #initialize variable
    IP=`wget -q -O /dev/stdout <a href='http&#58;//checkip.dyndns.org/' target='_blank'>http&#58;//checkip.dyndns.org/</a> | grep &#39;Current IP Address&#58; &#39; | awk &#39; { print &#036;4 } &#39;`
    # prints current IP to shell
    echo &#036;IP
    #log it
    date &#62;&#62; /private/var/log/ip.log
    echo &#036;IP &#62;&#62; /private/var/log/ip.log
    This script could be added to your crontab in order to check your IP address periodically and log the results to a file.

  2. #2
    zoe77
    Guest
    the wget on http://checkip.dyndns.org/ doesn't seem to work anymore ... did the format change or something?

  3. #3
    Get your IP address
    Graphite's Avatar
    Member Since
    Feb 25, 2003
    Location
    Tropical Island, Jealous?
    Posts
    5,279
    Specs:
    MacPro 3.0Ghz 16GB RAM, 4x256 Vid, 30''cinema display
    this thread is over a year old... i almost forgot gatorparrots existed.. theres a few otherways, if you need to find it, PM and ill show u a lil thing i came across, ide post it but it may scare a few people.

  4. #4
    zoe77
    Guest
    thanks Graphite... i'm behind a router so the wget method would suit me best.

  5. #5
    StarManta
    Guest

  6. #6
    zoe77
    Guest
    Quote Originally Posted by StarManta
    weird this site is giving me a different IP address...

  7. #7
    gatorparrots
    Guest
    Lately, I've been using this code to obtain my external IP address:
    Code:
    curl -s http://www.showmyip.com/simple/ | awk '{print $1}'
    However, if you have a Linksys BEFSR-series router, the following code is better for scripting purposes, as it obtains results in about half the time:
    Code:
    /usr/bin/curl --connect-timeout 5  -s \
               http://:$PASSWORD@$ROUTERIP/Status.htm  | \
               sed -e 's/^.*IP Address://'              | \
               sed -e 's/=2>/\\
    /'                                                  | \
               sed -e '1 d'                             | \
               sed -e 's/<.*//'

  8. #8
    Get your IP address
    witeshark's Avatar
    Member Since
    Mar 09, 2004
    Location
    Miami FL
    Posts
    2,860
    Specs:
    G4 1Ghz OS X 10.4.7
    You can also get it by running sheilds up to compare...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Self-assigned IP address/no IP address, internet connection issue
    By leechalmers in forum Internet, Networking, and Wireless
    Replies: 7
    Last Post: 06-07-2013, 11:33 PM
  2. MAC address/Hardware address/Physical address HELP
    By CogitoEAS in forum OS X - Operating System
    Replies: 5
    Last Post: 05-28-2013, 11:06 PM
  3. e-mail address deleted from Address Book
    By Alwyn in forum OS X - Apps and Games
    Replies: 3
    Last Post: 07-25-2012, 11:02 AM
  4. Underlining an email address in address book
    By Sepikboi in forum OS X - Operating System
    Replies: 1
    Last Post: 09-23-2011, 05:02 AM
  5. Urgent help...Synchronizing my phone/PDA address to the macbook address book!!!
    By Digitalsoul in forum Other Hardware and Peripherals
    Replies: 4
    Last Post: 08-14-2007, 10:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •