Re: IP routing with remote DNS, but server & client on same subnet - how?



Randy Brick MacKenna a écrit :
On Oct 17, 12:30 pm, Pascal Hambourg wrote:

1) User browses URL <http://www.foodomain.net/some/file>.
2) Browser sends a DNS query asking for the IP address of host
"www.foodomain.net".
3) DNS replies with the IP address of a registrar's web server.
4) Browser connects to that IP address on port 80 and asks for
"/some/file" on host "www.foodomain.net".
5) Web server replies that the document is actually at URL
<http://[your.public.ip.address]:32004/some/file>.
6) Browser connects to your.public.ip.address on port 32004.
7) Router transparently forwards the connection to 192.168.1.10.
8) Browser asks for page "/some/file" on that connection.
[...]
A workaround to all this would be a local DNS server resolving
www.foodomain.netinto the private web server address and having the web
server listening on port 80.

Thanks...this makes sense to me. And you are right, any subsequent
HTTP requests will fail after I pulled the plug on the cable modem.

This could be due to your your system or web browser not caching DNS replies. IIRC, by default the GNU/Linux libc resolver does not cache DNS replies. Firefox does, but other browsers may not.

So, perhaps if the cable were left plugged in then the traffic indeed
may go out through my ISP.

I tell you, though, there is a noticeable speed difference when I'm on
my home network compared to when I'm outside my home, connected back
into my home-based Linux web server. So much faster that it seems to
me that traffic 'feels' like it is staying in my local network.

This is because only steps 1 to 5 (DNS query and web redirection) communicate with the outside and take very little time and bandwidth. Once initiated, the bulk transfer does not use communication outside your LAN.

So, are you saying to really end the uncertainty, that if I ran a DNS
on my little Linux box, I could set it to always 'catch' www.foodomain.net
and point it to Apache, listening at 192.168.1.10:32004?

You could set it to have www.foodomain.net point at 192.168.1.10, but not to 192.168.1.10:32004 as DNS does not handle ports. So if your server listens on port 32004 instead of the default HTTP port 80, you would need to type www.foodomain.net:32004 in your browser. Clumsy.

(note: I don't use port 80, since when I really do want to get to
this Apache server from the outside, I need to use a different port --
since my ISP blocks hosted traffic on port 80)

I figured out there was something like that. But you could either :
- have your local server listen on both ports 80 and 32004, external connections would use port 32004 and local ones would use port 80 ;
- or have your local server listen on port 80 and your router forward incoming connections on port 32004 to port 80 on your local server. I believe most SOHO routers can do that.

Okay, I did some reading on setting up a local DNS -- but I think that
may cause some other problems. Some people mentioned that it could
screw up connections to secure websites, like banking.

I do not see how.

So, I guess maybe I'm back to the hosts file.

But, if I edit a hosts file on my XP laptop, that will be fine when
I'm connected to my home network (it will say to just map www.foodomain.net
to 192.168.1.10:32004) -- but if I use my laptop outside of my home,
when I'm traveling, and I want to get to my foodomain website -- then
that hosts file will cause it to fail, since I'm not on my home
network anymore.

Correct. That's why a local DNS server would be better IMHO. No need for the heavy BIND, something light like dnsmasq will be just fine. This may even be performed in the router.
.



Relevant Pages

  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (alt.linux)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (alt.os.linux.redhat)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (comp.os.linux.networking)
  • Re: Apache & VirtualHosts
    ... I understand that https listens on port 443.... ... >> Your browser sent a request that this server could not understand. ... To summarise, I think, WITHOUT name based virtual hosts running I can visit ...
    (comp.os.linux)
  • RE: Some technical errors
    ... If the SMTP server is not running on port 25 TCP it is not a public ... Manager - Computer Assurance Services BDO Chartered Accountants & ...
    (Security-Basics)