LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-21-2005, 04:59 AM   #1
Rizla
Member
 
Registered: Aug 2003
Location: Bristol, Uk
Distribution: Fedora Core 4
Posts: 48

Rep: Reputation: 15
Find WAN ip from behind router


How can i find out the WAN ip of my network from a linux box within that network?
Thanks
 
Old 05-21-2005, 07:42 AM   #2
jollyjoice
Member
 
Registered: Aug 2003
Location: UK
Distribution: Gentoo 64
Posts: 383

Rep: Reputation: 30
http://www.whatismyip.com/

Only works if you don't use proxy.
 
Old 05-21-2005, 08:28 AM   #3
Rizla
Member
 
Registered: Aug 2003
Location: Bristol, Uk
Distribution: Fedora Core 4
Posts: 48

Original Poster
Rep: Reputation: 15
Yeah, i can visually find out my ip address by looking at my router settings. I need to be able to store my WAN ip so i can use it dynamically in an app i'm writing. Any other ideas?
 
Old 05-21-2005, 08:32 AM   #4
jollyjoice
Member
 
Registered: Aug 2003
Location: UK
Distribution: Gentoo 64
Posts: 383

Rep: Reputation: 30
you could write a script to extract it and save it in a txt file...
 
Old 05-21-2005, 08:45 AM   #5
Rizla
Member
 
Registered: Aug 2003
Location: Bristol, Uk
Distribution: Fedora Core 4
Posts: 48

Original Poster
Rep: Reputation: 15
I guess I could wget the page, trawl through the source, extract my ipaddress etc. I just thought that linux, in it's infinite wisdom, would have a function or pre written script that does it for you, save reinventing the wheel and all that.
Thanks again
 
Old 05-21-2005, 08:47 AM   #6
jollyjoice
Member
 
Registered: Aug 2003
Location: UK
Distribution: Gentoo 64
Posts: 383

Rep: Reputation: 30
it probably does, could you ping yourself ...??? sorry, thinking aloud again.
 
Old 05-21-2005, 08:57 AM   #7
Rizla
Member
 
Registered: Aug 2003
Location: Bristol, Uk
Distribution: Fedora Core 4
Posts: 48

Original Poster
Rep: Reputation: 15
No, traceroute will print it but still in the same position. Maybe there is a java or c function that'll do it?
Silly thing is is that this was just a time saving application and it's kinda defeating it's point now!
Thanks again
 
Old 05-27-2005, 04:19 AM   #8
Rizla
Member
 
Registered: Aug 2003
Location: Bristol, Uk
Distribution: Fedora Core 4
Posts: 48

Original Poster
Rep: Reputation: 15
Just thought i'd post some solutions i found:

Code:
wget -q -O - www.whatismyip.com | perl -pe 's/.*ip is ([^<]+).*/$1\n/ig'
OR
Code:
wget -q -O - www.whatismyip.com | cut -d' ' -f4 | cut -d\< -f1
OR
Code:
wget -q -O - www.whatismyip.com | awk '{print substr($1,index($1,"Y")) " WAN " $2 " " $3 " " sub *str($4,1,index($4,"<")-1)}'
Not sure if they all work properly but should help someone with the same problem

Cheers

Last edited by Rizla; 05-27-2005 at 04:23 AM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing packets from my WAN/Router {O_o} Linux - Security 4 10-12-2005 04:56 PM
FreeS/Wan Vs. OpenS/Wan Vs. StrongS/Wan bkankur Linux - Security 1 03-01-2005 09:27 AM
Linux router WAN Issue trees Linux - Networking 2 04-13-2004 02:20 PM
twin wan linux router?? tekhead2 Linux - Networking 0 04-12-2004 04:05 PM
IP-less sniffing on WAN side of internet router codeape Linux - Networking 18 02-17-2004 02:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration