Adding a static route to ovn

I have a container running openvpn and I would like to configure my ovn network to route to it.

how would I configure this at the ovn network level?

eg my ovn network is 192.168.1.0
there is a vpn client network of 10.0.1.0 that I would like to be able to access from the servers

Currently I have to add a static route to every container that I want to connect to the vpn client and that works. I would like a more global solution if posslble.

Thanks,
Eric

Hi there,

Try using ipv4.routes on the `ovn`` NIC device https://documentation.ubuntu.com/lxd/en/latest/reference/devices_nic/#nic-ovn

This should add a static route to the virtual router forward traffic toward the instance NIC.

Outside of the OVN network, you can forward traffic to the virtual router’s address on the uplink network by looking for volatile.network.ipv4.address in lxc network show <ovn network>.

I would edit the routes on the vpn container nic correct?

What is the syntax for that route entry? The documentation could be a little more clear on that.

Thanks,

Yes, so say if the VPN’s internal subnet was 10.0.1.0/24 then you could do:

lxc config device set <vpn container> eth0 ipv4.routes=10.0.1.0/24

This will attract packets destined for 10.0.1.0/24 hitting the OVN router to be forwarded toward the VPN container’s OVN NIC.

If you were adding multiple routes you would separate them by a comma:

Comma-delimited list of IPv4 static routes to route to the NIC