This article will show you how to create BGP sessions on Ufispace devices, as well as some examples of filters, prefix lists and community application.
To work out the configurations, the following scenario will be used:
BGP Ufispace: 10.0.0.1
Neighbor BGP: 10.0.0.2
AS Local: 65000
AS Remoto: 65010
Prefixo BGP local: 200.0.0.0/22
Prefixo BGP remoto: 210.0.0.0/22
BGP Policy: Default route announcement + local prefix
; Accept only the 210.0.0.0/22 prefix with community tag 65000:1000
; Both using a route map
Default route prefix list configuration:
ip prefix-list DEFAULT-ROUTE
permit 0.0.0.0/0
Prefix-List configuration with prefixes 200.0.0.0/22 and 210.0.0.0/22, allowing up to /24:
ip prefix-list LAB_NETWORK
permit 200.0.0.0/22 le 24
ip prefix-list CUSTOMER-AS-65010
permit 210.0.0.0/22 le 24
Route-Map configuration allowing ASN prefix 65010 and marking community 65000:1000 :
route-map CUSTOMER-AS-65010-IN permit 10
match ip address prefix-list CUSTOMER-AS-65010
set community 65000:1000
route-map CUSTOMER-AS-65010-IN deny 5000
Route-Map configuration to announce default route and 200.0.0.0/22 prefix:
route-map CUSTOMER-AS-65010-OUT permit 10
match ip address prefix-list DEFAULT-ROUTE
route-map CUSTOMER-AS-65010-OUT permit 20
match ip address prefix-list LAB_NETWORK
route-map CUSTOMER-AS-65010-OUT deny 5000
Configuration of blackhole routes (to avoid static loops and create routes in the routing table):
ip route 200.0.0.0/22 null
ip route 200.0.0.0/23 null
ip route 200.0.2.0/23 null
Access BGP configuration by entering the Local AS:
router bgp 65000
Configure Router-ID
bgp router-id 10.99.99.1
IPv4 network configuration:
address-family ipv4
network 200.0.0.0/22
network 200.0.0.0/23
network 200.0.2.0/23
exit
BGP neighbor configuration:
neighbor 10.0.0.2 remote-as 65010
neighbor 10.0.0.2 description CUSTOMER-AS-65010
Configuring BGP filters:
address-family ipv4
neighbor 10.0.0.2 activate
neighbor 10.0.0.2 route-map CUSTOMER-AS-65010-OUT out
neighbor 10.0.0.2 route-map CUSTOMER-AS-65010-IN in
exit
Check configuration and apply:
exit
show transaction current
commit
exit
To check the status of the BGP session:
OcNOS#show ip bgp summary
BGP router identifier 10.99.99.1, local AS number 65000
BGP table version is 2
2 BGP AS-PATH entries
1 BGP community entries
Neighbor V AS MsgRcv MsgSen TblVer InQ OutQ Up/Down State/PfxRcd
10.0.0.2 4 65010 611 619 2 0 0 00:06:21 3
Check what is being announced in the BGP session:
OcNOS#show ip bgp neighbors 10.0.0.2 advertised-routes
Address family: IPv4 Unicast
BGP table version is 2, local router ID is 10.99.99.1
Status codes: s suppressed, d damped, a add-path, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 200.0.0.0/22 10.0.0.1 0 100 32768 i
*> 200.0.0.0/23 10.0.0.1 0 100 32768 i
*> 200.0.2.0/23 10.0.0.1 0 100 32768 i
Check what we have received as a prefix:
OcNOS#show ip bgp neighbors 10.0.0.2 routes
BGP table version is 2, local router ID is 10.99.99.1
Status codes: s suppressed, d damped, h history, a add-path, * valid, > best, i - internal,
l - labeled, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 210.0.0.0/22 10.0.0.2 0 100 0 65010 i
*> 210.0.0.0/23 10.0.0.2 0 100 0 65010 i
*> 210.0.2.0/23 10.0.0.2 0 100 0 65010 i
Summary of all settings applied
!
ip prefix-list CUSTOMER-AS-65010
seq 5 permit 210.0.0.0/22 le 24
!
ip prefix-list DEFAULT-ROUTE
seq 5 permit 0.0.0.0/0
!
ip prefix-list LAB_NETWORK
seq 5 permit 200.0.0.0/22 le 24
!
route-map CUSTOMER-AS-65010-IN permit 10
match ip address prefix-list CUSTOMER-AS-65010
set community 65000:1000
!
route-map CUSTOMER-AS-65010-IN deny 5000
!
route-map CUSTOMER-AS-65010-OUT permit 10
match ip address prefix-list DEFAULT-ROUTE
!
route-map CUSTOMER-AS-65010-OUT permit 20
match ip address prefix-list LAB_NETWORK
!
route-map CUSTOMER-AS-65010-OUT deny 5000
!
router bgp 65000
bgp router-id 10.99.99.1
neighbor 10.0.0.2 remote-as 65010
neighbor 10.0.0.2 description CUSTOMER-AS-65010
!
address-family ipv4 unicast
network 200.0.0.0/22
network 200.0.0.0/23
network 200.0.2.0/23
neighbor 10.0.0.2 activate
neighbor 10.0.0.2 route-map CUSTOMER-AS-65010-IN in
neighbor 10.0.0.2 route-map CUSTOMER-AS-65010-OUT out
exit-address-family
!