How do I add multiple options for dnsmasq via raw.dnsmasq

Here is one way to do it,

$ lxc network edit lxdbr0
(opens up a text editor)

It should show you the config: section that looks like

config:
  ipv4.address: 10.50.253.1/24
  ipv4.nat: "true"
  ipv6.address: fd42:cba6:557e:1a5f::1/64
  ipv6.nat: "true"

Change as follows:

config:
  ipv4.address: 10.50.253.1/24
  ipv4.nat: "true"
  ipv6.address: fd42:cba6:557e:1a5f::1/64
  ipv6.nat: "true"
  raw.dnsmasq: |-
    no-hosts
    expand-hosts
    dhcp-ttl=3600

Alternatively, you can do:

$ lxc network get lxdbr0 raw.dnsmasq

$ echo -e "no-hosts\nexpand-hosts" | lxc network set lxdbr0 raw.dnsmasq -

$ lxc network get lxdbr0 raw.dnsmasq
no-hosts
expand-hosts
3 Likes