Showing posts with label BGP. Show all posts
Showing posts with label BGP. Show all posts

Thursday, September 24, 2015

Facts to remember about BGP - Part 5

BGP Filtering with Maximum Prefix
Configure R8 so that the peering session to R10 is torn down if R8 learns more than 20 BGP prefixes from that neighbor.
  • When 16 prefixes are received from R10, R8 should begin generating warning messages.
  • When down, the peering should attempt to restart after three minutes.
Configure R7 so that if it receives 20 prefixes from R3, a warning message is generated, but the peering session is NOT terminated.
R8:
router bgp 200
 neighbor 155.1.108.10 maximum-prefix 20 80 restart 3

R7:
router bgp 300
 neighbor 155.1.37.3 maximum-prefix 20 100 warning-only


BGP Default Routing
  • Configure R2 to originate a default route to R3 and R5 via BGP.
  • This default route should be withdrawn if R2's link to R10 goes down.
R2:
ip prefix-list LINK_TO_R10 permit 192.10.1.0/24
!
route-map DEFAULT permit 10
 match ip address prefix-list LINK_TO_R10
!
router bgp 200
 neighbor 155.1.23.3 default-originate route-map DEFAULT
 neighbor 155.1.0.5 default-originate route-map DEFAULT


BGP Local AS / Local AS No prepend
  • When planning to change your AS number but not all your eBGP peerings are ready
  • "Local AS" lets you to advertise the old and new AS number to the eBGP peerings
  •  The external peers will see both the local-AS and the real AS number prepended in front of the AS_PATH
  • If you specify the no-prepend keyword, any routes received from the eBGP peer will not have <OldAS> prepended upon reception.
  • The no-prepend option applies to incoming updates and not outgoing which
  • In the next examples R2 change its AS number to 2 but .R1 still doesn't know about it because it has no changed its configuration

This is an example with local-as

R1                                                                             R2
router bgp 1                                                              router bgp 2
 network 10.10.10.0 mask 255.255.255.0                    neighbor 192.168.2.1 remote-as 1
 neighbor 192.168.2.2 remote-as 200                           neighbor 192.168.2.1 local-as 200

R2#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    192.168.2.1              0             0 200 1 i



In this example with local-as/no-prepend, the AS number 200 disappear in AS-PATH updates comming from R1

R1                                                                             R2
router bgp 1                                                              router bgp 2
 network 10.10.10.0 mask 255.255.255.0                    neighbor 192.168.2.1 remote-as 1
 neighbor 192.168.2.2 remote-as 200                           neighbor 192.168.2.1 local-as 200 no-prepend

R2#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    192.168.2.1              0             0 1 i



BGP Local AS Replace-AS/Dual-AS
Sometimes it is desirable to completely hide the “real” AS number (the one configured via the router bgp <RealAS> command).

In this example R1 is receiving updates from R2 only with the local-as number

R1                                                                  R2
router bgp 1                                                    router bgp 2
 network 10.10.10.0 mask 255.255.255.0      neighbor 192.168.2.1 remote-as 1
 neighbor 192.168.2.2 remote-as 200             neighbor 192.168.2.1 local-as 200 no-prepend replace-as

R1#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    0.0.0.0                  0         32768 i
*> 22.22.22.0/24    192.168.2.2              0             0 200 i


The parameter "dual-as" (Optional) Configures the eBGP neighbor to establish a peering session using the real autonomous system number (from the local BGP routing process) or by using the autonomous-system number configured with the ip-address argument (local-as).

 Router(config-router)# neighbor 10.3.3.33 local-as 300 no-prepend replace-as dual-as




BGP Remove Private AS
  • Private AS numbers in the range 64512–65535 are often assigned to small enterprises that use BGP to peer with their ISPs
  • remove-private-as remove privates AS numbers at the begining of AS_PATH
  • when the private AS sequence is not located in the beginning of the AS_PATH, the stripping will not work and the AS_PATH will remain unmodified.
R2:
router bgp 200
 neighbor 192.10.1.254 remove-private-as


BGP Outbound Route Filtering
  • Allows a BGP peer to “push” a filter to the remote neighbor. 
  • Applying filtering outbound on the remote peer instead of inbound on the local peer significantly decreases the amount of routing information sent across the link
  • There are two types of ORF filters defined in IETF’s draft: prefix-list based and community based. Cisco supports the first one
  • The willingness for using ORF must be enable in both peers with the command. neighbor <IP> capability orf prefix-list [send|receive|both]
  • To configure and push an ORF, you must define a prefix list and apply it to the peer’s session using the command neighbor <IP> prefix-list <NAME> in. The list must be inbound, because this is the natural direction for ORF
R7:
router bgp 300
 neighbor 155.1.67.6 capability orf prefix-list both

R6:
ip prefix-list ORF deny 112.0.0.0/8
ip prefix-list ORF deny 114.0.0.0/8
ip prefix-list ORF permit 0.0.0.0/0 le 32
!
router bgp 100
 neighbor 155.1.67.7 capability orf prefix-list both
 neighbor 155.1.67.7 prefix-list ORF in


BGP Next-Hop Trigger
  • Before BGP was accounting for IGP information changes only during periodic BGP scans with the interval defined by the command bgp scan-time <seconds> (default 60 segs)
  • Now BGP process registers the NEXT_HOP attribute values with the RIB table watch process. As soon as any change that affects an existing NEXT_HOP occurs, the watch process notifies the BGP router process. If the change results in prefix withdrawn, the BGP process immediately removes the prefix. 
  • All other notification are delayed and batched until the time-interval specified by the command bgp nexthop trigger delay <seconds> expires. After this, a full BGP table walk occurs, performing best-path computations for all prefixes
In this example R3 will respond to BGP prefixes’ next-hop changes within 30 seconds of IGP prefix change
router bgp 200
 bgp nexthop trigger delay 30



BGP TTL Security
  • This command applies to eBGP peering sessions only (either directly-connected or multihop) and specifies the number of hops the remote peer could be away from the local speaker. 
  • Remember that the internal BGP sessions are not protected, and therefore the internal network is assumed to be “trusted.” All incoming TCP packets targeted at the BGP port with an IP TTL value below (255 - <hop-count>) are silently discarded by the router
R3:
router bgp 200
 neighbor 155.1.13.1 ttl-security hops 1
 neighbor 155.1.37.7 ttl-security hops 1



BGP AllowAS in

  • Cisco IOS allows for accepting the prefixes with the local AS number from a specific peer using the command "neighbor <IP> allowas-in [<count>]". Here, <count> is the number of the local AS number occurrences in the AS_PATH attribute, which defaults to three. This parameter serves a purpose similar to the hop-count limit in distance-vector protocol and implements the well-known count-to-infinity loop prevention technique.
  • Specifically, only one “partition” or border peer can implement summarization, or summarization should not be used at all. Otherwise, the upstream ASs will have trouble selecting the proper entry point to the AS partitions

R3:
router bgp 200
 neighbor  155.1.13.1 allowas-in



Monday, September 21, 2015

Facts to remember about BGP - Part 4

BGP Backdoor (it is a hidden command)
  • Change the distance of an eBGP prefix from 20 to 200 to prefer routes advertised by IGP
  • The syntax of the command is:  network <subnet> mask <netmask> backdoor
  • It uses the network command but it is not for advertising any route
In this example RTA knows about 160.10.0.0 by RTB and RTC, but it chooses the route by RTC cause a lower AD (90 vs 20). With backdoor we change eBGP AD (20) to iBGP AD (200) only for this prefix so RTA will choose RTB instead

RTA# 
router eigrp 10 
network 150.10.0.0 

router bgp 100 
neighbor 2.2.2.1 remote-as 300 
network 160.10.0.0 backdoor 








BGP Aggregation / BGP Aggregation - Summary Only
  • There must be a subnet in the BGP table that is encompassed by the summarized prefix.
  • For every aggregate, An automatic static route to Null0 will be installed to prevent routing loops. The aggregate addresses must be in the BGP table (Loc-RIB), but it does not necessarily need to be in the router’s routing table (RIB).
  • The original (specific) prefixes are still advertised, unlike in IGP where summarization automatically suppresses more specific prefixes
  • The syntax for the command is aggregate-address <prefix> <mask>
  • To generate just the summary prefix, use the option summary-only after the aggregate-address command.


BGP Aggregation - Suppress Map
There is a big difference how to supress prefixes from the summary advertised route with route-map PERMIT and DENY. Check the examples

Make the summary prefix 150.1.0.0/16 for the networks  150.1.1.0/24, 150.1.2.0/24 and 150.1.3.0/24 but supress only the network 150.1.1.0/24
ip prefix-list SUPPRESS_PREFIX 150.1.1.0/24
!
route-map SUPPRESS_MAP permit 10
 match ip address prefix-list SUPPRESS_PREFIX
!
router bgp 200
 aggregate-address 150.1.0.0 mask 255.255.0.0 suppress-map SUPPRESS_MAP

Make the summary prefix 150.1.0.0/16 for the networks  150.1.1.0/24, 150.1.2.0/24 and 150.1.3.0/24. Supress all the networks but exclude only the network 150.1.1.0/24
ip prefix-list SUPPRESS_PREFIX 150.1.1.0/24
!
route-map SUPPRESS_MAP deny 10
 match ip address prefix-list SUPPRESS_PREFIX
!
router bgp 200
 aggregate-address 150.1.0.0 mask 255.255.0.0 suppress-map SUPPRESS_MAP



BGP Aggregation - Unsuppress Map
  • Can only be configured on the router that performs prefix aggregation using the command aggregate-address with summary-only
  • Applied only on a per-neighbor basis as follows: neighbor <IP-ADDRESS> unsuppress-map <ROUTE-MAP>
  • summary address and unsuppressed prefixes are advertised
  • It can be used for  traffic engineering unsuppressing subnets for specific neighbors because classless routing always prefers the most specific prefix to reach the destinations, 

R3:
ip prefix-list NET_1 permit 10.0.1.0/24 
!
route-map UNSUPPRESS_MAP permit 10
 match ip address prefix-list NET_1
!
router bgp 200
 aggregate-address 10.0.0.0 255.255.252.0 summary-only
 neighbor 155.1.37.7 unsuppress-map UNSUPPRESS_MAP

This output shows R3 advertising the summay address but also the unsuppresed network 10.0.1.0/24
R3#show ip bgp neighbors 155.1.37.7 advertised-routes | include 10.0
 *>  10.0.0.0/22      0.0.0.0                            32768 i
 s>i 10.0.1.0/24      155.1.23.2               0    100      0 i




BGP Aggregation - AS-Set
  • Aggregation hides information previously found in the specific prefixes. such as NEXT_HOP, AS_PATH, and so on
  • This can cause loops cause now the AS_PATH for this summary prefix is empty
  • When as-set is used with the aggregate-address comand the new summary prefix will inherit the community and additive attributes of the subnets like AS_SET which contains the AS numbers found in all AS_PATHs of the specific prefixes. This list of AS numbers is unordered, it is only used is for routing loop prevention; when BGP receives a prefix
  • By default, the aggregated address in BGP will not include the AS_SET information. To force the use of this information, specify the as-set option as follows: aggregate-address <subnet> <mask> as-set summary-only
This example shows the unordered AS list of all the members of the summary addresses between{  }
R5#show ip bgp 
BGP table version is 46, local router ID is 150.1.5.5
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
 s>i 112.0.0.0        155.1.108.10             0    100      0 54 50 60 i
 s i                  155.1.108.10             0    100      0 54 50 60 i
 *>  112.0.0.0/5      0.0.0.0                       100  32768 {54,50,60} i 



BGP Aggregation - Attribute-Map
It is used with the aggregate-address and as-set to change or reset the community and additive attributes that the summary address will inherit from all the subnets when we use the as-set

In this example R5 receives a prefix from R8 with a community value of  "no-export". Because of that the summary address 112.0.0.0 will not be advertised to the neighbors. The solution is to reset the comunity value to "none"

R5:
route-map ATTR_MAP
 set community none
!
router bgp 200
 aggregate-address 112.0.0.0 248.0.0.0 summary-only as-set attribute-map ATTR_MAP
 neighbor 155.1.58.8 send-community
 neighbor 155.1.0.2 send-community
 neighbor 155.1.0.3 send-community

BGP Aggregation - Advertise Map
R5 wants to advertise  the summary 150.1.0.0/21 to R3 with aggregate-address and as-set. R3 will reject the summary cause its own AS number is inside AS_PATH. The solution is to take out that number from AS_PATH denying the prefix 150.1.3.3


R1, loopback 150.1.1.1 AS1
R2, loopback 150.1.2.2 AS2
R3, loopback 150.1.3.3 AS3
R5, loopback 150.1.5.5 AS5












R5(config)#route-map DENY3 deny 10
R5(config-route-map)#match ip address prefix-list R3
R5(config)#route-map DENY3 permit 20

R5(config)#router bgp 5
R5(config-router)#aggregate-address 150.1.0.0 255.255.248.0 as-set summary-only advertise-map DENY3



BGP Communities
  • They are optional transitive attributes used mainly to associate an administrative tag to a route
  • All prefixes with the same community belong to the same group and share some properties
  • There are two formats to read a community value: raw, as a 32-bit number, and structured, as a pair AS Number:16-bit value
  • There are three well-known BGP community values from reserved range: NO_EXPORT (0xFFFF:0xFF01), NO_ADVERTISE (0xFFFF:0xFF02), and NO_EXPORT_SUBCONFED (0xFFFF:0xFF03)

  • R3 will announce 6.6.6.0/24 with a community attribute 100:300 to R1
  • R3 will announce 6.6.6.0/24 with a community attribute 100:250 to R2
  • R1 will set "local-preference" 130 for community 100:300
  • R1 will set "local-preference" 125 for community 100:25
--------------------------------------------------------------------------------------------------------------------------
R3                                                                                    R1
router bgp 30                                                                    router bgp 100        
 network 6.6.6.0 mask 255.255.255.0                              neighbor 10.10.12.2 remote-as 100
 network 7.7.7.0 mask 255.255.255.0                              neighbor 10.10.12.2 next-hop-self
                                                                                       
 neighbor 10.10.13.1 remote-as 100                                 neighbor 10.10.13.3 remote-as 30
 neighbor 10.10.13.1 send-community                             neighbor 10.10.13.3 route-map Peer-R3 in
 neighbor 10.10.13.1 route-map Peer-R1 out                
                                                                                         ip bgp-community new-format
 neighbor 10.10.23.2 remote-as 100
 neighbor 10.10.23.2 send-community                            ip community-list 1 permit 100:300
 neighbor 10.10.23.2 route-map Peer-R2 out                  ip community-list 2 permit 100:250

!--- attribute in AA:NN format.                                       route-map Peer-R3 permit 10
 ip bgp-community new-format                                          match community 1
                                                                                            set local-preference 130
!
access-list 101 permit ip host 6.6.6.0 host 255.255.255.0
!
route-map Peer-R1 permit 10                                            route-map Peer-R3 permit 20
 match ip address 101                                                            match community 2
 set community 100:300                                                        set local-preference 125
!
route-map Peer-R2 permit 10                                           route-map Peer-R3 permit 30
 match ip address 101
 set community 100:250
end





BGP Communities - No-Advertise  /  BGP Communities - No-Export
  • No-export means, do not export to any eBGP neighbors just iBGP neighbors.
  • No-advertise means, do not export to any BGP neighbor at all.
Configure R2 so that it does not advertise prefixes received from AS 254 to any peer
R2:
route-map SET_COMMUNITY
 set community no-advertise
!
router bgp 200
 neighbor 192.10.1.254 route-map SET_COMMUNITY in


BGP Communities - Local-AS or 
The NO_EXPORT_SUBCONFED (local-AS) community attribute basically tells the recipient, or a device that is originating a community attribute for a destination, not to advertise to EBGP neighbors including EBGP confederation peer ASs.



BGP Communities - Deleting
In this example R7 will add the community value 300:200 to the list of communities and it will also delete communities starting with “200" like "200:254”, and “200:123”, In this example we use  expanded access-lists to be able to remove community ranges—for example, by matching “200:[0-9]+_”
R7:
ip community-list expanded AS200 permit 200:[0-9]+_
!
route-map RESET_COMMUNITY permit 10
 set community 300:200 additive
 set comm-list AS200 delete
!
router bgp 300
 neighbor 155.1.67.6 send-community
 neighbor 155.1.37.3 route-map RESET_COMMUNITY in
!
ip bgp-community new-format


BGP Conditional Advertisement
The syntax for conditional advertisement is as follows:** neighbor <IP> advertise-map MAP1 {non-exist|exist-map} MAP2**. The configuration involves defining two route-maps. One route-map (MAP1) selects the prefixes to be advertised to the peer. These prefixes must already exist in the local BGP table. The other route-map (MAP2) selects the prefixes to be tracked in the local BGP table. If this is a “non-exist” map, the condition is triggered when no prefixes in the BGP table match the route-map. If this is an “exist” map, the condition is triggered when there is a prefix in the BGP table matching the route-map. The BGP process performs condition verification every time the BGP scanner runs (60 seconds by default), so it may take some time after your configuration change before the conditional advertisement occurs.
In our scenario, we advertise the link connecting R1 and R3 into BGP. We then create a route-map matching this prefix. This route-map is used as a “non-exist” condition for the advertisement of AS 254 prefixes. The prefixes are selected using an AS_PATH access-list matching the regular expression “254$”.
R3:
ip as-path access-list 1 permit 254$
!
route-map ADVERTISE_MAP permit 10
 match as-path 1
!
ip prefix-list LINK_R1_R3 permit 155.1.13.0/24
!
route-map NON_EXIST_MAP permit 10
 match ip address prefix-list LINK_R1_R3
!
router bgp 200
 network 155.1.13.0 mask 255.255.255.0
 neighbor 155.1.37.7 advertise-map ADVERTISE_MAP non-exist-map NON_EXIST_MAP


BGP Conditional Route Injection (CRI)

  • CRI is similar to the BGP unsuppress-map feature, but it will work on any router, not just the one originating the aggregate prefix
  • Because of the lack of information about the prefixes that were summarized, you must explicitly set the prefixes to be injected into the BGP table.
  • It needs two route-maps: "bgp inject-map <MAP1> exist-map <MAP2>"
  • The first route-map specifies the prefixes to be injected into the BGP table by means of the set "ip address prefix-list <MAP1>". Others attributes like weight, local preference, etc can also be changed
  • The second route-map must have two match statements. The first statement is match ip address prefix-list <MAP2>, and it matches the prefix list defining the aggregated prefix. The second statement is match ip route-source prefix-list <NAME>. This prefix-list should match the IP address of the BGP peer that advertised the aggregate to the local router. Remember that this is NOT the NEXT_HOP attribute of the aggregate prefix. It is the IP address used to establish the BGP session with a peer that sent the update to the local system

R8:
ip prefix-list INJECT_PREFIX permit 10.0.2.0/24
ip prefix-list AGGREGATE permit 10.0.0.0/22
ip prefix-list ROUTE_SOURCE permit 155.1.23.3/32
!
route-map INJECT_MAP permit 10
 set ip address prefix-list INJECT_PREFIX
 set origin igp
!
route-map EXIST_MAP permit 10
 match ip address prefix-list AGGREGATE
 match ip route-source ROUTE_SOURCE
!
route-map DENY_INJECT_PREFIX deny 10
 match ip address prefix-list INJECT_PREFIX
!
route-map DENY_INJECT_PREFIX permit 100
!
router bgp 200
 bgp inject-map INJECT_MAP exist-map EXIST_MAP
 neighbor 155.1.58.5 route-map DENY_INJECT_PREFIX out
 neighbor 155.1.23.3 route-map DENY_INJECT_PREFIX out 


Saturday, September 19, 2015

Facts to remember about BGP - Part 3

BGP Bestpath Selection - Weight
  • Weight is Cisco-specific and is not transported along with BGP prefixes/updates
  • Configured using the command neighbor <IP_Address> weight 1-65535
  • Higher-weight values are preferred and the default weight is zero for learned prefixes.
  • Locally originated prefixes receive the value 32768 
  • Usually used when the local router has multiple uplinks and you want to prefer one uplink over another
  • Weight affects the way in which traffic leaves the local router
To change specific prefix preference without affecting any other subnets learned from the same peer
route-map SET_WEIGHT
 match ip address ACCCESS_LIST
 set weight 100
!
router bgp 100
 neighbor 204.12.1.254 route-map SET_WEIGHT in
Traffic from AS 300 going to prefixes originated in AS 254 exits toward R6.
R7:
ip as-path access-list 2 permit _254$
!
route-map FROM_R6 permit 10
 match as-path 2
 set weight 1000
!
route-map FROM_R6 permit 100
!
router bgp 300
 neighbor 155.1.67.6 route-map FROM_R6 in


BGP Bestpath Selection - Local Preference
  • LP is transported along with BGP prefixes/updates but doesn't leave AS boundaries
  • BGP prefer paths with high Local Preference values
  • LP is typically modified at the border of the AS, at the point of the external connection.
  • By default all iBGP-learned prefixes have the Local Preference value of 100 assigned to them
  • LP affects the way in which traffic leaves the local AS
Use local-preference on R6 so that traffic from AS 100 going to AS 254 transits through AS 300
R6:
ip as-path access-list 1 permit _254$
!
route-map FROM_R7 permit 10
 match as-path 1
 set local-preference 200
!
route-map FROM_R7 permit 100
!
router bgp 100
 neighbor 155.1.67.7 route-map FROM_R7 in


BGP Bestpath Selection - AS-Path Prepending
  • It is the common way to influence the incoming traffic paths to the local AS 
  • Applies only to eBGP sessions, the local AS number is prepended in front of the AS_PATH attribute the number of times specified.
  • AS_PATH comparison could be disabled by issuing the command "bgp bestpath as-path ignore" (it is a hidden command)
In this example AS 600 routers know that they can reach 170.10.0.0 via two different routes: path (100, 300), and path (400, 200, 300), they will choose the first one cause it has a shorter length path. We can make Routers in AS600 think the first path will be longer if RTC prepends 3 times 300 (AS number) in the AS_PATH attribute when the prefix 170.10.0.0 is advertised



The syntax to perform AS_PATH prepending is as follows:
route-map PREPEND
 match ...
 set as-path prepend 100 100 100
!
router bgp 100
 neighbor 54.1.1.254 route-map PREPEND out


BGP Bestpath Selection - Origin Code
  • It is set by the prefix originator
  • IGP meaning that the route was originated using the network or aggregate-address commands. It appears as i in BGP table output.
  • EGP meaning that the prefix was received from an EGP peer (legacy). You probably won’t see this Origin value in any modern router, but it can be manually configured
  • Incomplete meaning that the source could not be determined. This value is assigned to the prefixes redistributed into BGP.
In this example RTA reaches 170.10.0.0 via 300 i. The "300 i" means that the next AS path is 300 and the origin of the route is IGP. RTA also reaches 190.10.50.0 via i. This "i" means that the entry is in the same AS and the origin is IGP. RTE reaches 150.10.0.0 via 100 i. The "100 i" means that the next AS is 100 and the origin is IGP. RTE also reaches 190.10.0.0 via 100 ?. The "100 ?" means that the next AS is 100 and that the origin is incomplete and comes from a static route or redistribution.

We can also do a manual setting of this attribute:
R5:
no ip as-path access-list 1
ip as-path access-list 1 permit _254$
!
route-map TO_R4 permit 10
 match as-path 1
 set origin igp
!
route-map TO_R4 permit 100
!
router bgp 200
 neighbor 155.1.45.4 route-map TO_R4 out


BGP Bestpath Selection - MED (Multi Exit Discriminator)
  • By default MED is only compared when it is received from the same AS
  • "bgp always-compare-med" command ensures the comparison of the MED for paths from neighbors in different ASs. The recomendation is disable it to avoid loops
  • MED default value is 0 unless the metric attributte is set or "bgp bestpath med missing-as-worst" which makes the path without a MED value the least desirable path 
  • Metric is used to make decisions inside the AS. When the same update passes on to a third AS, that metric returns to 0

In this example RTA election to reach prefix 180.10.0.0 will not depend on AS-PATH lenght cause we use the comamand "bgp bestpath as-path ignore" on RTA but it will compare MED values from different AS cause we use the command "bgp always compare-med" on RTA which finally chooses prefix advertised from RTB (less metric).  RTA set the metric to 0 before advertising this prefix to a new AS

RTA#                                                                RTB#
   router bgp 100                                                     router bgp 400
   neighbor 2.2.2.1 remote-as 300                               neighbor 4.4.4.4 remote-as 100              
   neighbor 3.3.3.3 remote-as 300                               neighbor 4.4.4.4 route-map setmetricout out
   neighbor 4.4.4.3 remote-as 400
   bgp bestpath as-path ignore                                route-map setmetricout permit 10
   bgp always compare-med                                       set metric 50



BGP Bestpath Selection - Router-IDs
In this scenario, the default BGP Router IDs for R4 and R6 are based on their Loopback0 IP address value. This makes R1 prefer R4 over R6 as its best path for Loopback1 prefix, because all other criteria are the same. To change this, we configure R6 with an artificially lower Router ID value. Remember that changing a router’s BGP router ID will hard-reset all active BGP sessions.

R4:                                                                   R6:
interface Loopback1                                               interface Loopback1
ip address 1.2.3.4 255.255.255.255                        ip address 1.2.3.4 255.255.255.255
!                                                                              !
router bgp 100                                                        router bgp 100
 network 1.2.3.4 mask 255.255.255.255                  bgp router-id 6.6.6.6
                                                                                 


BGP Bestpath Selection - DMZ Link Bandwidth (unequal-cost load balancing)
Cisco IOS allows for such implementation, using the following algorithm:
  • When the DMZ Link bandwidth feature is enabled in the border BGP routers for the specific peers, the interface bandwidth value is copied into a new extended community attribute associated with the prefixes received from those eBGP peers. Thus, every prefix received on the eBGP peering link will carry the link's bandwidth as a special extended community attribute, if the link is enabled for the DMZ Link bandwidth feature. Remember that you need two commands in the border peers: bgp dmzlink-bw and neighbor <IP> dmzlink-bw.
  • All BGP speakers in the AS should be configured to exchange extended communities across the iBGP peering links. This allows all internal BGP speakers to learn the bandwidth of the external link used to reach the prefixes. Use the command neighbor <IP> send-community extended to accomplish this.
  • Provided that an internal BGP speaker has both bgp maximum-path ibgp and bgp dmzlink-bw commands enabled and receives multiple paths to reach the same prefix, it performs load-balancing if the paths meet the BGP load-balancing conditions.
  • If all paths received carry the DMZ Link bandwidth extended community, the BGP process will perform unequal cost load-balancing proportional to the extended community attribute values.


R1(config)#router bgp 126
R1(config-router)#neighbor 6.6.6.6 remote-as 126
R1(config-router)#neighbor 2.2.2.2 remote-as 126
R1(config-router)#neighbor 6.6.6.6 update-source lo0
R1(config-router)#neighbor 2.2.2.2 update-source lo0

R1(config-router)#address-family ipv4
R1(config-router-af)#bgp dmzlink-bw
R1(config-router-af)#neighbor 6.6.6.6 activate
R1(config-router-af)#neighbor 2.2.2.2 activate
R1(config-router-af)#neighbor 6.6.6.6 send-community both
R1(config-router-af)#neighbor 2.2.2.2 send-community both
R1(config-router-af)#maximum-paths ibgp 2
R1(config-router-af)#end



R6(config)#router bgp 126
R6(config-router)#neighbor 1.1.1.1 remote-as 126
R6(config-router)#neighbor 1.1.1.1 update-source lo0
R6(config-router)#neighbor 10.56.0.5 remote-as 345
R6(config-router)#address-family ipv4
R6(config-router-af)#bgp dmzlink-bw
R6(config-router-af)#neighbor 1.1.1.1 activate
R6(config-router-af)#neighbor 1.1.1.1 next-hop-self
R6(config-router-af)#neighbor 1.1.1.1 send-community both
R6(config-router-af)#neighbor 10.56.0.5 activate
R6(config-router-af)#neighbor 10.56.0.5 dmzlink-bw
R6(config-router-af)#int fa 0/0
R6(config-if)#bandwidth 6000



BGP Bestpath Selection - Maximum AS Limit

  • Enabled by using the BGP process command bgp maxas-limit <N>
  • Sets the maximum number of AS elements allowed in the AS_PATH attribute

Configure the routers in AS 200 to accept only the prefixes originated from directly connected AS's
R2, R3, R5, R8:
router bgp 200
 bgp maxas-limit 1

Friday, September 18, 2015

Facts to remember about BGP - Part 2

Recall that the next-hop value is only updated by default when prefixes are advertised to true EBGP peers, not iBGP peers or confederation EBGP peers.


BGP Next-Hop Processing - Next-Hop-Self
                                                   R1<---(iBGP)---->R2<----(eBGP)----->R3
  • R2 learns a new prefix from R3 which becomes the next-hop for this prefix
  • When R2 advertise this prefix to R1, the next-hop value for R1 is still R3 address
  • R1 will drop packets sent to the prefix  cause next-hop (R3) is unreachable  for R1
  • The solution would be if R1 has R2 as next-hop to reach this new prefix
  • next-hop-self statement will change this in the router which receives the eBGP prefix (R2)
router bgp 100
 network 150.1.7.7 mask 255.255.255.255
 neighbor 155.1.146.1 remote-as 100
 neighbor 155.1.146.1 next-hop-self
 neighbor 155.1.79.9 remote-as 54


BGP Next-Hop Processing - Manual Modification
Two possible scenarios where the next-hop can be fixed. On R1(RR) or in R7 (RR client)
R1:
route-map SET_NEXT_HOP_FROM_R8 permit 10
 set ip next-hop 155.1.58.8
!
router bgp 100
 network 150.1.1.1 mask 255.255.255.255
 neighbor 155.1.58.8 remote-as 100
 neighbor 155.1.58.8 route-map SET_NEXT_HOP_FROM_R8 in
 neighbor 155.1.67.7 remote-as 100
 neighbor 155.1.58.8 route-reflector-client
 neighbor 155.1.67.7 route-reflector-client

R7:
route-map SET_NEXT_HOP_TO_R1 permit 10
 set ip next-hop 155.1.67.7
!
router bgp 100
 network 150.1.7.7 mask 255.255.255.255
 neighbor 155.1.146.1 remote-as 100
 neighbor 155.1.146.1 route-map SET_NEXT_HOP_TO_R1 out
 neighbor 155.1.79.9 remote-as 54


iBGP Synchronization
If your AS passes traffic from another AS to a third AS, BGP should not advertise a route before all the routers in your AS have learned about the route via IGP. BGP waits until IGP has propagated the route within the AS. Then, BGP advertises the route to external peers.
BGP synchronization is disabled by default cause none IGP can scale to the size of the current Internet BGP table. When BGP is redistribute into IGP there will be a "rib-failure" (show ip bgp) that means the BGP route will not be installed in the routing table but the IGP route cause its lower administrative distance than iBGP (200).
Route map filtering should always be used when redistribute BGP into IGP to avoid CPU and memory exhaustion like the example
R8:
ip as-path access-list 1 permit ^54_
!
route-map BGP_TO_IGP permit 10
 match as-path 1
!
router eigrp 100
 redistribute bgp 100 metric 100000 1000 255 1 1500 route-map BGP_TO_IGP
 network 150.1.8.8 0.0.0.0
!
router bgp 100
 synchronization


BGP Redistribute Internal
Redistribute iBGP into IGP is disabled by default cause potential loops like the example

  • R3 and R4 know that the next-hop to 1.1.1.1 is through R2 (iBGP advertise)
  • R3 will always reach R2 through R4 cause its lowest IGP metric (20)
  • If R3 distributes 1.1.1.1 into OSPF, R2 will have a new route to reach 1.1.1.1 with R3 as next-hop, this route will be prefered over the iBGP learned route cause a better AD (110 vs 200)
  • When R3 try to go 1.1.1.1 through R2, R2 will try to go through R3 and the loop will begin
  • To enable iBGP redistribution into IGP use the statement bgp redistribute-internal under the router bgp process 


BGP Peer Groups
R1:
router bgp 100
 neighbor IBGP_PEERS peer-group
 neighbor IBGP_PEERS remote-as 100
 neighbor IBGP_PEERS update-source Loopback0
 neighbor IBGP_PEERS route-reflector-client
 neighbor 150.1.2.2 peer-group IBGP_PEERS
 neighbor 150.1.3.3 peer-group IBGP_PEERS
 network 150.1.1.1 mask 255.255.255.255

R2:
router bgp 100
 neighbor 150.1.1.1 remote-as 100
 neighbor 150.1.1.1 update-source Loopback0
 network 150.1.2.2 mask 255.255.255.255

R3:
router bgp 100
 neighbor 150.1.1.1 remote-as 100
 neighbor 150.1.1.1 update-source Loopback0
 network 150.1.3.3 mask 255.255.255.255


BGP Network Statement
Another way to deal with external next-hop besides next-hop-self is to propagate the external link subnet to all the iBGP peers so they will install it in their RIBs and do a recursive look up till they  find the next hop
R7:
router bgp 100
 no neighbor 150.1.1.1 next-hop-self
 network 155.1.79.0 mask 255.255.255.0


BGP Auto-Summary
Works with the network statement (classfull network subnet in the IGP table must exist) and when we do redistribution
R7:
route-map CONNECTED_TO_BGP
 match interface Loopback0
 match interface GigabitEthernet1.79
!
router bgp 100
 no network 150.1.7.7 mask 255.255.255.255
 no network 155.1.79.0 mask 255.255.255.0
 auto-summary
 redistribute connected route-map CONNECTED_TO_BGP


R8:
router bgp 100
 no network 150.1.8.8 mask 255.255.255.255
 no network 155.1.108.0 mask 255.255.255.0
 auto-summary
 network 150.1.0.0
 network 155.1.0.0


BGP best path selection process
  1. Ignore invalid paths (no valid next-hop, not synchronized, looped).
  2. Prefer path with the highest locally assigned weight value.
  3. Prefer path with the highest Local Preference attribute value.
  4. Prefer locally originated prefixes (originated via the network, aggregate-address, or redistribution commands).
  5. Prefer path with the shortest AS_PATH attribute length.
  6. Prefer path with the lowest Origin Type (value for the Origin code), where IGP < EGP < Incomplete.
  7. Prefer path with the lowest MED attribute value (provided that the first AS in the list is the same).
  8. Prefer external BGP paths over internal BGP paths.
  9. Prefer path with the smallest IGP metric to reach the NEXT_HOP IP address.
  10. Prefer path originated from the router with the lowest BGP Router ID.
Before the procedure runs, the bestpath process excludes some prefixes based on the following criteria:

No valid next-hop. This is the most common cause for the prefix being ignored by the selection process. BGP prefixes carry their next-hop as a separate attribute (NEXT_HOP attribute). If the next-hop address is NOT reachable via IGP, the prefix is marked as invalid and is not considered. This usually happens with eBGP-learned prefixes when you forget to enter the command next-hop-self or advertise the link subnet into IGP/BGP.
BGP Synchronization enabled and the prefix is not in the IGP table. The bestpath process will ignore this prefix. This is a legacy restriction, but you may occasionally run into it.
AS_PATH Loop. Prefixes from the neighbor that has the local AS number in the AS_PATH attribute are dropped. This is the well-known BGP loop detection mechanism.

Wednesday, September 16, 2015

Facts to remember about BGP - Part 1

iBGP loop prevention is achieved simply by not advertising routes learned from one iBGP neighbor to another

Multihop EBGP Peerings
The default TTL for EBGP peers is 1. This means that non-directly connected EBGP peers cannot be established, because the TTL will expire in transit. By issuing the ebgp-multihop [ttl] command, the TTL can be increased to support this type of design
R8:
router bgp 100
 neighbor 155.1.79.9 remote-as 54
 neighbor 155.1.79.9 ebgp-multihop 255
 neighbor 155.1.79.9 update-source Loopback1

R9:
router bgp 54
 neighbor 204.12.8.8 remote-as 100
 neighbor 204.12.8.8 ebgp-multihop 255


Neighbor Disable-Connected-Check
EBGP can be form only on directed connected neighbors, but this feature allows to form ebgp sessions even if neighbors are not directly connected. The TTL remains 1 so there will not be neighborship if the peers are not back to back
R4:
router bgp 200
 neighbor 150.1.5.5 remote-as 100
 neighbor 150.1.5.5 disable-connected-check
 neighbor 150.1.5.5 update-source Loopback0
!
R5:
router bgp 100
 neighbor 150.1.4.4 remote-as 200
 neighbor 150.1.4.4 disable-connected-check
 neighbor 150.1.4.4 update-source Loopback0


Authenticating BGP Peerings
It uses the MD5 hash. Configuration is very straightforward and requires only the additional neighbor statement with the password option. If BGP peering occurs, authentication is successful:
R1:
router bgp 100
 neighbor 155.1.13.3 remote-as 300
 neighbor 155.1.13.3 password CISCO


R3:
router bgp 300
 neighbor 155.1.13.1 remote-as 100
 neighbor 155.1.13.1 password CISCO



Route reflectors, are used to reduce the need for fully meshed iBGP peerings in large-scale deployments. The main idea is routers clients peering only with RR which receives and distributes the client routes


iBGP Route Reflection
A route reflector can have 3 types of peers:
  • EBGP peers     : Neighbors with different AS number including peers in different Sub-ASs in confederation
  • Client peers   :    iBGP neighbors that have the route-reflector-client statement configured
  • Non-client peers:  Normal iBGP peers that do not have the route-reflector-client statement configured.
 Routing advertisements sent from the route reflector must conform to the following 3 rules:
  • Routes learned from EBGP peers can be sent to other EBGP peers, clients, and non-clients.
  • Routes learned from client peers can be sent to EBGP peers, other client peers, and non-clients.
  • Routes learned from non-client peers can be sent to EBGP peers, and client peers, but not other non-clients

When a route is advertised or reflected 2 new fields also checked for loop prevention:
  • Originator ID: When a client learns a route from a RR, and the Originator ID is equal to its BGP Router-id, the client discard the route. (Client Loop prevention)
  • Cluster-list: When a route-reflector learns a route from an iBGP peer, check in the Cluster List  for its own Cluster-ID, if it is found the RR discard the route.(RR Loop prevention)

To check from RR the reflected routes to a client:
  show ip bgp neighbors "client ip address" advertised-routes
To check from client the Originator ID or Cluster-list parameters
  show ip bgp "advertised route" "mask" 


iBGP route reflection configuration example: (R1 is RR and R2, R3 iBGP clients)
R1:
router bgp 100
 network 150.1.1.1 mask 255.255.255.255
 neighbor 155.1.0.2 remote-as 100
 neighbor 155.1.0.3 remote-as 100
 neighbor 155.1.0.2 route-reflector-client
 neighbor 155.1.0.3 route-reflector-client

R2:
router bgp 100
 network 150.1.2.2 mask 255.255.255.255
 neighbor 155.1.0.1 remote-as 100

R3:
router bgp 100
 network 150.1.3.3 mask 255.255.255.255
 neighbor 155.1.0.1 remote-as 100



Large-Scale iBGP Route Reflection with Clusters
The term “cluster” refers to a route-reflector and its clients, or multiple route-reflectors that service the same clients
  • Inter-cluster peerings non-client: Could cause traffic black holes, even though there were alternate viable paths to the destinations (sacrifices redundancy)
  • Inter-cluster peerings client: Each update message sent out results in a feedback loop of update messages received back in
This is a configuration of 3 RR with Inter-cluster peerings non-client between them
R1:
router bgp 100
 bgp cluster-id 150.1.1.1
 network 150.1.1.1 mask 255.255.255.255
 neighbor 155.1.146.4 remote-as 100
 neighbor 155.1.146.6 remote-as 100
 neighbor 155.1.146.4 route-reflector-client
 neighbor 155.1.146.6 route-reflector-client
 neighbor 155.1.0.5 remote-as 100
 neighbor 155.1.13.3 remote-as 100

R3:
router bgp 100
 bgp cluster-id 150.1.3.3
 network 150.1.3.3 mask 255.255.255.255
 neighbor 155.1.37.7 remote-as 100
 neighbor 155.1.79.9 remote-as 100
 neighbor 155.1.37.7 route-reflector-client
 neighbor 155.1.79.9 route-reflector-client
 neighbor 155.1.13.1 remote-as 100
 neighbor 155.1.0.5 remote-as 100
 neighbor 155.1.23.2 remote-as 200

R5:
router bgp 100
 bgp cluster-id 150.1.5.5
 network 150.1.5.5 mask 255.255.255.255
 neighbor 155.1.58.8 remote-as 100
 neighbor 155.1.58.8 route-reflector-client
 neighbor 155.1.0.1 remote-as 100
 neighbor 155.1.0.3 remote-as 100
 neighbor 155.1.0.2 remote-as 200



iBGP Confederation
  • Like route reflector reduce the need for fully meshed iBGP peerings
  • In confederation, a public AS is split into smaller Sub Autonomous Systems (Sub-ASs), 
  • Inside Sub-AS fully meshed peering or route reflection applies
  • Between Sub-ASs, EBGP advertisement rules apply
  • Confederation EBGP peers are listed in bgp confederation peers statement
  • bgp confederation identifier is the public AS #, tells the router is a confederation member
  • Members inside a Sub-As still can have eBGP neighbors
  • Confederation introduces a new BGP attribute known as the AS_CONFED_SET. The confederation set, or simply confed set, is an unordered list of Sub-ASs that is prepended onto the normal AS-Path of a BGP prefix as it is passed between Sub-ASs. The confed set, however, is stripped and replaced by the confederation identifier when a prefix is advertised to a true EBGP peer. 
In this example R1, R3 and R5 are Confederation EBGP peers, they peer with neighbors in the same Sub-AS. Only R1 and R3 configuration is show. The iBGP confederation members inside each Sub-AS miss the bgp confederation peers statement
R1:
router bgp 65146
 bgp confederation identifier 100
 bgp confederation peers 65379 65508 
 network 150.1.1.1 mask 255.255.255.255
 neighbor 155.1.13.3 remote-as 65379
 neighbor 155.1.146.4 remote-as 65146
 neighbor 155.1.146.6 remote-as 65146

R3:
router bgp 65379
 bgp confederation identifier 100
 bgp confederation peers 65146 65508 
 network 150.1.3.3 mask 255.255.255.255
 neighbor 155.1.0.5 remote-as 65508
 neighbor 155.1.13.1 remote-as 65146
 neighbor 155.1.23.2 remote-as 200
 neighbor 155.1.37.7 remote-as 65379
 neighbor 155.1.79.9 remote-as 65379

Tuesday, July 28, 2015

Tshoot OSPF Default-Information Originate always ( track sla failure solution)


This exercise was first post by Costi Serban (http://www.costiser.ro/2014/05/10/quiz-24/). I just found my own solution to the problem that he proposed

My solution includes tracking a sla failure instead of the traditional "ip sla reachability" (up)

 

THE PROBLEM

CORE-A must always have internet Access even if ISP-1 goes down. This is not happening with the actual configuration. Please do the tshoot to find the answer and propose a solution

THE SOLUTION

BR-B is getting a default route from ISP-1 (EBGP), but from BR-C too (OSPF). So which one it will choose?. it chooses the route with the lower administrative distance in this case the one from ISP-1. the same applies for BR-C

BGP administrative distance = 20, OSPF administrative distance = 110

BR-B#show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
  Known via "bgp 65001", distance 20, metric 0, candidate default path
  Tag 100, type external
  Last update from 1.1.1.1 00:38:22 ago
  Routing Descriptor Blocks:
  * 1.1.1.1, from 1.1.1.1, 00:38:22 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 100
      MPLS label: none


BR-B is advertising a default route into ospf using "default-information originate always". the same happens in BR-C

BR-B#show run | section ospf
router ospf 1
 network 192.168.0.0 0.0.255.255 area 0
 default-information originate always



CORE-A gets the advertisement from BR-C and install a default route in its routing table

CORE-A#show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
  Known via "ospf 1", distance 110, metric 1, candidate default path
  Tag 1, type extern 2, forward metric 2
  Last update from 192.168.15.1 on GigabitEthernet0/1, 02:11:50 ago
  Routing Descriptor Blocks:
  * 192.168.15.1, from 192.168.0.5, 02:11:50 ago, via GigabitEthernet0/1
      Route metric is 1, traffic share count is 1
      Route tag 1


The "always" means BR-B will continue telling everyone "hey guys use me as the default route" even if that's is true or not. To check this will shutdown interface in ISP-1 which faces BR-B and let's check BR-B's routing table again

BR-B#show ip route 0.0.0.0

There is no default route in the routing table, so now BR-B will receive the default route from BR-C (OSPF) right...no??. Well .., no, when you use "default-information originate always" you are telling everyone " hey guys i accept default routes from no one cause i got my own "
 so CORE-A will never reach internet when BR-B lose conectivity with ISP-1


SOLUTIONS

1) The most easy solution is to remove the "always" from "default-information originate "BR-B

BR-B#show run | section ospf
 network 192.168.0.0 0.0.255.255 area 0
 default-information originate

This will let BR-B receive the default Gateway from BR-C and CORE-A will no lose internet connectivity because now it will go out through ISP-2


2) The solution that i propose is not the most neat but it will work too

If the conection between BR-B and ISP-1 fails, i will install a default route in BR-B so all the internet goes thorugh 192.168.12.2

I'll use SLA/TRACK to achieve this. Generally we add a static route when the track response is OK, but this time we'll add the static route when the track response is FAIL

Let's create the sla which will make ping to ISP-1 interface

BR-B#show run | section sla
ip sla 1
 icmp-echo 1.1.1.1
 frequency 5
ip sla schedule 1 life forever start-time now


And the track which will check the sla

BR-B#show run | section track 1
track 1 ip sla 1 reachability


Here comes the magic. Now we'll créate another track object which denies track 1

BR-B#show run | section track 2
track 2 list boolean and
 object 1 not

Now we'll add a route static to BR-B routing table only if connectivity between BR-B and ISP-1 fails

ip route 0.0.0.0 0.0.0.0 192.168.12.2 track 2

That's it, make some tests with traceroute from CORE-A to 34.34.34.3 when interface in ISP-1 is down or up, and check the routing table everytime

I will upload the startup and solution files...They are in VIRL format but you can copy the configuration sections and paste them in GNS3

Please give me your feedback

Sunday, July 26, 2015

Summarization challenge

This exercise was first post by Arwin Reprakash (http://ithitman.blogspot.com/2015/03/configuring-ospf-summarization-lab.html#more). I took his post and modify it to create a new requirement

 

THE PROBLEM

Summarize 192.168.1.2/32 from Area 2 as 192.168.1.0/24 into area 0. You have no Access to R1


RESTRICCIONS

* You only have Access to routers R2 and R3
* Do not use area-range command or summary-address to summarize the routes into Area 0.
* R3 and other routers in Area 0 or any new additional areas should only have the summary address to reach 192.168.1.2.
* If prefix 192.168.1.2/32 is withdrawn (i.e shutdown loopback0 on R2) from R1 OSPF database then 192.168.1.0/24 should not be summarized/advertised into area 0.


THE SOLUTION

When you run the lab you will notice that all the routers know how to reach each other by ospf. That's is good cause now we could créate a BGP relationship between R2 and R3 bypassing R1, and then advertise a summary address for R3

This is the configuration in R2 to summarize and advertise 192.168.1.0 (summary-only)

R2#show run | section bgp
router bgp 1
 bgp log-neighbor-changes
 network 192.168.1.2 mask 255.255.255.255
 aggregate-address 192.168.1.0 255.255.255.0 summary-only
 neighbor 13.13.13.3 remote-as 1

This is the configuration in R3

R3#show run | section bgp
router bgp 1
 bgp log-neighbor-changes
 neighbor 12.12.12.2 remote-as 1


Finally let's check the routing table in R3

R3#show ip route bgp
B     192.168.1.0/24 [200/0] via 12.12.12.2, 00:08:21


Ok it work,
When l0 in R2 is down, the route will  disappear from R3 routing table




I use cisco virl for these labs but i think they will work ok in GNS3 too.
Please leave your feedback

Saturday, July 25, 2015

BGP troubleshooting - (bgp redistribute-internal)


This exercise was first post by Arwin Reprakash (http://ithitman.blogspot.com/2013/03/bgp-troubleshooting-lab.html). I took his post and found a way to resolve the problem

The diagrams and original idea belongs to Arwin Reprakash, please check the above link to see more details

  

THE PROBLEM

The goal is to ping 11.11.11.11 from R4


THE SOLUTION

Fist let's check if R1 is advertising its loopback to R4

R1#show run | section ospf
 router ospf 1
 redistribute connected subnets route-map lo-2-ospf
 network 1.1.1.1 0.0.0.0 area 0

From the output we can see that there is a route-map filter when R1 advertise its connected subnets. So let's check  the route-map
 
R1#show route-map                
route-map lo-2-ospf, permit, sequence 10
  Match clauses:
    ip address prefix-lists: lo-2-ospf
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
 
 
This output shows that no packets were filter by the route-map (0 packets, 0 bytes). So the next step is to check the prefix-list inside the route-map
 
R1#show run | section prefix  
ip prefix-list lo-2-ospf seq 10 permit 11.11.11.0/24
 match ip address prefix-list lo-2-ospf
 
The prefix-list will allow any route from 11.11.11.0/24 to pass the filter. So the next step is to know if we have that route in our routing table
 
R1#show ip route 11.11.11.0 255.255.255.0
% Subnet not in table

We can't filter a route that we don't have. That's why the packets never hit the roupe-map and nothing is advertised. What we really need is to include 11.11.11.11/32 into the prefix-list because that's the ip address of l0. So we need to open the range of the prefix-list to include the mask 255.255.255.255
 
R1(config)#no ip prefix-list lo-2-ospf seq 10 permit 11.11.11.0/24
R1(config)#ip prefix-list lo-2-ospf seq 10 permit 11.11.11.0/24 le 32


Now let's check if R2 finally got the route to 11.11.11.11

R2#show ip route
      11.0.0.0/32 is subnetted, 1 subnets
O E2     11.11.11.11 [110/20] via 1.1.1.1, 00:04:14, GigabitEthernet0/1


Everything is ok, now let's check if R2 is advertising 11.11.11.11 to 2.2.2.3 (R3)
 
 R2#show ip bgp neighbors 2.2.2.3 advertised-routes
     Network          Next Hop            Metric LocPrf Weight Path
 *>  11.11.11.11/32   1.1.1.1                 20         32768 ?
 
 
R2 is advertising 11.11.11.11 ok but it is setting the next hop as 1.1.1.1. that's a problem cause R1 has no route to 1.1.1.1 so 11.11.11.11 will never be installed into R3's routing table. We can check that with the following commands
 
 
R3#show ip route bgp  (no bgp routes)
 
R3#show ip route 1.1.1.1
% Network not in table
 
Let's replace "next hop 1.1.1.1" with "next hop 2.2.2.2". R2's local ip address 2.2.2.2
 
R2(config)#router bgp 2
R2(config-router)#neighbor 2.2.2.3 next-hop-self
 
 
Let's check if R3 finally has the route to 11.11.11.11
 
R3#show ip route
      11.0.0.0/32 is subnetted, 1 subnets
B        11.11.11.11 [200/20] via 2.2.2.2, 00:00:29
 
 
Everything is ok. Now let's see if R3 is advertising 11.11.11.11 to R4
 
 
R3#show run | section ospf
router ospf 1
 redistribute bgp 2 subnets route-map bgp-2-ospf
 network 3.3.3.0 0.0.0.255 area 0
ip prefix-list bgp-2-ospf seq 10 permit 11.11.11.11/32
route-map bgp-2-ospf permit 10
 match ip address prefix-list bgp-2-ospf
 
 
All is ok but the route is not installed yet into R4. let's check that with the following commands
 
 
R3#show route-map
route-map bgp-2-ospf, permit, sequence 10
  Match clauses:
    ip address prefix-lists: bgp-2-ospf
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
 
 
R3#show ip ospf database external
            OSPF Router with ID (192.168.0.3) (Process ID 1)
 
 
So if everything is ok why the IBGP route 11.11.11.11 is not redistributed into OSPF?
 
You should remenber the following rule
 
 
 
Internal BGP (iBGP) routes are not, by default, redistributed into any IGP

 
 
To change this default behaviour in BGP we must use "redistribute-internal"
 
 
R3(config-router)#bgp redistribute-internal
 
 
Finally let's check is the route is installed in R4 and if we can do ping
 


R4#show ip route
O E2 11.11.11.11 [110/1] via 3.3.3.3, 00:00:16, GigabitEthernet0/1


R4#ping 11.11.11.11
Sending 5, 100-byte ICMP Echos to 11.11.11.11, timeout is 2 seconds:
!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/5 ms

 
 
 
I use cisco virl for these labs but i think they will work ok in GNS3 too.

Please leave your feedback