BGP Configuration on Asterfusion Enterprise SONiC Distribution Switch
1 Purpose
This article mainly explains the BGP configuration and solution on Asterfusion enterprise SONiC switches.
By reading this article, users can quickly understand and master the configuration method of BGP on the Asterfusion SONiC switch.
2 Model and Version
Model:
CX-N series switches
Version:
AsterNOSv3.1
3 BGP introduction
BGP (Border Gateway Protocol) is a distance vector routing protocol that implements reachability between ASs (Autonomous Systems) and selects the best route. Defined by RFC4271.
AS (Autonomous System) represents an independent network collection composed of a group of routers and network devices. Each autonomous system has a unique autonomous system number (Autonomous System Number, ASN), which is used to identify and identify the autonomous system. All routers in an AS must be connected to each other and run the same routing protocol.
MP-BGP (Multiprotocol Extensions for BGP-4). Traditional BGP-4 can only manage IPV4 routing information. Applications that use other network layer protocols (such as ipv6) are subject to certain restrictions when propagated across autonomous systems. In order to provide support for multiple network layer protocols, the IETF extended BGP-4 to form MP-BGP, which is defined by RFC4760 and RFC7606.
4 Basic BGP configuration instructions
CX-N series switches running AsterNOS support MP-BGP protocol, ECMP, and linkage with BFD, thereby providing a multi-protocol-supported and stable network for the data center network.
4.1 Configure AS number and router-id
router bgp asn
bgp router-id ip_addr
# Configure local AS number.
# Configure router id.
Example:
sonic(config)# router bgp 65001
sonic(config-router)# bgp router-id 172.16.0.1
4.2 Configure BGP neighbors
router bgp asn
neighbor neighbor_ip remote-as asn
# Enter bgp view, asn is the local as number.
# Add a bgp neighbor, neighbor_ip is the neighbor’s IP address, and asn is the neighbor’s AS number.
Example:
sonic(config)# router bgp 65001
sonic(config-router)# neighbor 10.0.10.11 remote-as 65002
4.3 Configure the AS-Path relax switch
This switch determines how the same route from different AS domains is handled:
When the switch is turned on, the next hop of the same route from different AS domains will be an ecmp group; at this time, traffic load balancing can be achieved.
When the switch is turned off, only one route will be selected for delivery.
router bgp asn
bgp bestpath as-path multipath-relax as-set
# Enter bgp view, asn is the local as number.
# Turn on the AS-Path relax switch.
Example:
sonic(config)# router bgp 65001
sonic(config-router)# bgp bestpath as-path multipath-relax as-set
4.4 Configure BGP and BFD association
router bgp asn
neighbor {ipaddr | hostname} bfd
# Enter bgp view, asn is the local as number.
# bfd bind bgp session.
Example:
sonic(config)# router bgp 65001
sonic(config-router)# neighbor 10.0.11.11 bfd
5 BGP configuration typical case
5.1 Requirements
The user has two servers and requires the hosts to be connected through three switches and run the BGP protocol. Enable server-1 connected leaf1 and server-2 connected leaf2 to communicate with each other.
5.2 Topology

5.3 Testing environment
5.3.1 Hardware
DEVICE | MODEL | HAREWARE INDICATORS | QUANTITY | NOTE |
---|---|---|---|---|
Spine switch | CX308P-48Y-N-V2 | Refer to Product manual | 1 | |
Leaf switch | CX308P-48Y-N-V2 | Refer to Product manual | 2 | |
Server | X86 | Normal server | 2 | |
Optical module | Multi-mode | 10G SFP+ | 8 | |
Optical fiber | Multi-mode | 10G | 4 |
5.3.2 Software
SOFTWARE | VERSION | NOTE |
---|---|---|
Switch system | AsterNOSv3.1 | |
Server system | CentOS Linux 7.8.2003 |
5.3.3 Management IP
DEVICE NAME | INTERFACE | IP ADDRESS | NOTE |
---|---|---|---|
Spine | Mgmt0 | 10.230.1.31 | |
Leaf1 | Mgmt0 | 10.230.1.21 | |
Leaf2 | Mgmt0 | 10.230.1.22 | |
Server1 | Eth0 | 10.230.1.11 | |
Server2 | Eth0 | 10.230.1.12 |
5.3.4 Interconnection IP
DEVICE NAME | INTERFACE | IP ADDRESS | NOTE |
---|---|---|---|
Spine | Ethernet 0/1 | 10.0.10.1/24 | |
Spine | Ethernet 0/2 | 10.0.11.1/24 | |
Spine | Loopback 0 | 172.16.0.1/32 | |
Leaf1 | Ethernet 0/1 | 192.168.0.1/24 | |
Leaf1 | Ethernet 0/2 | 10.0.10.11/24 | |
Leaf1 | Loopback 0 | 172.16.0.2/32 | |
Leaf2 | Ethernet 0/1 | 192.168.1.1/24 | |
Leaf2 | Ethernet 0/2 | 10.0.11.11/24 | |
Leaf2 | Loopback 0 | 172.16.0.3/32 | |
Server1 | Eth0 | 192.168.0.11/24 | |
Server2 | Eth0 | 192.168.1.11/24 |
5.4 Preparation before testing
Ensure each device is correctly connected according to the topology diagram.
5.5 Configuration steps
Step 1 Configure the interconnection IP addresses of three switches
Spine
sonic# configure terminal
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# ip address 10.0.10.1/24
sonic(config-if-0/1)# interface ethernet 0/2
sonic(config-if-0/2)# ip address 10.0.11.1/24
sonic(config-if-0/2)# exit
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.16.0.1/32
sonic(config-loif-0)# exit
Leaf1
sonic# configure terminal
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# ip address 192.168.0.1/24
sonic(config-if-0/1)# interface ethernet 0/2
sonic(config-if-0/2)# ip address 10.0.10.11/24
sonic(config-if-0/2)# exit
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.16.0.2/32
sonic(config-loif-0)# exit
Leaf2
sonic# configure terminal
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# ip address 192.168.1.1/24
sonic(config-if-0/1)# interface ethernet 0/2
sonic(config-if-0/2)# ip address 10.0.11.11/24
sonic(config-if-0/2)# exit
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.16.0.3/32
sonic(config-loif-0)# exit
Step 2 Configure bgp of three switches
Spine
sonic(config)# router bgp 65001
sonic(config-router)# bgp router-id 172.16.0.1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.0.10.11 remote-as 65002
sonic(config-router)# neighbor 10.0.11.11 remote-as 65003
sonic(config-router)# address-family ipv4
sonic(config-router-af)# redistribute connected
Leaf1
sonic(config)# router bgp 65002
sonic(config-router)# bgp router-id 172.16.0.2
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.0.10.1 remote-as 65001
sonic(config-router)# address-family ipv4
sonic(config-router-af)# redistribute connected
Leaf2
sonic(config)# router bgp 65003
sonic(config-router)# bgp router-id 172.16.0.3
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.0.11.1 remote-as 65001
sonic(config-router)# address-family ipv4
sonic(config-router-af)# redistribute connected
Step 3 Configure the IP addresses of two servers
Server1
[root@localhost ~]# ifconfig eth0 192.168.0.11/24
[root@localhost ~]# route add default gw 192.168.0.1
Server2
[root@localhost ~]# ifconfig eth0 192.168.1.11/24
[root@localhost ~]# route add default gw 192.168.1.1
5.6 Verify network configuration
1. Each server can ping each other successfully.
2. Check the bgp status of each switch.
Spine
sonic# show bgp summary

Leaf1
sonic# show bgp summary

Leaf2
sonic# show bgp summary

From the results, we can see that the bgp status of each switch is normal.
6 Conclusion
In this test, two servers can ping each other, and three switches can establish BGP neighbors and transmit routing information, indicating that the bgp functions of each switch are normal.
Asterfusion CX-N & CX-M SONiC switches as the links below
CX-N series switches
CX-M series switches
If you have more technical questions, feel free to propose a ticket on our https://help.cloudswit.ch/portal/en/signin