Hi Tim,

On Wed, 2024-07-10 at 21:55 +0200, Tim Tassonis wrote:
> Hi all
> 
> I tried using dnsmasq as local resolver, which in general works fine.
> 
> However, I however would like to run a second instance of dnsmasq 
> binding only to a tap0, for a virtual network (vde2) for some qemu 
> virtual machines, and I can't seem to get that to work, as it always 
> complains about 127.0.0.1 already being taken.
> 
> I tried:
> 
> 
> DHCP_OPT="192.168.8.9,192.1688.8.99,255.255.255.0,192.168.8.255,8h"
> dnsmasq --log-queries --user=dnsmasq \
>          --dhcp-leasefile=/var/lib/misc/qemu-vde-dnsmasq.leases \
>          --dhcp-range=$DHCP_RANGE \
>          --listen-address=192.168.8.1 \
>          --interface=tap0 --except-interface=lo \
>          --domain=decentral.ch \
>          --enable-tftp  \
>          --dhcp-boot=/var/lib/qemu-vde/pxeboot/pxelinux.0 \
>          --pid-file=/run/qemu-vde-dnsmasq.pid
> 
> 
> 
> This works fine, but only if the local dnsmasq is not started.
> 
> Otherwise, it will fail with:
> 
> dnsmasq: failed to create listening socket for 127.0.0.1: Address 
> already in use
> 
> Any ideas?

Looks like --bind-interfaces is missing from your configuration. I
would also recommend to drop --interface and --except-interface, and
only keep --listen-address.

Please re-read the manual page:


-i, --interface=<interface name>
   Listen only on the specified interface(s). Dnsmasq automatically
   adds the loopback (local) interface to the list of interfaces to use
   when the --interface option is used. [...]

-a, --listen-address=<ipaddr>
   Listen on the given IP address(es). Both --interface and --listen-
   address options may be given, in which case the set of both
   interfaces and addresses is used. Note that if no --interface option
   is given, but --listen-address is, dnsmasq will not automatically
   listen on the loopback interface. To achieve this, its IP address,
   127.0.0.1, must be explicitly given as a --listen-address option.
   
-z, --bind-interfaces
   On systems which support it, dnsmasq binds the wildcard address,
   even when it is listening on only some interfaces. [...] Setting
   this option also enables multiple instances of dnsmasq which provide
   DHCP service to run in the same machine.
   
Hope this helps,

Cheers,
Sven
-- 
GPG Fingerprint
3DF5 E8AA 43FC 9FDF D086 F195 ADF5 0EDA F8AD D585

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to