Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a self-made Linux router running dnsmasq. It has two different NICs through which clients are connected; one of them has the subnet 192.168.1. and one the subnet 192.168.2.. My /etc/dnsmasq.conf looks like this:


Resolving the clients works between subnets, but from neither subnet can I resolve the hostname of the server itself. If I add a static rule using address=/name/IP I have to choose on of the subnets and pinging (among other things) does not work from the other subnet. So for example if I set


then I can resolve the hostname from the 192.168.2. subnet, but pings are unanswered. How do I solve that situation? I would like not having to bridge the interfaces or something like this.

share|improve this question
up vote 2 down vote accepted

As I understand, in your case, the server have an address for each subnet: and the other could be

I guess you want the clients to receive the server address of its corresponding subnet.

I had the same problem, found answer in http://t7994.network-dns-dnsmasq-general.dnstalk.us/multi-homed-server-with-same-hostname-on-2-subnets-t7994.html

Check "-y, --localise-queries" in the dnsmasq man page.

You can put "localise-queries" in dnsmasq.conf too, and put the two server address entries the /etc/hosts file.

share|improve this answer
perfect! This is exactly what I was looking for. – janoliver Oct 10 '13 at 7:29
Btw: This also works when putting the line localise-queries into dnsmasq.conf. – janoliver Oct 18 '13 at 6:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.