VRF(virtual routing and forwarding) created in LXC container is not persistent after reboot

I’m creating a vrf like this in a lxc container,

# ip link add RED type vrf table 3
# ip link set dev RED up

I’m able to see the VRF created,
# ip -br link show type vrf
RED UP be:f0:06:d6:fc:3b <NOARP,MASTER,UP,LOWER_UP>

Now, If I restart my lxc container or reboot the system, the vrf is gone.

#lxc-stop -n myContainer
#lxc-start -n myContainer

#lxc-attach -n myContainer
##ip -br link show type vrf

My lxc version,
# lxc-ls --version

Would appreciate if I can get some help here. Thanks in advance.

I don’t think VRF config persists across reboots, container or not - this is just a linux thing everything has to be defined in config files.

You need to add it to a start up script or something like ifupdown if i recall.

1 Like