Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 07:04
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to get external IP address? [SOLVED]
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
wuwei


Joined: 15 Sep 2007
Posts: 774
Location: de

PostPosted: Mon 03 Jan 2011, 09:15    Post_subject:  How to get external IP address? [SOLVED]
Sub_title: Get IP address for use in conky
 

This question relates to an old post
http://www.murga-linux.com/puppy/viewtopic.php?p=24927&sid=72e8730e87262e34dcdcca1aa48f6af3

I am trying to pick up my external IP address for conky and found this code on above page

Code:
IPADR=`wget -q "http://ipid.shat.net/iponly" -O - | sed -n 3p`

echo $IPADR


quite helpful for my non-programmer knowledge. However, the result is this:

Quote:
75.112.47.248</title></head>



As I only need the numbers upfront without < and what follows I wonder if anybody has any idea how to change the code to that end?

Very much appreciated

Edited_time_total
Back to top
View user's profile Send_private_message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9161
Location: Stratford, Ontario

PostPosted: Mon 03 Jan 2011, 10:22    Post_subject:  

Code:
IPADR=`wget -q "http://ipid.shat.net/iponly" -O - | sed -n 3p | cut -f 1 -d "<"`
Back to top
View user's profile Send_private_message 
wuwei


Joined: 15 Sep 2007
Posts: 774
Location: de

PostPosted: Mon 03 Jan 2011, 11:07    Post_subject: thanks  

Wow
this was fast rcrsn51, and all across the Atlantic.

Best of all....it works like a charm.

Thanks a million.

PS: OS in question is Wary 5.0. This code gives me the external IP. Funny is that Conky in Lupu 519 shows the internal IP when addrs eth0 is entered at the appropriate place in conky.conf. This does not work in Wary. Beats me why, but I am happy with the aforementioned result.
Screenshot attached.
conkywary.jpg
 Description   
 Filesize   149.8 KB
 Viewed   1138 Time(s)

conkywary.jpg

Back to top
View user's profile Send_private_message 
MagicZaurus

Joined: 05 Jan 2009
Posts: 88

PostPosted: Mon 03 Jan 2011, 12:19    Post_subject: Real IP  

Code:
curl whatismyip.org


This gives me my real external IP address. The code from rcrsn51 gives in my case the IP of my ISP proxy server.
Back to top
View user's profile Send_private_message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9161
Location: Stratford, Ontario

PostPosted: Mon 03 Jan 2011, 12:39    Post_subject:  

Using curl is much nicer!
Code:
IPADR=`curl whatismyip.org 2> /dev/null`
Back to top
View user's profile Send_private_message 
wuwei


Joined: 15 Sep 2007
Posts: 774
Location: de

PostPosted: Mon 03 Jan 2011, 14:39    Post_subject: external IP address  

@rcrsn51
and
@MagicZaurus

Great, curl works, too.

But why is curl much nicer?
Just a shorter code or does it use less resources? Or what?

Thanks guys.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0496s ][ Queries: 13 (0.0047s) ][ GZIP on ]