[Dnsmasq-discuss] DNS on localhost

Ramon Hofer hoferr at ee.ethz.ch
Wed May 29 06:57:43 BST 2013


Hi Simon

On Tue, 28 May 2013 14:05:44 +0100
Simon Kelley <simon at thekelleys.org.uk> wrote:

> On 27/05/13 15:03, Ramon Hofer wrote:
>
> > I want to use the dns on the localhost where dnsmasq runs. So I have
> > set up dnsmasq that all hosts get an IP and are related to a
> > hostname in dnsmasq.conf. It looks like this:
> >
> >   bogus-priv
> >   interface=eth1
> >   dhcp-range=192.168.72.250,192.168.72.254,12h
> >   dhcp-host=xx:xx:xx:xx:xx:xx,host-2,192.168.1.2,48h
> >   ...
> >   dhcp-option=option:ntp-server,192.168.1.1
> >
> >
> > On the hosts I can use the hostnames instead of the ip addresses but
> > not on the server.
> > I'd prefer to have all settings stored centrally so I'd like not to
> > copy them into /etc/hosts.
> >
> > I found that I can use the dns-nameserver setting
> > in /etc/network/interfaces:
> >
> >   auto eth1
> >   iface eth1 inet static
> >          address 192.168.1.1
> >          netmask 255.255.255.0
> >          dns-search domain
> >          dns-nameservers 192.168.1.1
> >
> > But it's still the same. I can't use the hostnames on the server.
> >
> > Do I have to set anything else?
> > Any help would be very much appreciated.
> >
> >
> 
> I can't see anything obviously amiss there. except that it's 
> conventional to use 127.0.0.1 for the nameserver address in this case.
> 
> Look in /etc/resolv.conf, which is the real location of the
> nameserver configuration, and make sure that it's been copied there
> from /etc/network/interfaces.

Thanks alot for your answer!

With 127.0.0.1 as dns-nameserver it isn't included in /etc/resolv.conf.

I use Debian Wheezy and my /etc/network/interfaces looks like this:

 $ cat /etc/network/interfaces
 # interfaces(5) file used by ifup(8) and ifdown(8)
 auto lo
 iface lo inet loopback

 auto eth0
 iface eth0 inet dhcp

 auto eth1
 iface eth1 inet static
        address 192.168.72.11
        netmask 255.255.255.0
        dns-search bpl-test
        dns-nameservers 127.0.0.1

 auto eth2
 iface eth2 inet static
        address 192.168.0.11
        netmask 255.255.255.0

The box gets its IP from a dhcp server on eth0. There's also a dns
server available on eth0.

This is only a test in my office and I get this resolv.conf:

 $ cat /etc/resolv.conf
 domain domain.ch
 search domain.ch
 nameserver xxx.24.0.100
 nameserver xxx.18.0.100

It's not copied in there. Is there another option I have to set
in /etc/network/interfaces?

This device will be deployed at a different place but I don't suspect
it will be different. Although I'll know mor this afternoon...


Best
Ramon



More information about the Dnsmasq-discuss mailing list