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
2.0.8

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

Hi Jon ,
Thanks replying. I am also in a similar situation, where I want to store vrf config before I restart container. Can you please suggest what is the linux file and path that is best suited for this.
I am using Ubuntu 16.04.4 LTS.
Thanks