3.19 and Routed networking mode configuration example needed

Because the routed nic type doesn’t require an LXD managed network, I would do the following:

Assuming that:

  • Interface enp3s0 is a physical port connected to a network 192.168.1.0/24.
  • The default gateway on the physical network is 192.168.1.1.
  • An existing default profile has a bridged NIC connected to lxdbr0.

Copy the profile and remove the bridged NIC from new profile:

lxc profile copy default rnic
lxc profile device remove rnic eth0

Add a partially configured routed NIC to the profile, this can optionally have the parent specified or not.

lxc profile device add rnic eth0 nic nictype=routed parent=enp3s0

Now create a container from rnic profile, note I only init the container, I don’t launch as need to add IPs to it (the container will start without IPs though).

lxc init ubuntu:18.04 c1 -p rnic
lxc config device override c1 eth0 ipv4.address=192.168.1.200
lxc start c1
ping 192.168.1.200
lxc exec c1 ping 192.168.1.1

Finally the managed LXD network isn’t needed anymore (unless other containers are using it) so:

lxc network delete lxdbr0
3 Likes