[SOLVED]Lxd: dnsmasq: bad command line options: bad dhcp-range

Hi,
I tried to create a bridge interface with the following parameters but replies with that error. Could someone clarify the issue?
Thanks.

root@lxdserver01:~# lxc network create br0 ipv4.address=192.168.2.1/24 ipv6.address=none ipv4.nat=yes ipv4.dhcp=yes ipv4.dhcp.ranges=192.168.2.150,192.168.2.200 ipv4.dhcp.gateway=192.168.2.100

Error: Failed to run: dnsmasq --strict-order --bind-interfaces --pid-file=/var/lib/lxd/networks/br0/dnsmasq.pid --except-interface=lo --interface=br0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address=192.168.2.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/lib/lxd/networks/br0/dnsmasq.leases --dhcp-hostsfile=/var/lib/lxd/networks/br0/dnsmasq.hosts --dhcp-option=3,192.168.2.100 --dhcp-range 192.168.2.150,1h --dhcp-range 192.168.2.200,1h -s lxd -S /lxd/ --conf-file=/var/lib/lxd/networks/br0/dnsmasq.raw -u lxd: dnsmasq: bad command line options: bad dhcp-range

You can see here that LXD parsed the DHCP range in this particular way (wrong way).
Which means that ipv4.dhcp.ranges would have some difference way to specify the range.

Let’s see the documentation at https://github.com/lxc/lxd/blob/master/doc/networks.md

Comma separated list of IP ranges to use for DHCP (FIRST-LAST format)

So, the documentation is not clear. It talks about commad-separated list of IP ranges, but in reality it should be as described in the parenthesis (i.e. ipv4.dhcp.ranges=192.168.2.150-192.168.2.200) instead.

Can you please verify that you indeed need to use a “-” instead?

Thanks @simos for the clarification. In the documentation “comma separated list of IP ranges” is not very clear, or maybe I commented incorrectly.
The whole command became like that.

lxc network create br0 ipv4.address=192.168.2.1/24 ipv6.address=none ipv4.nat=yes ipv4.dhcp=yes ipv4.dhcp.ranges=192.168.2.150-192.168.2.200 ipv4.dhcp.gateway=192.168.2.100