OpenWrt Forum Archive

Topic: Does DNSMASQ work on WRT locally?

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have pretty much plain vanilla dnsmasq setup. Static IPs are in hosts. Dynamic IPs are handled by dnsmasq. Everything works just fine on local network. E.g., I have dynamic host COOL, and I can nslookup it (or ping it) from any computer on my lan. At the same time, if I log in to my router, I can ping only static hosts and external hosts (e.g., www.gnu.org). It doesn't see COOL or COOL.LAN. What gives? I want to be able to resolve dynamic hosts locally on router.

Why do I need it? Mainly for SSH tunneling from outside to hosts I know only by name for remote administration.

Yeah, I've read dnsmasq doc. Tried to replace except-interface (btw, it looks fine to me) with listen-address options. The result is the same. Any ideas?

Thank you in advance.

uhop wrote:

I want to be able to resolve dynamic hosts locally on router.

Just find some way to add 127.0.0.1 to /tmp/resolv.conf.

get a old pc and setup a linux dns server, don't overload your router
not only that more service run in your router lead to security problems..

wireless joe

tuzzer wrote:
uhop wrote:

I want to be able to resolve dynamic hosts locally on router.

Just find some way to add 127.0.0.1 to /tmp/resolv.conf.

How would it work? AFAIK resolv.conf is a list of "universal" DNS resolvers. 127.0.0.1 should be used only for local names. I don't know, if it possible to make such distinction on resolv.conf level. Theoretically it may loop forever.

wirelessjoe wrote:

get a old pc and setup a linux dns server, don't overload your router
not only that more service run in your router lead to security problems..

wireless joe

I checked load and it is fine for my purposes. I know about security implications.

Of course I am being silly. I should throw away WRT smile, and use old PC instead. Chances are it would have better CPU. more memory, hard drives, and whole lot more extendable... But what fun is in it? wink Nope, ostrich solution is not for me! cool

I cannot believe, dnsmasq can't do what I want. Most probably it is some kind of bug:

except-interface=vlan1

should make dns service available at least on br0 (it does) and lo (it doesn't).

Thank you anyway. Your solution would work. But I am looking for something else.

afaik there is no need to put 127.0.0.1 into /tmp/resolv.conf to
make dnsmasq work correctly. it's all a matter of a properly
configured /etc/dnsmasq.conf.

the dnsmasq.conf that comes with the dnsmasq package is imho
not a really good source to start from so I will post my dnsmasq.conf.
it will hopefully help you in achieving your goal wink

btw. my lan and wlan are on two different subnets.
(lan: 10.10.1.0/24 | wlan: 10.10.2.0/24)

/etc/dnsmasq.conf

#
# DNS forwarder for external domains
#
resolv-file=/etc/resolv.conf                    # upstream name servers
no-poll                                         # do not poll resolv-file
except-interface=vlan1                          # do not answer on external i/f
domain-needed                                   # don't forward plain names
bogus-priv                                      # don't forward private addresse
bogus-nxdomain=64.94.110.11                     # keep Verisign in control
filterwin2k                                     # filter useless Windows DNS requests

#
# Local DNS name server
#
#no-hosts                                       # do not read /etc/hosts
#addn-hosts=/etc/sysconfig/dnsmaqs/hosts        # instead, read this file
expand-hosts                                    # add the domain to /etc/hosts entries
domain=wurstnetz.de                             # domain name
local=/wurstnetz.de/                            # answer these domains from /etc/hosts

#
# Automatically configure DHCP client network i/f (RFC 1533)
#
dhcp-option=1,255.255.255.0                     # subnet mask
#dhcp-option=2,-28800                           # UTC -8:00
dhcp-option=lan, 3,10.10.1.1                    # default g/w for LAN client
dhcp-option=wifi,3,10.10.2.1                    # default g/w for WiFi clients
#dhcp-option=vpn, 3,10.0.3.1                    # default g/w for VPN clients
dhcp-option=lan, 6,10.10.1.1                    # DNS server for LAN clients
dhcp-option=wifi,6,10.10.2.1                    # DNS server for WiFi clients
#dhcp-option=vpn, 6,10.0.3.1                    # DNS server for VPN clients
#dhcp-option=7,10.0.1.2                         # SYSLOG server
#dhcp-option=40,vonk                            # NIS domain
#dhcp-option=41,10.0.1.2                        # NIS domain server
#dhcp-option=42,10.0.1.1                        # NTP server

#
# DHCP address range
#
dhcp-leasefile=/var/dhcp.leases
dhcp-range=lan,10.10.1.150,10.10.1.199,255.255.255.0,15m        # DHCP addr range for LAN clients
dhcp-range=wifi,10.10.2.10,10.10.2.250,255.255.255.0,15m        # DHCP addr range for WIFI clients

#
# MAC addresses below are statically mapped to IP addresses
#
#LAN
dhcp-host=00:10:DC:31:6B:2A,net:lan,    thefront.wurstnetz.de,10.10.1.27,12h
dhcp-host=00:00:39:FB:4A:EE,net:lan,    fronti.lan.wurstnetz.de,10.10.1.127,12h
dhcp-host=00:50:BA:BA:9E:E0,net:lan,    was.wurstnetz.de,10.10.1.129,12h
dhcp-host=00:E0:06:02:FB:8F,net:lan,    hjs.wurstnetz.de,10.10.1.130,12h

#WLAN
dhcp-host=00:20:A6:4D:0E:07,net:wifi,   fronti.wlan.wurstnetz.de,10.10.2.127,12h

dhcp-lease-max=50

/etc/hosts

#LAN
10.10.1.1       router.lan.wurstnetz.de www wurstnetz.de
10.10.1.27      thefront
10.10.1.127     fronti.lan.wurstnetz.de
10.10.1.129     was
10.10.1.130     hjs
10.10.1.200     pappschachtel

#WLAN
10.10.2.1       router.wlan.wurstnetz.de
10.10.2.127     fronti.wlan.wurstnetz.de

this way static hostnames set in /etc/hosts and windows/linux Hostnames set on the particular machine will resolve to
some_hostname.wurstnetz.de with some ip address dynamically assigned by dnsmasq
with some_hostname being the hostname assinged to the machine.

(Last edited by thefRont on 8 May 2005, 16:39)

The discussion might have continued from here.