diff options
| author | Alexandre Derumier <aderumier@odiso.com> | 2022-02-11 10:33:23 +0100 |
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2022-02-13 14:23:36 +0100 |
| commit | bbf4e4b17b27f00abc35572b8b6b437bf6089397 (patch) | |
| tree | f15eb313f8b1ed32577c5d5a8c125211073a88bc | |
| parent | 1608c16598b5e7cca7ba4375568eab48aeb37f31 (diff) | |
controllers: bgp: use loopback ip src for loopback network
can be usefull if we want to join other loopback ips,
like a ceph cluster in the underlay network
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
| -rw-r--r-- | PVE/Network/SDN/Controllers/BgpPlugin.pm | 7 | ||||
| -rw-r--r-- | PVE/Network/SDN/Controllers/EvpnPlugin.pm | 2 | ||||
| -rw-r--r-- | test/zones/evpn/ebgp_loopback/expected_controller_config | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/PVE/Network/SDN/Controllers/BgpPlugin.pm b/PVE/Network/SDN/Controllers/BgpPlugin.pm index 69c688b..075ca90 100644 --- a/PVE/Network/SDN/Controllers/BgpPlugin.pm +++ b/PVE/Network/SDN/Controllers/BgpPlugin.pm @@ -110,6 +110,13 @@ sub generate_controller_config { push(@{$bgp->{"address-family"}->{"$ipversion unicast"}}, "neighbor BGP soft-reconfiguration inbound"); } + if ($loopback) { + push(@{$config->{frr}->{''}}, "ip prefix-list loopbacks_ips seq 10 permit 0.0.0.0/0 le 32"); + push(@{$config->{frr}->{''}}, "ip protocol bgp route-map correct_src"); + push(@{$config->{frr}->{'route-map'}->{'correct_src permit 1'}}, "match ip address prefix-list loopbacks_ips"); + push(@{$config->{frr}->{'route-map'}->{'correct_src permit 1'}}, "set src $ifaceip"); + } + return $config; } diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 3e450cf..61a6314 100644 --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -258,6 +258,7 @@ sub sort_frr_config { $order->{'ipv4 unicast'} = 1; $order->{'ipv6 unicast'} = 2; $order->{'l2vpn evpn'} = 3; + $order->{'route-map'} = 200; my $a_val = 100; my $b_val = 100; @@ -283,6 +284,7 @@ sub generate_frr_recurse{ $keylist->{vrf} = 1; $keylist->{'address-family'} = 1; $keylist->{router} = 1; + $keylist->{'route-map'} = 1; my $exitkeylist = {}; $exitkeylist->{vrf} = 1; diff --git a/test/zones/evpn/ebgp_loopback/expected_controller_config b/test/zones/evpn/ebgp_loopback/expected_controller_config index 23be7f9..01cb2c2 100644 --- a/test/zones/evpn/ebgp_loopback/expected_controller_config +++ b/test/zones/evpn/ebgp_loopback/expected_controller_config @@ -5,6 +5,8 @@ frr defaults datacenter service integrated-vtysh-config hostname localhost ! +ip prefix-list loopbacks_ips seq 10 permit 0.0.0.0/0 le 32 +ip protocol bgp route-map correct_src ! vrf vrf_myzone vni 1000 @@ -49,5 +51,9 @@ router bgp 65001 vrf vrf_myzone route-target export 65000:1000 exit-address-family ! +route-map correct_src permit 1 + match ip address prefix-list loopbacks_ips + set src 192.168.0.1 +! line vty !
\ No newline at end of file |
