You are not logged in.

#1 2017-05-28 16:24:46

jab2870
Member
Registered: 2017-03-20
Posts: 20

[Solved] Dnsmasq / resolv.conf not being used to resolve dns

Hi,

I am trying to set up dnsmasq on my laptop to point all *.local domains to 127.0.0.1.

I have copied my dnsmasq config from another of my machines which it works on. The relevant sections are below:

# Add domains which you want to force to an IP address here.
# The example below send any host in double-click.net to a local
# web-server.
#address=/double-click.net/127.0.0.1
address=/local/127.0.0.1
# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
#interface=
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
#listen-address=
listen-address=127.0.0.1

The full file is on GitHub: https://github.com/Jab2870/dotfiles/blo … smasq.conf

I have made my resolv.conf file write protected, as the wiki suggests, with

# chattr +i /etc/resolv.conf

Its contents is the following:

nameserver 127.0.0.1
nameserver 8.8.8.8

I have restarted dnsmasq and re-connected to my network using wifi-menu.

I have checked and resolv.conf hasn't been overwritten.

For some reason, it doesn't seem to be working.

ping test.local

doesn't do anything, although, if I use dig:

$ dig test.local

; <<>> DiG 9.11.1 <<>> test.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51356
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;test.local.			IN	A

;; ANSWER SECTION:
test.local.		0	IN	A	127.0.0.1

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun May 28 17:23:03 BST 2017
;; MSG SIZE  rcvd: 44

I have taken from this that dnsmasq is working but, for some reason, resolv.conf is being ignored by ping?  Does anybody know how to correct this, or as a minimum, confirm my theory?

Thanks in advance for any help

EDIT:
It is not just ping that ignores it, any browser I use tells me there was a problem resolving dns so I think it would be more accurate to say that dig is the only program I have tried that isn't ignoring resolv.conf

Last edited by jab2870 (2017-05-29 11:38:34)

Offline

#2 2017-05-28 18:43:21

seth
Member
Registered: 2012-09-03
Posts: 51,165

Re: [Solved] Dnsmasq / resolv.conf not being used to resolve dns

Offline

#3 2017-05-29 09:29:09

jab2870
Member
Registered: 2017-03-20
Posts: 20

Re: [Solved] Dnsmasq / resolv.conf not being used to resolve dns

seth wrote:

No, I don't believe so.  I am quite new to Arch but I believe that I am using netctl unless systemd-networkd is enabled by default.

$ systemctl | grep running
init.scope                                                                                loaded active running   System and Service Manager                                                 
session-c2.scope                                                                          loaded active running   Session c2 of user jonathan                                                
avahi-daemon.service                                                                      loaded active running   Avahi mDNS/DNS-SD Stack                                                    
dbus.service                                                                              loaded active running   D-Bus System Message Bus                                                   
dnsmasq.service                                                                           loaded active running   A lightweight DHCP and caching DNS server                                  
getty@tty1.service                                                                        loaded active running   Getty on tty1                                                              
polkit.service                                                                            loaded active running   Authorization Manager                                                      
rtkit-daemon.service                                                                      loaded active running   RealtimeKit Scheduling Policy Service                                      
systemd-journald.service                                                                  loaded active running   Journal Service                                                            
systemd-logind.service                                                                    loaded active running   Login Service                                                              
systemd-udevd.service                                                                     loaded active running   udev Kernel Device Manager                                                 
upower.service                                                                            loaded active running   Daemon for power management                                                
user@1000.service                                                                         loaded active running   User Manager for UID 1000                                                  
avahi-daemon.socket                                                                       loaded active running   Avahi mDNS/DNS-SD Stack Activation Socket                                  
dbus.socket                                                                               loaded active running   D-Bus System Message Bus Socket                                            
systemd-journald-dev-log.socket                                                           loaded active running   Journal Socket (/dev/log)                                                  
systemd-journald.socket                                                                   loaded active running   Journal Socket                                                             
systemd-udevd-control.socket                                                              loaded active running   udev Control Socket                                                        
systemd-udevd-kernel.socket                                                               loaded active running   udev Kernel Socket

Offline

#4 2017-05-29 11:37:56

jab2870
Member
Registered: 2017-03-20
Posts: 20

Re: [Solved] Dnsmasq / resolv.conf not being used to resolve dns

It turns out that Avahi also uses .local for resolving domain names of devices on the local network. Disabling the avahi daemon and socket fixed this.

sudo systemctl stop avahi-daemon.service
sudo systemctl stop avahi-daemon.socket

Does anybody know how I could have Avahi "try" to resolve the .local domain name first then, if it fails, dnsmasq routes it to my local machine?  Alternatively, I wouldn't mind if Avahi used a different TLD.  I only really use it for printers and they only need setting up once.  Could I make it use something like .avahi?

Offline

Board footer

Powered by FluxBB