centos8 frr bgp for calico

[root@host-10-10-18-31 ~]# dnf install -y frr
Last metadata expiration check: 0:01:19 ago on Thu 24 Jun 2021 10:54:30 AM CST.
Dependencies resolved.
============================================================================================================================================================================================================================================================
 Package                                                              Arch                                              Version                                                                   Repository                                           Size
============================================================================================================================================================================================================================================================
Installing:
 frr                                                                  aarch64                                           7.5-4.el8                                                                 AppStream                                           3.0 M
Installing dependencies:
 libyang                                                              aarch64                                           1.0.184-1.el8                                                             AppStream                                           442 k
 mariadb-connector-c                                                  aarch64                                           3.1.11-2.el8_3                                                            AppStream                                           193 k
 mariadb-connector-c-config                                           noarch                                            3.1.11-2.el8_3                                                            AppStream                                            15 k
 net-snmp                                                             aarch64                                           1:5.8-20.el8                                                              AppStream                                           354 k
 net-snmp-agent-libs                                                  aarch64                                           1:5.8-20.el8                                                              AppStream                                           682 k
 lm_sensors-libs                                                      aarch64                                           3.4.0-22.20180522git70f7e08.el8                                           BaseOS                                               58 k
 net-snmp-libs                                                        aarch64                                           1:5.8-20.el8                                                              BaseOS                                              798 k

Transaction Summary
============================================================================================================================================================================================================================================================
Install  8 Packages
[root@host-10-10-18-31 ~]# cp /usr/share/doc/frr/bgpd.conf.sample /etc/frr//bgpd.conf
[root@host-10-10-18-31 ~]# 

开启bgp

root@host-10-10-18-31 ~]# vi /etc/frr/daemons
# This file tells the frr package which daemons to start.
#
# Sample configurations for these daemons can be found in
# /usr/share/doc/frr/examples/.
#
# ATTENTION:
#
# When activating a daemon for the first time, a config file, even if it is
# empty, has to be present *and* be owned by the user and group "frr", else
# the daemon will not be started by /etc/init.d/frr. The permissions should
# be u=rw,g=r,o=.
# When using "vtysh" such a config file is also needed. It should be owned by
# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too.
#
# The watchfrr, zebra and staticd daemons are always started.
#
bgpd=yes
[root@host-10-10-18-31 ~]# systemctl restart frr
[root@host-10-10-18-31 ~]# vtysh

Hello, this is FRRouting (version 7.5).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
host-10-10-18-31# conf t
host-10-10-18-31(config)# no router bgp 7675
host-10-10-18-31(config)# router bgp 64513
host-10-10-18-31(config-router)# neighbor 10.10.16.82 remote-as 64512
host-10-10-18-31(config-router)# exit
host-10-10-18-31(config)# exit
host-10-10-18-31# wr
Note: this version of vtysh never writes vtysh.conf
Building Configuration...
Configuration saved to /etc/frr/zebra.conf
Can't backup old configuration file /etc/frr/bgpd.conf.sav.
Configuration saved to /etc/frr/staticd.conf
host-10-10-18-31# 
host-10-10-18-31# sh ip bgp sum

IPv4 Unicast Summary:
BGP router identifier 10.10.18.31, local AS number 64513 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
10.10.16.82     4      64512         0         0        0    0    0    never       Active        0

Total number of neighbors 1
host-10-10-18-31# sh ip bgp route
This VRF is not importing IPv4 Unicast routes from any other VRF
This VRF is not exporting IPv4 Unicast routes to any other VRF
host-10-10-18-31# 
root@ubuntu:~# telnet 10.10.18.31 179
Trying 10.10.18.31...
Connected to 10.10.18.31.
Escape character is '^]'.
^C
^C^C^C^C

 第一个leaf1

host-10-10-18-31# sh ip bgp sum

IPv4 Unicast Summary:
BGP router identifier 10.10.18.31, local AS number 64513 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
10.10.16.82     4      64512         0         0        0    0    0    never       Active        0

Total number of neighbors 1
host-10-10-18-31# show running-config
Building configuration...

Current configuration:
!
frr version 7.5
frr defaults traditional
hostname host-10-10-18-31
no ip forwarding
no ipv6 forwarding
hostname bgpd
log stdout
no service integrated-vtysh-config
!
password zebra
!
router bgp 64513
 neighbor 10.10.16.82 remote-as 64512
!
line vty
!
end
host-10-10-18-31# 
root@ubuntu:~#  ./calicoctl get bgpconfig
NAME      LOGSEVERITY   MESHENABLED   ASNUMBER   
default   Info          false         64512      

root@ubuntu:~# 

原来是frr 和calico  node 的as nu 不一致

[root@host-10-10-18-31 ~]# vtysh

Hello, this is FRRouting (version 7.5).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

host-10-10-18-31# conf t
host-10-10-18-31(config)# no router bgp 64513
host-10-10-18-31(config)# router bgp 64512
host-10-10-18-31(config-router)# neighbor 10.10.16.82 remote-as 64512
host-10-10-18-31(config-router)# exit
host-10-10-18-31(config)# exit
host-10-10-18-31# wr
Note: this version of vtysh never writes vtysh.conf
Building Configuration...
Configuration saved to /etc/frr/zebra.conf
Can't backup old configuration file /etc/frr/bgpd.conf.sav.
Configuration saved to /etc/frr/staticd.conf
host-10-10-18-31# show running-config
Building configuration...

Current configuration:
!
frr version 7.5
frr defaults traditional
hostname host-10-10-18-31
no ip forwarding
no ipv6 forwarding
hostname bgpd
log stdout
no service integrated-vtysh-config
!
password zebra
!
router bgp 64512
 neighbor 10.10.16.82 remote-as 64512
!
line vty
!
end
host-10-10-18-31# 
root@ubuntu:~# cat rr1-to-leaf1-peer.yaml 
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
  name: rr1-to-leaf1-peer        ## 给BGPPeer取一个名称,方便识别

spec:
  nodeSelector: rr-id == 'rr1'   ## 通过节点选择器添加有rr-id == 'rr1'标签的节点

  peerIP: 10.10.18.31          ##  leaf01交换机的地址
  asNumber:  64512                ##  leaf01交换机的AS号
root@ubuntu:~# ./calicoctl  apply -f rr1-to-leaf1-peer.yaml 
Successfully applied 1 'BGPPeer' resource(s)
root@ubuntu:~# ./calicoctl node status
Calico process is running.

IPv4 BGP status
+--------------+---------------+-------+----------+--------------------------------+
| PEER ADDRESS |   PEER TYPE   | STATE |  SINCE   |              INFO              |
+--------------+---------------+-------+----------+--------------------------------+
| 10.10.16.251 | node specific | start | 03:18:48 | Active Socket: Connection      |
|              |               |       |          | closed                         |
| 10.10.16.47  | node specific | start | 03:18:48 | Active Socket: Connection      |
|              |               |       |          | closed                         |
| 10.10.16.81  | node specific | wait  | 03:18:48 | Established                    |
| 10.10.18.31  | node specific | up    | 03:21:50 | Established                    |
+--------------+---------------+-------+----------+--------------------------------+

IPv6 BGP status
No IPv6 peers found.

root@ubuntu:~# 
host-10-10-18-31# sh ip bgp sum

IPv4 Unicast Summary:
BGP router identifier 10.10.18.31, local AS number 64512 vrf-id 0
BGP table version 0
RIB entries 3, using 576 bytes of memory
Peers 1, using 21 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
10.10.16.82     4      64512        11         8        0    0    0 00:05:34            2        0

Total number of neighbors 1

 第二个leaf2

[root@host-10-10-18-34 ~]#  systemctl restart frr
[root@host-10-10-18-34 ~]# systemctl stop firewalld.service
[root@host-10-10-18-34 ~]# vtysh

host-10-10-18-31# conf t
host-10-10-18-31(config)# router bgp 64512
host-10-10-18-31(config-router)# no neighbor 10.10.16.82 remote-as 64512
host-10-10-18-31(config-router)# exit
host-10-10-18-31(config)# exit
host-10-10-18-31# wr
Note: this version of vtysh never writes vtysh.conf
Building Configuration...
Configuration saved to /etc/frr/zebra.conf
Can't backup old configuration file /etc/frr/bgpd.conf.sav.
Configuration saved to /etc/frr/staticd.conf
host-10-10-18-31# sh run
Building configuration...


Current configuration:
!
frr version 7.5
frr defaults traditional
hostname host-10-10-18-31
no ip forwarding
no ipv6 forwarding
hostname bgpd
log stdout
no service integrated-vtysh-config
!
password zebra
!
router bgp 64512
neighbor 10.10.16.47 remote-as 64512
!
line vty
!
end

 
原文地址:https://www.cnblogs.com/dream397/p/14926018.html