osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.66k stars 699 forks source link

eBGP peering in multiple VRFs #2789

Open mushrushu opened 8 months ago

mushrushu commented 8 months ago

Hey! I've tried to peer GoBGP instance with FRR in different VRFs (default and "blue") with eBGP. The logical scheme looks approximately like that:

┌──────────────────────────┐
│            GW            │
│           AS64967        │
├────────────┬──────────── │
│            │             │
│ VRF BLUE   │ VRF DAFAULT │
│ VLAN 1337  │             │
└─────┬──────┴──────┬──────┘
      │             │       
      │             │       
      │             │       
┌─────┴───────┬─────┴──────┐
│  VLAN 1337  │            │
│  VRF BLUE   │ VRF DEFAULT│
│             │            │
├─────────────┴─────────── │
│           LEAF           │
│           AS64968        │
│                          │
└──────────────────────────┘

GW runs FRR instance, LEAF runs GoBGP.

FRR config:

frr version 8.3.1                                     
frr defaults traditional                              
log syslog informational                              
no ipv6 forwarding                                    
router bgp 64967                                      
 bgp router-id 192.168.15.210                         
 no bgp ebgp-requires-policy                          
 neighbor V4 peer-group                               
 neighbor V4 remote-as 64968                          
 neighbor 192.168.15.238 peer-group V4                
 address-family ipv4 unicast                          
  redistribute connected                              
  neighbor 192.168.15.238 soft-reconfiguration inbound
 exit-address-family                                  
exit                                                  
router bgp 64967 vrf BLUE                          
 bgp router-id 10.10.11.1                             
 no bgp ebgp-requires-policy                          
 neighbor V4 peer-group                               
 neighbor V4 remote-as 64968                          
 neighbor 10.10.11.2 peer-group V4                    
 address-family ipv4 unicast                          
  redistribute connected                              
  neighbor 10.10.11.2 soft-reconfiguration inbound    
 exit-address-family                                  
exit

GoBGP config:

global:
  config:
    as: 64968
    router-id: "192.168.15.238"

zebra:
  config:
    enabled: true
    url: "unix:/var/run/frr/zserv.api"
    redistribute-route-type-list:
    - "connect"
    version: 6
    software-name: "frr8.3"

vrfs:
- config:
    name: "BLUE"
    rd: "64967:2222"
    both-rt-list:
    - "64967:2222"

neighbors:
- config:
    neighbor-address: "192.168.15.210"
    peer-as: 64967
  afi-safis:
  - config:
      afi-safi-name: "ipv4-unicast"
  transport:
    config:
      local-address: "192.168.15.238"
- config:
    neighbor-address: "10.10.11.1"
    peer-as: 64967
    vrf: "BLUE"
  afi-safis:
  - config:
      afi-safi-name: "ipv4-unicast"
  transport:
    config:
      local-address: "10.10.11.2"
      bind-interface: "BLUE"

The peering itself looked ok: gw:

sho bgp summary                                                                                

IPv4 Unicast Summary (VRF default):                                                                    
BGP router identifier 192.168.15.210, local AS number 64967 vrf-id 0                                   
BGP table version 2                                                                                    
RIB entries 3, using 576 bytes of memory                                                               
Peers 1, using 723 KiB of memory                                                                       
Peer groups 1, using 64 bytes of memory                                                                

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.15.238  4      64968         7         8        0    0    0 00:02:13            2        2 N/A 

Total number of neighbors 1                                                                                                                                                        

sho bgp vrf BLUE summary                                                                    

IPv4 Unicast Summary (VRF BLUE):                                                                                                                                      
BGP router identifier 10.10.11.1, local AS number 64967 vrf-id 5                                       
BGP table version 1                                                                                    
RIB entries 1, using 192 bytes of memory                                                               
Peers 1, using 723 KiB of memory                                                                       
Peer groups 1, using 64 bytes of memory                                                                

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
10.10.11.2      4      64968         9        10        0    0    0 00:03:48            0        1 N/A 

Total number of neighbors 1                                                                                                                                                  

leaf:

gobgp neigh
Peer              AS  Up/Down State       |#Received  Accepted
10.10.11.1     64967 00:42:05 Establ      |        2         2
192.168.15.210 64967 00:42:07 Establ      |        3         2

I've added addresses to announce: gw:

ip a add 10.13.13.13/32 dev eth0
ip a add 10.13.15.13/32 dev eth0.1337 # VRF BLUE

leaf:

ip a add 10.13.13.14/32 dev eth0
ip a add 10.13.15.15/32 dev eth0.1337 # VRF BLUE

Addresses are going out from FRR just fine:

gw:

sho ip bgp neighbors 192.168.15.238 advertised-routes                  
BGP table version is 3, local router ID is 192.168.15.210, vrf id 0            
Default local pref 100, local AS 64967                                         
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed                   
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self                       
Origin codes:  i - IGP, e - EGP, ? - incomplete                                
RPKI validation codes: V valid, I invalid, N Not found                         
   Network          Next Hop            Metric LocPrf Weight Path              
*> 10.13.13.13/32   0.0.0.0                  0         32768 ?                 
*> 10.13.13.14/32   0.0.0.0                  0         64968 i           
*> 192.168.15.0/24  0.0.0.0                  0         32768 ?                 
Total number of prefixes 3                                                     

show ip bgp vrf BLUE neighbors 10.10.11.2 advertised-routes          
BGP table version is 2, local router ID is 10.10.11.1, vrf id 5                
Default local pref 100, local AS 64967                                         
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed                   
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self                       
Origin codes:  i - IGP, e - EGP, ? - incomplete                                
RPKI validation codes: V valid, I invalid, N Not found                         
   Network          Next Hop            Metric LocPrf Weight Path              
*> 10.10.11.0/29    0.0.0.0                  0         32768 ?                 
*> 10.13.15.13/32   0.0.0.0                  0         32768 ?                 
Total number of prefixes 2                                                     

leaf:

gobgp neigh 192.168.15.210 adj-in
   ID  Network              Next Hop             AS_PATH              Age        Attrs
   0   10.13.13.13/32       192.168.15.210       64967                00:51:13   [{Origin: ?} {Med: 0}]
   0   10.13.13.14/32       192.168.15.210       64967 64968          00:48:19   [{Origin: i}]
   0   192.168.15.0/24      192.168.15.210       64967                00:51:13   [{Origin: ?} {Med: 0}]
gobgp neigh 10.10.11.1 adj-in
   ID  Network              Next Hop             AS_PATH              Age        Attrs
   0   10.10.11.0/29        10.10.11.1           64967                00:02:37   [{Origin: ?} {Med: 0}]
   0   10.13.15.13/32       10.10.11.1           64967                00:02:37   [{Origin: ?} {Med: 0}]

And everything in default VRF works as expected:

leaf:

K> 0.0.0.0/0 [0/100] via 192.168.15.1, eth0, src 192.168.15.238, 01:23:39 B> 10.13.13.13/32 [20/0] via 192.168.15.210, eth0, weight 1, 00:03:17 C> 10.13.13.14/32 is directly connected, eth0, 00:00:23 C> 192.168.15.0/24 is directly connected, eth0, 01:23:39


However in VRF BLUE gobgp is not picking up local addresses from zebra and not installing the incomming ones:

```sh
gobgp neigh 10.10.11.1 adj-out
Network not in table
vtysh -d zebra -c "show ip route vrf BLUE"
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

VRF BLUE:
C>* 10.10.11.0/29 is directly connected, eth0.1337, 01:23:43
C>* 10.13.15.15/32 is directly connected, eth0.1337, 00:00:30

Am I doing something wrong here?