LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-26-2008, 01:44 AM   #1
toynbee
Member
 
Registered: Jan 2007
Location: Maryland
Distribution: Arch and Red Hat
Posts: 34

Rep: Reputation: 17
Ways to View External IP


Hey guys,

I, as many others, have dynamic DNS setup to point to my home. There are several domains directed to my house (one is spice.ignorelist.com, the other is spiceweb.ignorelist.com, which is a port redirect from :80 to spice.ignorelist.com:90)

I have so far been unable to determine why this is, but spiceweb.ignorelist.com almost always works, even when spice.ignorelist.com is not redirecting properly. Due to this, I would like to setup a simple PHP page that will fetch my external IP and display it so that I can connect remotely on ports other than 90. However, the only plausible way I have been able to think of that would do this would be something like this:

http://pastebin.org/32068

However, I have my doubts about whether this would work (if nothing else, wouldn't this leave a links session open for every time the page was accessed?). Alternatively, if you can make any suggestions as to why my dynamic DNS is not working properly, I would appreciate it, but I recognize that that question is something I should ask the owner of my nameservers. Any help would be appreciated.
 
Old 04-26-2008, 04:09 PM   #2
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
Well, I had never tried to do this, but I just pointed my browser at http://whatismyip.org and got back a page with my external IP on it and nothing else. Will that do?
 
Old 04-26-2008, 05:47 PM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
To be honest, this sounds more like a web server configuration problem than an IP problem. What I'm really confused about is why you have spiceweb.ignorelist.com running on port 90, when it looks to me like virtual servers would solve the problem entirely and not require a bunch of port redirections. If you could fill us in on what web server your using and how you've got it configured, we might be able to sort this out a bit.
 
Old 04-26-2008, 10:35 PM   #4
toynbee
Member
 
Registered: Jan 2007
Location: Maryland
Distribution: Arch and Red Hat
Posts: 34

Original Poster
Rep: Reputation: 17
Hey guys,

I might not have explained this as well as I could have; whatismyip.org does show the external IP of the network accessing it, which is beautiful, exactly what I want. The problem is how to write a script that will show the IP when viewed from a webpage at my home; this way, even if my other DDNS isn't working, I can still SSH, RDC, FTP, whatever, in. spiceweb.ignorelist.com does not provide that functionality because ping/nslookup just returns the IP of the server that does the port redirect, which is not mine.

I have spiceweb.ignorelist.com on port 90 because Verizon blocks any requests coming over port 80, and unfortunately I can't come up with any way to access it through that block.
 
Old 04-27-2008, 06:45 AM   #5
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
The problem is how to write a script that will show the IP when viewed from a webpage at my home; this way, even if my other DDNS isn't working, I can still SSH, RDC, FTP, whatever, in. spiceweb.ignorelist.com does not provide that functionality because ping/nslookup just returns the IP of the server that does the port redirect, which is not mine.
There is a small but fatal problem in your logic here. If your DDNS isn't working, you need to know your IP address in order to see the page that would show you your IP address. A nasty little problem. I haven't dealt with Verizon at all, but on Comcast, my IP address almost never changes. If that is also true with Verizon, you could just write down your IP address and not worry about parsing web pages.

Quote:
I have spiceweb.ignorelist.com on port 90 because Verizon blocks any requests coming over port 80, and unfortunately I can't come up with any way to access it through that block.
You can run your webserver on ports other than 80 you know. If you're using Apache, you just need to modify the Listen directive in your httpd.conf file and have it listen to whatever port you want. Then you can use virtual servers and not mess around with port redirection.
 
Old 04-27-2008, 01:08 PM   #6
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
According to my PHP manual, there is a predefined variable available to you that should do what you want: $_SERVER['SERVER_ADDR'}
 
Old 04-28-2008, 02:51 AM   #7
toynbee
Member
 
Registered: Jan 2007
Location: Maryland
Distribution: Arch and Red Hat
Posts: 34

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Hangdog42 View Post
There is a small but fatal problem in your logic here. If your DDNS isn't working, you need to know your IP address in order to see the page that would show you your IP address. A nasty little problem. I haven't dealt with Verizon at all, but on Comcast, my IP address almost never changes. If that is also true with Verizon, you could just write down your IP address and not worry about parsing web pages.
I realize I'd need to know the external IP to access my site; the thing is, spiceweb.ignorelist.com always works, for reasons that I do not understand. Since the website will always load, if I can devise a way to make it show my IP, I can remotely access my IP address by any method I want and not worry whether my other DDNS service is up. I cannot do this with spiceweb.ignorelist.com because the IP of that is only the redirect server, not my home server. And unfortunately, with Verizon, my IP seems to change every other week -- otherwise I wouldn't worry about it, as you said.


Quote:
Originally Posted by Hangdog42 View Post
You can run your webserver on ports other than 80 you know. If you're using Apache, you just need to modify the Listen directive in your httpd.conf file and have it listen to whatever port you want. Then you can use virtual servers and not mess around with port redirection.
I don't need virtual servers because I only have a very few pages I'm interested in seeing, but I already modified the Listen directive to listen on port 90. I appreciate the pointer though.

dkm999, I appreciate your advice as well, but I just tried your idea and unfortunately it only displays my server's internal IP address. :-( Thank you though.
 
Old 04-28-2008, 06:38 AM   #8
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
the thing is, spiceweb.ignorelist.com always works, for reasons that I do not understand.
You really should investigate what is going on with this domain, because its behavior is more than strange. If your IP address is changing on a weekly basis, then the IP associated with spiceweb.ignorelist.com must be changing with equal frequency, and something has to be doing it. Do you have an automated cron job that grabs your external IP address and updates the DNS servers? I use no-ip.com and they distribute a program that will do that. If something similar is working on your system for just spiceweb.ignorelist.com, you might be able to duplicate it for your other domains.

Quote:
I don't need virtual servers because I only have a very few pages I'm interested in seeing,
The reason I've been pushing on this is because both of your sites are based on ignorelist.com, and since spiceweb.ignorelist.com works all the time, there is no reason that spice.ignoreweb.com shouldn't work the same way unless you've done something with virtual servers that is causing the issue.

As far as grabbing the external IP address, do you know any perl or bash? Both of those would be able to do the trick of parsing the whatsmyip.com web page.
 
  


Reply

Tags
dns, dynamic, external, ip, php, webserver



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
View As HTML / View As Text button craig467 Programming 4 01-22-2008 04:54 PM
KDE Konqueror View Mode Icons (Image Preview/Tree View) sadarax Linux - General 7 06-27-2006 12:45 PM
Tryying to keep Konqueror in "Detailed List View", but it always reverts to Icon View jlinkels Linux - Software 3 05-16-2006 08:45 PM
how to view movies that only windows media player can view? servnov Linux - General 7 02-08-2006 10:42 AM
W2K cannot view samba share but can view NT FiveFlat Linux - Software 3 06-10-2005 02:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:28 PM.

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