[Dnsmasq-discuss] hosts resolving to public addresses not private

Chris Green cl at isbd.net
Fri Feb 17 15:59:12 GMT 2012


On Fri, Feb 17, 2012 at 10:18:48AM -0500, Brent S. Elmer Ph.D. wrote:
> I am using dnsmasq with dhcp turned on to make a wireless access point
> on a computer.  The computer is connected with a cable to a
> modem/router.
> 
> I have computer 1 connected to the modem/router, computer 2 connected to
> the modem/router with a cable.  Computer 1 is using dnsmasq without dhcp
> and it gets an ip address using dhcp from the modem/router.  Computer 2
> gets an ip address using dhcp from the modem/router connected by cable.
> Computer 2 has dnsmasq running with dhcp and also hostapd and a wireless
> card.  Computer 2 becomes a wireless access point.  Computer 3 is a
> laptop that can connect wireless to the modem/router or the computer 2
> access point.  Everything works fine as far as connecting to the
> internet.  Computer 1, 2, and 3 all resolve internet addresses.
> Computer 3 works whether connected wireless to the modem/router or the
> computer 3 wireless access point.  At any time, more computers can be
> added.
> 
> The question I would like to resolve is about the computers all talking
> to each other by name.  I can ping by name and fully qualified name any
> of the computers from any of the other computers.  The problem is that
> the ping returns the public ip address and not the private address.  As
> a result of this, using ssh for example by host name does not work.  I
> can ssh by using the private ip address.  I would like to be able to use
> things like ssh, NX, ... using host names and have them work.  Is there
> a way to have dnsmasq do this without having to statically fix hosts to
> ip addresses?
> 
> What I would like to do is set up dnsmasq to resolve local/private hosts
> to local/private addresses not public addresses.
> 
Well surely dnsmasq only comes into it when someone asks it something.

What you're seeing, I *think* is the address returned by the *router*
for the given name.

Certainly I get the LAN/internal IP addresses for all my networked
computers behind a NAT router like yours.  However all my computers are
set up to get both DHCP and DNS services from a single machine running
dnsmasq. Most (but not quite all) linux and windows systems will
correctly provide their name to the DHCP server when obtaining an IP
address.

-- 
Chris Green



More information about the Dnsmasq-discuss mailing list