Category: BGP

LAB VII: BGP communities

Building a case study from the ARCH FLG book; BGP communities.

The idea is to use BGP communities to influence the routing between Autonomous Systems with the following goals in mind:

  • Configure communities to tag the routes per building on each AS.
  • Configure communities as no-export so the routes of AS65001.building2 and AS65002.building2 are not exported through AS65000.
    • The routes will be tagged on R6 and R9 with community 65000:99 and processed on the AS boundry.
    • The routes of AS65001.building1 and AS65002.building1 are allowed to be exported.
  • Configure communities so that R7 and R8 can set their local preference on the AS65000 side.
    • The routes will be tagged on R7 will be tagged with 65000:200 resulting in a local-preference of 200.
    • The routes will be tagged on R8 will be tagged with 65000:300 resulting in a local-preference of 300.
ASBuildingSubnetCommunityDescription
AS65000Building 1 ( Router 1 )10.0.1.0/2465000:5001
AS65000Building 2 ( Router 2 )10.0.2.0/2465000:5002Single uplink to AS65001
AS65000Building 3 ( Router 3 )10.0.3.0/2465000:5003Double uplink to AS65002
AS65000Building 3 ( Router 4 )10.0.3.0/2465000:5003Double uplink to AS65002
AS65001Building 1 ( Router 5 )10.0.111.0/2465001:5102
AS65001Building 2 ( Router 6 )10.0.112.0/2465001:5102
65000:99
Community 65000:99 is used for no-export
AS65002Building 1 ( Router 7 )10.0.221.0/2465002:5202
65000:200
65000:200 is used for local preference 200 in AS65000
AS65002Building 1 ( Router 8 )10.0.221.0/2465002:5201
65000:300
65000:300 is used for local preference 300 in AS65000
AS65002Building 3 ( Router 9 )10.0.222.0/2465002:5202
65000:99
Community 65000:99 is used for no-export

LAB:

LAYER3:

(more…)

BGP Path Attributes

BGP Path Attributes

 

“We Love Oranges AS Oranges Mean Pure Refreshment”

PathDescription
WWeight (highest)
LLocal_pref (higest)
OOriginate (Local)
ASAS_PATH (shortest)
OORIGIN code ( igp > egp > incomplete)
MMED (lowest)
PPaths ( External > Internal)
RRID (Lowest)
R1#sh ip bgp 40.40.40.0
*Mar  1 00:17:21.323: %SYS-5-CONFIG_I: Configured from console by console
R1#sh ip bgp 40.40.40.0
BGP routing table entry for 40.40.40.0/24, version 4
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  30
    3.3.3.2 from 3.3.3.2 (3.3.3.2)
      Origin IGP, metric 0, localpref 100, valid, external, best
  20
    2.2.2.2 from 2.2.2.2 (20.20.20.1)
      Origin IGP, metric 0, localpref 100, valid, external

R1#sh ip bgp
BGP table version is 4, local router ID is 3.3.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 20.20.20.0/24    2.2.2.2                  0             0 20 i
*> 30.30.30.0/24    3.3.3.2                  0             0 30 i
*> 40.40.40.0/24    3.3.3.2                  0             0 30 i
*                   2.2.2.2                  0             0 20 i

(more…)

BGP Filtering

  • BGP filtering can be done on any routers
  • Filtering can be done inbound and outbound
  • After filtering is applied BGP neighbor must be reset or cleared for the filter to take effect
    • clear ip bgp 20.20.20.20 in/out  preferred
    • clear ip bgp *   (hard reset)
    • clear ip bgp 20.20.20.20 soft in/out

(more…)

BGP Next-hop & iBGP switching

sh ip bgp

R1#sh ip bgp
BGP table version is 6, local router ID is 10.10.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
     0.0.0.0          0.0.0.0                                0 i
 r>  1.1.1.0/30       20.20.20.1               0             0 20 ?
 r>  20.20.20.0/24    20.20.20.1               0             0 20 ?
 *>  30.30.30.0/24    20.20.20.1               0             0 20 ?
 *>i 40.40.40.0/24    1.1.2.2                  0    100      0 i

(more…)

BGP Routing

Injecting routes into BGP.

  • Use the network command.
    • Different than the network command in iGP; it isn’t used to listen/active interfaces.
    • the BGP network command looks for the prefix in the routing table and originates that into the BGP table.
    • If no mask is defined, IOS assumes a classful network.
    • Classful route is added if:
      • the exact route is in the ip routing table
      • Any subset of routes are in the routing table (only with auto-summery)
    • create a null0 route
      •  ip route 30.30.30.0 255.255.255.0 null0
router bgp 20
 bgp log-neighbor-changes
 network 30.30.30.0 mask 255.255.255.0
 neighbor 10.10.10.1 remote-as 10
 neighbor 10.10.10.1 ebgp-multihop 255
 neighbor 10.10.10.1 update-source Loopback1

(more…)

BGP AS Path

  • Multiple path attributes to determine the best path for a certain prefix.
  • When no path attributes are set, BGP uses the AS_PATH to determine the best route.
    • Shortest AS path wins
  • AS_SEQ is the component of the AS_PATH attribute.
    • 10.10.10.0/24 20 10
      • AS-SEQ (in order)
  • With summarization:
    • 10.10.0.0/16 20 10 { 1 2 5 4 3 }  
    • Prefix AS-PATH AS-SEQ  { AS-SET } 
      • AS-SET are not in order
  • Prevents Routing loops.
  • If a BGP router received an update with it’s own AS#, it indicates a loop.
  • If a BGP router received an update with it’s own AS#, it drops the route.

BGP Message types

BGP message types

New relation between two BGP peers:


  • Open
    • type 1
    • Version4 (ipv4), AS#, Hold time, Router-iD, parameters.

(more…)

BGP Neighbor states

  • idle:
    • BGP is down or waiting next retry
  • Connect:
    • The BGP is waiting for the TCP connection to be completed
  • Active:
    • The TCP Connection failed, Connect-retry timer running, listening for incoming TCP Connections
  • Opensent:
    • The TCP connection exists and a BGP Open Message as been send.
    • The matching Open Message has not yet been received
  • Openconfirm:
    • Open Message has been send and received
  • Established:
    • All neighbor parameters match
    • Relationship works
    • Peers can exchange update messages

eBGP Update-source & multihop

  • Local router find the outgoing interface for the neighbor
  • the IP of the outgoing interface is used as the source IP by default.
  • With one link a failure in that link can lose the neighborship.
    •  configure two neighbor commands
    • Use the loopback interfaces as TCP endpoints
  • Loopback links between two AS might miss the route to the peer’s loopback
    • fixed with multihop (TTL=255 instead of TTL=1).

      • create routes between peers to reach loopback address.
      • configure update-source so the right source-ip is used.
R10#(config)router bgp 10
R10#(config-router)neighbor 20.20.20.20 remote-as 20
R10#(config-router)neighbor 20.20.20.20 ebgp-multihop
R10#(config-router)neighbor 20.20.20.20 update-source loopback0

R20#(config)router bgp 20
R20#(config-router)neighbor 10.10.10.10 remote-as 10
R20#(config-router)neighbor 10.10.10.10 ebgp-multihop
R20#(config-router)neighbor 10.10.10.10 update-source loopback0

iBGP – eBGP

 

 eBGPiBGP
External BGPInternal BGP
NeighborBetween differnet ASWithin the same AS
Route updatesRoutes are send to eBGP peers by defaultRoutes are not send to BGP peers by default
AS path additionyesno
Administrative distance20200
TopologyDoes not require a full meshFull mesh or Route reflectors or Confedoration
Loop Preventionas-pathBGP split horizon

(more…)