Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.networking > #2887

Re: Accessing devices behind a router

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.os.linux.networking
Subject Re: Accessing devices behind a router
Date 2014-04-04 09:01 +0200
Organization A noiseless patient Spider
Message-ID <lhlld2$pda$1@dont-email.me> (permalink)
References <lh7s3s$kdn$1@news.albasani.net> <lhkmdu$9qc$1@news.albasani.net>

Show all headers | View raw


On 04/04/14 00:13, Clark Smith wrote:
> On Sun, 30 Mar 2014 01:30:36 +0000, Clark Smith wrote:
> 
>> I am connected to the Internet by means of a modem/router M that exposes
>> a single IP address to the world. Behind M I have a number of devices
>> (PCs, phones, tablets) that can access the Internet without any
>> problems.
>>
>> 	Let's assume two such devices - e.g. a PC P and tablet T. P can
>> reach T, and vice-versa, when both use their respective IP addresses in
>> my LAN. So far so good.
>>
>> 	There is a port forwarding rule in M so that any HTTP connections
>> received from the Internet at M are automatically forwarded to P.
>> Obviously, if I want to access my web server in P from T when T is in my
>> WiFi (and therefore in my LAN) T will just use P's IP address in my LAN.
>>
>> 	My question is, why can't I access the web server at P from T,
>> when T is my WiFi, if T uses the IP address exposed by M? Is this an
>> intrinsic limitation in my setup, or in the way TCP/IP networking works
>> (I am admittedly networking-challenged)? Or is it the case that I can
>> somehow change M's configuration so that this would work?
> 
> 	Thanks everybody for your feedback. I think I may have misled  
> you guys by talking about IP addresses alone, while ignoring DNS names. 
> With this in mind, here is another, apparently simpler, suggestion that 
> has come my way:

I assume you mean the suggestion in my post?  Your wording here makes it
look like you didn't read it, but got the suggestion elsewhere.

> 
> 	Set up a caching/forwarding DNS server in P, so that it would 
> forward all DNS queries from my LAN to M - except for one: Whenever a 
> query is received from my LAN to resolve the name N associated with the 
> IP exposed by M, N would be resolved by P itself as its own IP address in 
> my LAN. 
> 
> 	With this setup, if a) T is in my WiFi, and b) has received its 
> IP address by DHCP from some system in my LAN (which may be P itself, or 
> even M) at the same time getting P's (or M's internal) IP address as that 
> of the DNS server to use, then applications in T could use N from inside 
> my LAN, just as they would when in the external world - which is what I 
> am after.

That's the aim.

> 
> 	Now I know how to set up a caching/forwarding BIND DNS server. 

No sane person sets up BIND.  It is mind-numbingly complex to configure,
and regularly discovered to have serious security problems (although
since your DNS server will not be accessible from outside your own
network, this is a minor concern).  Use dnsmasq - it is mind-numbingly
simple to work with.

> What I do not know how to do is to configure it so that it will resolve 
> N, and only N, itself, while forwarding all other non-cached queries to 
> M. Is this at all doable? 

Set up dnsmasq as a caching proxy.  Put your ISP as the upstream server
rather than M - or consider using Google's DNS servers (some people
prefer them to their ISP's for various reasons) or OpenDNS (that will
let you do things like block "sites unsuitable for the kids" at the DNS
level, if you are interested in that).  Put the external DNS name for
your server into P's hosts file - the hosts file gets first priority
before sending queries upstream.

Then make sure that each machine has P as their DNS server (P itself
should have 127.0.0.1 in /etc/resolv.conf).  You should be able to do
that by putting the setting into M, so that it is given out along with
IP addresses by DHCP.  Alternatively, disable DHCP on M and use P as the
DHCP server (it's a single line configuration in dnsmasq).  That will
also mean that your DNS server knows about the local names of
DHCP-allocated machines on your network.

> 
> 	I guess that if all systems in my LAN were Linux systems then I 
> could simply use /etc/hosts. However, once we start adding tablets and 
> phones into the mix that stops being feasible.
> 

That is what I said in my earlier post - did you read it?

Back to comp.os.linux.networking | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing devices behind a router Clark Smith <noaddress@nowhere.net> - 2014-03-30 01:30 +0000
  Re: Accessing devices behind a router Richard Kettlewell <rjk@greenend.org.uk> - 2014-03-30 08:30 +0100
    Re: Accessing devices behind a router David Brown <david.brown@hesbynett.no> - 2014-03-30 13:33 +0200
      Re: Accessing devices behind a router Pascal Hambourg <boite-a-spam@plouf.fr.eu.org> - 2014-03-30 14:09 +0200
        Re: Accessing devices behind a router David Brown <david.brown@hesbynett.no> - 2014-03-31 09:22 +0200
  Re: Accessing devices behind a router Clark Smith <noaddress@nowhere.net> - 2014-04-03 22:13 +0000
    Re: Accessing devices behind a router David Brown <david.brown@hesbynett.no> - 2014-04-04 09:01 +0200
      Re: Accessing devices behind a router Jorgen Grahn <grahn+nntp@snipabacken.se> - 2014-04-04 16:33 +0000
        Re: Accessing devices behind a router David Brown <david.brown@hesbynett.no> - 2014-04-06 14:26 +0200
      Re: Accessing devices behind a router Clark Smith <noaddress@nowhere.net> - 2014-04-04 19:20 +0000
        DNS caching servers [Was: Accessing devices behind a router] Ian Zimmerman <itz@buug.org> - 2014-04-08 10:32 -0700

csiph-web