Skip to content

Commit 3346a07

Browse files
gwenyastgraber
authored andcommitted
incusd/network/ovn: Fallback to OVN router address as DNS server
When no uplink is attached to an OVN network, use the OVN router's own address as the advertised DNS address through DHCP. Signed-off-by: Gwendolyn <[email protected]>
1 parent 2e72261 commit 3346a07

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/server/network/driver_ovn.go

+6
Original file line numberDiff line numberDiff line change
@@ -2660,6 +2660,8 @@ func (n *ovn) setup(update bool) error {
26602660

26612661
if uplinkNet != nil {
26622662
opts.RecursiveDNSServer = uplinkNet.dnsIPv4
2663+
} else {
2664+
opts.RecursiveDNSServer = []net.IP{routerIntPortIPv4}
26632665
}
26642666

26652667
err = n.ovnnb.UpdateLogicalSwitchDHCPv4Options(context.TODO(), n.getIntSwitchName(), dhcpv4UUID, dhcpV4Subnet, opts)
@@ -2677,6 +2679,8 @@ func (n *ovn) setup(update bool) error {
26772679

26782680
if uplinkNet != nil {
26792681
opts.RecursiveDNSServer = uplinkNet.dnsIPv6
2682+
} else {
2683+
opts.RecursiveDNSServer = []net.IP{routerIntPortIPv6}
26802684
}
26812685

26822686
err = n.ovnnb.UpdateLogicalSwitchDHCPv6Options(context.TODO(), n.getIntSwitchName(), dhcpv6UUID, dhcpV6Subnet, opts)
@@ -2698,6 +2702,8 @@ func (n *ovn) setup(update bool) error {
26982702
var recursiveDNSServer net.IP
26992703
if uplinkNet != nil && len(uplinkNet.dnsIPv6) > 0 {
27002704
recursiveDNSServer = uplinkNet.dnsIPv6[0] // OVN only supports 1 RA DNS server.
2705+
} else {
2706+
recursiveDNSServer = routerIntPortIPv6
27012707
}
27022708

27032709
err = n.ovnnb.UpdateLogicalRouterPort(context.TODO(), n.getRouterIntPortName(), &networkOVN.OVNIPv6RAOpts{

0 commit comments

Comments
 (0)