Is there anyway to set a DHCP range for an OVN network. I looked at the documentation and find no option. Searching the internet for a bit I found that you can exclude ip a range from the dhcp pool, which is ideal if you want to set some static ips. The command below effectively achieve the desired effect but it would have to be managed outside of incus.
ovn-nbctl set logical_switch net0 \
other_config:subnet="10.0.0.0/24" \
other_config:exclude_ips="10.0.0.1..10.0.0.10"
That’s not currently supported. We’d want to have our usual ipv4.dhcp.ranges so the allowed range will need to be turned into exclude ranges internally.
That’s good to know. So we basically “just” need logic to convert a ipv4.dhcp.ranges into their negative for that subnet. So look at the subnet and determine the ranges which we won’t be providing DHCP for and then put that as the exclusion.
Thanks, @stgraber for adding this to the feature list.
For I temporary solution, I ended up reserving the first 50 IPs.
sudo ovn-nbctl set logical_switch incus-net46-ls-int \
other_config:exclude_ips="10.100.0.1..10.100.0.49"
In my case this works out fine - since, I want to reserve the first continuous set of IPs from the gateway IP 10.100.0.1 to 10.100.0.49. However, If you wanted to reserve the last 50 or so IPs for example (10.100.0.200…10.100.0.254).
Maybe, you would need to exclude the gateway as well.
sudo ovn-nbctl set logical_switch incus-net46-ls-int \
other_config:exclude_ips="10.100.0.1 10.100.0.200..10.100.0.254"
Either way the syntax on the command is space delimited if you need add multiple entires.
ovn-nbctl list logical_switch 7c6cc28c-29a4-4024-8972-6a8c4dda1d28
name : incus-net46-ls-int
other_config : {exclude_ips="10.100.0.1 10.100.0.200..10.100.0.254", subnet="10.100.0.0/24"}
So, until the code base is updated to support ranges, you won’t be able to manually set a range—unless you don’t ever plan to set the ips using the device switch.
Either way, having a good time experimenting with incus and ovn.