Question about ipv4.nat default value is true or false

I have a question about the default value of ipv4.nat and ipv6.nat settings on network_ovn_nat and network: physical?

How different between these settings are “unspecified” and “missing”?

At network_ovn_nat, the document says:

If the setting is missing then the value is taken as false .

And also the value of the Default column on ipv4.nat and ipv6.nat rows in network: physical are “false”.

However, at network_ovn_nat, the document says:

When creating the network if these settings are unspecified, and an equivalent IP address is being generated for the subnet, then the appropriate NAT setting will added set to true .

And the description on on ipv4.nat and ipv6.nat rows in network: physical says “will default to true if unset”.

I appreciate if someone could make me understood what is the correct default value and the difference between the above two explanations.
Thanks!

ipv4.nat and ipv6.nat were present in the physical section by mistake, they have since been removed from there.

The rest still applies.

  • lxc network create blah ipv4.address=10.0.0.1/24 ipv6.address=none
    Will result in no ipv4.nat or ipv6.nat being enabled.
  • lxc network create blah
    Will result in both ipv4.nat and ipv6.nat being enabled. As the two subnets get auto-allocated.
1 Like

I need to check if we can set the IP addresses to ‘none’ and add that feature if not. I know it’s supported on bridge networks but not sure that made it into ovn yet. Will check and add if not.

However for both bridge and ovn networks, NAT is disabled by default, unless the IP address of the network is auto generated in which case it is enabled at the same time an address range is picked.

1 Like

Thanks for your comment.

I read the code and found ipv4.nat and ipv6.nat will be set to true by LXD at the following:

So with my understanding, the following sentence

When creating the network if these settings are unspecified, and an equivalent IP address is being generated for
the subnet, then the appropriate NAT setting will added set to true .

means

When creating the network if these settings are unspecified, and an equivalent IP address (that is, ipv4.address for ipv4.nat and ipv6.address for ipv6.nat) is being generated for
the subnet (when ipv4.address or ipv6.address is not set or set to auto), then the appropriate NAT setting will added (and ipv4.nat or ipv6.nat will be) set to true .

Is this correct?

Correct.

1 Like

PR for adding support for “none” addresses: