[Dnsmasq-discuss] standard gateway as Forwarding DNS-ip?

Oliver Rath rath at mglug.de
Fri May 18 13:09:58 BST 2012


Hi list,

my dnsmasq doesnt forward DNS-queries correctly. The goal is, that
dnsmasq takes the standard-gateway of dhcp as forwarding address for
dns-requests. But this didnt work here.

If I put an additional dns-server in /var/run/dnsmasq/resolv.conf, it
runs fine, but this is not the right way, because i dont know at
starttime the name of my standard-gateway.

Whats wrong?

I have a simple configuration here for dnsmasq:
--------------
except-interface=wlan0
dhcp-range=192.168.97.50,192.168.97.150,255.255.255.0,12h
log-queries
--------------

Starting the dnsmasq creates the folloiwing entry in /etc/resolv.conf:
--------------
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
--------------

The server hast the ipadress 192.168.11.254 (eth0) and (should) forward
to 192.168.172.1 via wlan0

--------------
# route -n
Kernel-IP-Routentabelle
Ziel Router Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.172.1 0.0.0.0 UG 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
192.168.97.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.172.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
--------------

Now the forwarding is finished by setting forwarding parameter and
Masquerading rule:
--------------
# cat /proc/sys/net/ipv4/ip_forward
1
# iptables -t nat -L
[..]
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- anywhere anywhere
--------------


Here the starting log:
--------------
May 18 13:58:14 dnsmasq[3092]: last message repeated 7 times
May 18 13:58:14 dmi-ThinkPad-T500 dnsmasq[3092]: reading
/var/run/dnsmasq/resolv.conf
May 18 13:58:14 dmi-ThinkPad-T500 dnsmasq[3092]: ignoring nameserver
127.0.0.1 - local interface
May 18 13:58:14 dmi-ThinkPad-T500 dnsmasq[3092]: exiting on receipt of
SIGTERM
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq[3182]: started, version 2.59
cachesize 150
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq[3182]: compile time options:
IPv6 GNU-getopt DBus i18n DHCP TFTP conntrack IDN
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq-dhcp[3182]: DHCP, IP range
192.168.97.50 -- 192.168.97.150, lease time 12h
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq-tftp[3182]: TFTP root is
/opt/dmi/tftproot
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq[3182]: reading
/var/run/dnsmasq/resolv.conf
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq[3182]: ignoring nameserver
127.0.0.1 - local interface
May 18 13:58:16 dmi-ThinkPad-T500 dnsmasq[3182]: /etc/hosts lesen – 7
Adressen
--------------


here an dns-request example:
--------------
May 18 13:59:00 dmi-ThinkPad-T500 dnsmasq[3182]: reading
/var/run/dnsmasq/resolv.conf
May 18 13:59:00 dmi-ThinkPad-T500 dnsmasq[3182]: ignoring nameserver
127.0.0.1 - local interface
May 18 13:59:00 dmi-ThinkPad-T500 dnsmasq[3182]: query[A] heise.de from
192.168.97.73
--------------


Tfh!

Regards
Oliver






More information about the Dnsmasq-discuss mailing list