[Dnsmasq-discuss] Is there any way found this "Cannot assign requested address"?

Donald Muller donmuller22 at outlook.com
Sun Feb 13 20:01:13 UTC 2022



> -----Original Message-----
> From: Dnsmasq-discuss <dnsmasq-discuss-bounces at lists.thekelleys.org.uk>
> On Behalf Of Chris Green
> Sent: Sunday, February 13, 2022 12:20 PM
> To: dnsmasq-discuss at lists.thekelleys.org.uk
> Subject: [Dnsmasq-discuss] Is there any way found this "Cannot assign
> requested address"?
> 
> I want to configure a system to listen on an address that it doesn't
> actually have until I add the address to the network interface.
> 
> It works OK on Raspberry Pi systems but apparently not on a pretty
> standard ubuntu Linux system.
> 
> When I try to start dnsmasq I get this error:-
> 
>     root at esprimo# systemctl status dnsmasq.service
>     × dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
>          Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled;
> vendor preset: enabled)
>          Active: failed (Result: exit-code) since Sun 2022-02-13 16:56:27 GMT;
> 1min 46s ago
>         Process: 3839 ExecStartPre=/etc/init.d/dnsmasq checkconfig
> (code=exited, status=0/SUCCESS)
>         Process: 3847 ExecStart=/etc/init.d/dnsmasq systemd-exec
> (code=exited, status=2)
>             CPU: 19ms
> 
>     Feb 13 16:56:27 esprimo systemd[1]: Starting dnsmasq - A lightweight DHCP
> and caching DNS server...
>     Feb 13 16:56:27 esprimo dnsmasq[3847]: dnsmasq: failed to create listening
> socket for 192.168.1.2: Cannot assign requested address
>     Feb 13 16:56:27 esprimo dnsmasq[3847]: failed to create listening socket
> for 192.168.1.2: Cannot assign requested address
>     Feb 13 16:56:27 esprimo dnsmasq[3847]: FAILED to start up
>     Feb 13 16:56:27 esprimo systemd[1]: dnsmasq.service: Control process
> exited, code=exited, status=2/INVALIDARGUMENT
>     Feb 13 16:56:27 esprimo systemd[1]: dnsmasq.service: Failed with result
> 'exit-code'.
>     Feb 13 16:56:27 esprimo systemd[1]: Failed to start dnsmasq - A lightweight
> DHCP and caching DNS server.
> 
> 
> In the dnsmasq man page it has:-
> 
>     -z, --bind-interfaces
>           On  systems  which support it, dnsmasq binds the wildcard address,
> even when it
>           is listening on only  some  interfaces.  It  then  discards  requests  that  it
>           shouldn't reply to. This has the advantage of working even when
> interfaces come
>           and go and change address. This option forces dnsmasq to really bind
> only  the
>           interfaces  it is listening on. About the only time when this is useful is
> when
>           running another nameserver (or another instance of dnsmasq)  on  the
> same  ma‐
>           chine.  Setting  this  option  also enables multiple instances of dnsmasq
> which
>           provide DHCP service to run in the same machine.
> 
> I thought this would mean I could do what I want which is to have:-
> 
>     listen-address=192.168.1.2,127.0.0.1
> 
> ... and only actually create the IP 192.168.1.2 on the network interface
> when I want this system to be the DHCP/DNS server.
> 
> Does the error mean that Ubuntu Linux isn't among "systems  which support
> it"?
> 
> Is there any other way to get the result I want?  That is dnsmasq running but
> not
> actually being visible as a server on the LAN until I do something to "switch it
> on"?
> 
> --
> Chris Green
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

--bind-dynamic
Enable a network mode which is a hybrid between --bind-interfaces and the default. Dnsmasq binds the address of individual interfaces, allowing multiple dnsmasq instances, but if new interfaces or addresses appear, it automatically listens on those (subject to any access-control configuration). This makes dynamically created interfaces work in the same way as the default. Implementing this option requires non-standard networking APIs and it is only available under Linux. On other platforms it falls-back to --bind-interfaces mode.


More information about the Dnsmasq-discuss mailing list