0

I am trying to add a VRF interface to a network namespace in Linux. I am getting

RTNETLINK answers: invalid argument.

Kernel version I am using is 4.15.0 from kernel.org

Below is the exact list of commands I am running and associated output

$IP link add vrf-red type vrf table 10
$IP netns add foo
$IP link set vrf-red netns foo
RTNETLINK answers: Invalid argument

Is this not supported? If so, what is the rationale?

Use case: I am trying to setup two PE devices in the same Linux box, so I have a separate netns for each of the PE device. Now I want to add a VRF device to the PE netns so later I can run say zebra in the PE netns and it would use the VRF that's available in this namespace.

Is there something I am missing?

gabhijit
  • 101
  • 2

2 Answers2

0

Yes it is indeed not possible to add a VRF interface to a netns

Below is the relevant code - (from the kernel sources that I am using - 4.15.0 in drivers/net/vrf.c line 1257)

/* don't allow vrf devices to change network namespaces. */
dev->features |= NETIF_F_NETNS_LOCAL;
gabhijit
  • 101
  • 2
0

Whilst you can't move VRF interface to a network namespace, you can create in the namespace:

ip netns add foo
ip -n foo link add vrf-red type vrf table 10