Using BFD with VRF (vyos-1.4-rolling-202103251004)

,

Hello everyone,

I’m learning networking (bgp, ospf, etc.) with vyos and doing some test setups with the newest rolling release (vyos-1.4-rolling-202103251004).

At the moment I was trying the new (really cool! :+1:t2:) vrf feature inside my test setup.

First I started with BFD.
After defining a peer it always uses vrf “default”. And there seems no parameter now for setting a vrf.
Before learning to implement such a parameter (never done that before :innocent:) I tried to test it statically by modifying the template “/usr/share/vyos/templates/frr/bfd.frr.tmpl”.
So I changed the line:

peer {{ peer_name }}{{ ’ multihop’ if peer_config.multihop is define

to

peer {{ peer_name }} vrf test1 {{ ’ multihop’ if peer_config.multihop is define

for using my vrf named “test1”.

After rebooting the peer seems to be correct but down:

BFD Peers:
peer 10.0.0.2 local-address 10.0.0.1 vrf test1
Remote ID: 0
Status: down

The problem could be seen in tcpdump. All pakets to port UDP/3784 got replied with ICMP unreachable.
Thats because the interface with my local-adress is using the vrf-feature and the bfd service is using the default vrf context.

Using the vyos config param “bind-to-all” does not changed anything.
I had to do this to get it working:

sysctl -w net.ipv4.udp_l3mdev_accept=1

By the way… BGP had the same problem. Connections to port TCP/179 also got blocked (i learned no routes) and are only working after doing this:

sysctl -w net.ipv4.tcp_l3mdev_accept=1

Do you have an idea how to implement that “the right way”?
Should I try to run BFD in vrf context “test1”? How? :wink: The “sysctl’s” should then not needed anymore.
Is there a bug with “bind-to-all” that need to be fixed first?

Before I try to write some code to implement some kind of vrf-parameter for bfd:
may that new syntax acceptable? :thinking:

set protocols bfd peer vrf

Thats (the important part of) my config:

Vyos1:
set interfaces ethernet eth0 address ‘10.0.1.1/24’
set interfaces ethernet eth0 vrf ‘test1’
set interfaces ethernet eth1 address ‘10.0.0.1/24’
set interfaces ethernet eth1 vrf ‘test1’
set protocols bfd peer 10.0.0.2 echo-mode
set protocols bfd peer 10.0.0.2 source address ‘10.0.0.1’
set vrf bind-to-all
set vrf name test1 protocols bgp 3000 address-family ipv4-unicast network 10.0.1.0/24
set vrf name test1 protocols bgp 3000 neighbor 10.0.0.2 remote-as ‘3000’
set vrf name test1 protocols bgp 3000 neighbor 10.0.0.2 update-source ‘10.0.0.1’
set vrf name test1 protocols bgp 3000 parameters router-id ‘10.0.0.1’
set vrf name test1 table ‘101’

Vyos2:
set interfaces ethernet eth0 address ‘10.0.2.1/24’
set interfaces ethernet eth0 vrf ‘test1’
set interfaces ethernet eth1 address ‘10.0.0.2/24’
set interfaces ethernet eth1 vrf ‘test1’
set protocols bfd peer 10.0.0.1 echo-mode
set protocols bfd peer 10.0.0.1 source address ‘10.0.0.2’
set vrf bind-to-all
set vrf name test1 protocols bgp 3000 address-family ipv4-unicast network 10.0.2.0/24
set vrf name test1 protocols bgp 3000 neighbor 10.0.0.1 remote-as ‘3000’
set vrf name test1 protocols bgp 3000 neighbor 10.0.0.1 update-source ‘10.0.0.2’
set vrf name test1 protocols bgp 3000 parameters router-id ‘10.0.0.2’
set vrf name test1 table ‘101’

Thanks :slight_smile:
Andreas

Hi Andreas, did you ever get to the bottom of this?

It should work in current version, did you try it ?

https://phabricator.vyos.net/T4044