|
Question : Determining IP address
|
|
I'm running a FBSD-4.2 with ADSL connection.
My problem is that my IP keeps changing every now and then because the link drops. I have scripts that bring the connection automatically up (perl) but when the IP changes, there is no way to find out from outside what the ip was changed to (i.e. im travelling and want to connect home).
This wouldnt be a problem if my ISP wouldnt be such a slavedriver. You see, I cannot get DNS info from outside servers. All DNS requests are blocked and forwarded to the local server, which always returns the ADSL box's own intranet IP, which is completely useless because it's translated when entering the outside world.
If I take a telnet/ssh connection to somewhere from my local machine, and check where I'm connected from (like 'who'), I get the IP-address which I can use to connect back from anywhere out in the world - but I want to determine that IP withOUT connecting outside interactively. Like do it via script and send it to myself via smsgateway or something.
Summa summarum : How to determine, from the local machine, the IP you're going to get when you connect to the outside world, without interactive help.
Is perl the solution? Is there some way to open a TCP connection to some fubar server outside and let it tell you where I'm connected from?
Thanks in advance for any hints.
~/Acidia
|
Answer : Determining IP address
|
|
> I get an address from NAT pool to connect outside.
When you try to use TELNET or your web-browser to connect to a host on the large-I Internet, your ISP's NAT-server opens a "tunnel" through their server, so that the IP-address being exposed to the TELNET-server or the web-server is that of the server, not the IP-address assigned to your computer by the ISP.
Note that somebody on the Internet, who tries to make a connection to the "exposed" IP-address will connect to the NAT-server, because there is no "tunnel" from "outside" going into your ISP's network, and to your computer.
> My ISP has made it very difficult to have a static hostname for the IP.
Difficult, or impossible? Can you upgrade to a different plan to get a "static" IP-address, i.e., a full-time bidirectional "tunnel" through their NAT-server to your computer?
> My DNS works like so, that whenever I want to check > some IP, and try to use an external nameserver, > it forwards through our own DNS first.
No, it does not (and it cannot) work that way.
For example:
$ nslookup > server ns.austin.ibm.com. Default Server: ns.austin.ibm.com Address: 192.35.232.34
> www.ibm.com. Server: ns.austin.ibm.com Address: 192.35.232.34
Name: www.ibm.com Addresses: 129.42.18.99, 129.42.19.99, 129.42.16.99, 129.42.17.99
The above request used my ISP's DNS-servers to find the IP-address for 'ns.austin.ibm.com', but then it went _directly_ to that DNS-server to find the IP-address(es) for 'www.ibm.com'.
> If I try to query my ip (even when I've found out it > already) it returns the one in my DSL-box, which is > completely useless because it's used only inside this network.
Correct. That's what a NAT-server is supposed to do.
> I submitted to the dhis.org and see what they can provide, > BUT still I'm curious about this.
They won't be able to help -- without an IP-address _directly_ "exposed" to the Internet, they cannot do anything useful.
> I tried to go to a web-page that shows my IP, well - > again, everything goes through a transparent proxy > that caches everything, hence it returns the IP address > of the current cache-server.
Which web-browser are you using? Has your ISP (or have you) configured it to use your ISP's cache-servers? Can you reconfigure to "no-proxy" mode?
> Really, the only solution is to create a TCP socket > connection to some telnet, ssh, ftp whatever port, > and make it tell you where you're connected from.
No, even that won't help. It will always show the IP-address of the ISP's NAT-server.
> TELNET/SSH to some open server, and again grep from > who or something similar my IP.
That won't help, e.g.,
$ telnet mx-rr.home.com. 25
220 mx6-w.mail.home.com ESMTP Sendmail 8.11.1/8.11.1; Sun, 18 Feb 2001 09:09:26 -0800 (PST) helo world 250 mx6-w.mail.home.com Hello h24-177-110-24.cincy.rr.com [24.177.110.24], pleased to meet you quit
The hostname and IP-address are of the NAT-server.
That's the whole point of using NAT -- to "hide" a pool of IP-addresses "behind" a NAT server.
|
|
|
|