[Dnsmasq-discuss] How to listen on only one local IP address

Bill Yuan bycn82 at gmail.com
Sat Mar 2 14:24:06 GMT 2013


Hi,
First I want to thank for  creating this wonderful,powerful and also useful
tool. You rock !

I am using it as my local DNS server. but I found it always listens on all
the IP address and all interfaces on the machine ! But actually I want to
make it listening on one IP address only.

I am reading the man pages , it seems we have some options to make work as
what I want , I found these options listed below:

*-i, --interface=interface               Specify interface(s) to listen on.
-a, --listen-address=ipaddr             Specify local address(es) to listen
on.
-z, --bind-interfaces                   Bind only to interfaces in use.*

So in my test environment, I added two IP address as alias into lo0 which
is local loop interface.

*HA1#ifconfig lo0*
*lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384*
* options=3<RXCSUM,TXCSUM>*
* inet6 ::1 prefixlen 128 *
* inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6 *
* inet 127.0.0.1 netmask 0xff000000 *
* inet 1.1.1.1 netmask 0xff000000 *
* inet 2.2.2.2 netmask 0xff000000 *
* nd6 options=3<PERFORMNUD,ACCEPT_RTADV>*
*HA1#*

And I want to make the dnsmasq running on 1.1.1.1 IP , and I am going to
have another DNS running on 2.2.2.2

So the command like below

dnsmasq --local-ttl 1 --all-servers --rebind-localhost-ok --stop-dns-rebind
--dns-forward-max=5000 --cache-size=10000* --listen-address=1.1.1.1
--interface=lo0 --bind-interfaces*

and I found that it actually listening on all the local IP address

*HA1#netstat -an | grep 53*
*tcp6       0      0 ::1.53                 *.*                    LISTEN*
*tcp6       0      0 fe80:6::1.53           *.*                    LISTEN*
*tcp4       0      0 127.0.0.1.53           *.*                    LISTEN*
*tcp4       0      0 1.1.1.1.53             *.*                    LISTEN*
*tcp4       0      0 **2.2.2.2.53 * *           *.*
 LISTEN*
*tcp4       0      0 192.168.255.1.53       *.*                    LISTEN*

Can someone help to point out what's not correct in my case ? I am waiting
for help online , Thanks in advance .


Best Regards,
BYCN82
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20130302/9fc49a24/attachment.html>


More information about the Dnsmasq-discuss mailing list