[Enterprise SONiC] BGP Step 2.1 Redistribute routes to BGP process (Optional) Follow
Tested model & firmware version:
- Switch model name:
DCS203 (AS7362-56X)
DCS204 (AS7726-32X)
DCS201~202 [AS5835-54X(T)]
- Edgecore SONiC version:
202006.4
202012.2 ~ 202012.4
202111.0 ~ 202111.3
Procedure: Enter Vty shell and BGP ASN
sonic# configure terminal
sonic(config)# router bgp 65101
sonic(config-router)# address-family ipv4 unicast // Enter address-family ipv4
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# redistribute kernel
sonic(config-router-af)# redistribute static
sonic(config-router)# end
Note: This configuration example says that redistribute connected route, kernel route and static route to BGP process
Address-family: Multiprotocol extensions enable BGP to carry routing information for multiple network layer protocols. BGP supports an Address Family Identifier (AFI) for IPv4 and IPv6.
sonic(config-router)# address-family
ipv4 Address Family
ipv6 Address Family
l2vpn Address Family
Note: Route redistribution is used to learn from one routing protocol (static, connected route, and OSPF ....) available to a different routing protocol.
sonic(config-router-af)# redistribute
babel Babel routing protocol (Babel) [TBD]
connected Connected routes (directly attached subnet or host)
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) [TBD]
isis Intermediate System to Intermediate System (IS-IS)
kernel Kernel routes (not installed via the zebra RIB)
nhrp Next Hop Resolution Protocol (NHRP) [TBD]
openfabric OpenFabric Routing Protocol [TBD]
ospf Open Shortest Path First (OSPFv2)
rip Routing Information Protocol (RIP) [TBD]
static Statically configured routes
table Non-main Kernel Routing Table [TBD]
vnc Virtual Network Control (VNC) [TBD]
vnc-direct VNC direct (not via zebra) routes [TBD]
Note: Currently, SONiC FRRouting supports redistribute connected, isis, kernel, OSPF, and static only.
Note: Kernel routes and static routes are different, Kernel routes are configured by Linux command, and static routes are configured by FRR.
For example:
FRR:
sonic# configure terminal
sonic(config)# ip route 0.0.0.0/0 192.168.1.254
sonic# show ip route
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, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route
S>* 0.0.0.0/0 [1/0] via 192.168.1.254, Ethernet48, 00:02:19
Linux command:
Caution: this setting will restore to the default after rebooting the switch.
admin@sonic:~$ sudo ip route add 0.0.0.0/0 via 192.168.1.254
admin@sonic:~$ show ip route
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, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route
K>* 0.0.0.0/0 [0/0] via 192.168.1.254, Ethernet48, 00:00:08
Comments
1 comment
Thank you this is very useful.
is there a way to do it through the /etc/sonic/config_db.json file?
Please sign in to leave a comment.