Managed bridge default gateway

I created a bridged interface using incus with following configuration:

config:
  bridge.external_interfaces: enp7s0
  ipv4.address: 192.168.70.2/24
  ipv4.dhcp: "false"
  ipv4.nat: "true"
  ipv4.routes: 0.0.0.0/0
description: ""
name: incusbr0
type: bridge
used_by:
managed: true
status: Created
locations:
- none
project: default

This configuration yields the following output of ip route command:

default dev incusbr0 proto static scope link 
169.254.0.0/16 dev incusbr0 scope link metric 1000 
192.168.70.0/24 dev incusbr0 proto kernel scope link src 192.168.70.2 

How can I set the default route to a specific ip using incus? I couldn’t find any option related.
I would like the output of ip route be:

default via 192.168.70.1 dev incusbr0  proto static scope link

Thanks

Oh, I see, you’re trying to configure your host’s own networking through that bridge.

I wouldn’t really recommend doing that as anything wrong happening to Incus will leave you without networking on your machine.

Instead for such environments, it’s usually simpler to configure your OS networking to set up a bridge for you, then tell Incus about it to place its instances on it.

I don’t know what distro you’re using, but on Ubuntu, you’d do that through Netplan (/etc/netplan/), basically defining a bridge in there, with a static address and correct gateway, then after you’ve confirmed that your machine can boot and has functional connectivity that way, you’d add the network to Incus with:

incus network create my-bridge parent=my-bridge --type=physical

That then lets you configure your instances with a normal managed NIC:

eth0:
  type: nic
  name: eth0
  network: my-bridge

Hi Stéphane,

I’m using Debian 12 Linux with network configured by network-manager.
I implemented the steps suggested but I got a problem. When I apply that incus configurations, I got the host network reconfigured, it reset routing configurations, for instance, I have configured the a default gateway and when apply incus it cleared that configuration. Its very weird.

Hmm, that is a bit weird.

An alternative would be to skip the incus network create entirely and instead make your NIC:

eth0:
  type: nic
  name: eth0
  nictype: bridged
  parent: my-bridge