Error running lxc network create in lxd cluster

I have created a lxd cluster of two nodes without network configuration.
Subsequently running the command
lxc network create lxdbr0 --target node1
works but when giving
lxc network create lxdbr0 ipv4.address=192.168.1.1/24 ipv6.address=none ipv.nat=true --target node 1
It gives an error
Error: Invalid config key 'ipv4.address'

Hello,

LXD expects the networks that you create on individual nodes (with --target) to have exactly the same configuration, except for one configuration key (bridge.external_interfaces) that you can differ across nodes and that you can specify when you create the network on the node with --target.

Any other configuration key must be passed in the final “lxc network create” call that will effectively create the networks on the individual nodes after the various --target calls.

For instance, in your case:

lxc network create lxdbr0 --target node1
lxc network create lxdbr0 --target node2
lxc network create lxdbr0 ipv4.address=192.168.1.1/24 ipv6.address=none

If you need inter-node network communication, you might consider the FAN network support introduced in LXD 3.1.0, or I believe you’ll need to create a dedicated vlan with DHCP and pass bridge.external_interfaces to individual nodes as appropriate.

I guess @stgraber can provide more details if needed.

Can we do something about the error message?
We should make it clear that the config key isn’t a valid node-specific key but is a valid global key.

Sure, I’ll work on a better message.