3 ccie routing switching implement bgp m3 slides

Upload: sumit-kumar

Post on 16-Oct-2015

40 views

Category:

Documents


7 download

DESCRIPTION

3 Ccie Routing Switching Implement Bgp m3 Slides

TRANSCRIPT

  • Constructing the BGP Table

    Joe Astorinowww.astorinonetworks.com

    @jastorino

  • BGP Table Summary

    The BGP table contains all the prefixes learned by BGP and the path attributes (PA) associated with those prefixes In BGP, prefixes are technically called NLRI

    The BGP table is actually comprised of three databases

    Raw NLRI / PA information received from peers

    Adj-RIBs-In

    The best NLRIs after route policies have been applied

    Loc-RIB

    Routes BGP will advertise to other BGP peers

    Adj-RIBs-Out

  • BGP Table Sources

    The local BGP table is built from three different sources

    Network command

    Local Routes

    BGP Updates

    iBGP or eBGP

    Redistribution

    Redistributed

  • BGP Network Command

    The network command adds routes to the local BGP table that the router wishes to advertise into BGP and ultimately send to BGP peers

    The network command specifies a prefix and a mask. For the prefix to be added to the BGP table, the prefix must match exactly a route already existing in the routing table!

    The prefix can match existing routes from connected, static or IGPs

    R1#show ip interface brief | i LoopbackLoopback0 1.1.1.1 YES NVRAM up up

    R1#show ip route 1.1.1.1Routing entry for 1.1.1.1/32Known via "connected", distance 0, metric 0 (connected, via interface)

    R1#sh run | section bgprouter bgp 65123network 1.1.1.1 mask 255.255.255.255

  • Redistribution into BGP

    Connected, static and IGP routes may be redistributed into BGP

    Many times the redistribution is tied to a route-map in order to manipulate the attributes of the redistributed prefixes

    By default, when redistributing OSPF into BGP, only intra and inter-area routes are allowed. This can be changed during the redistribution

    ip prefix-list AS65123 seq 5 permit 172.16.123.0/24 ge 26 le 26ip prefix-list AS65123 seq 10 permit 10.0.123.0/29!route-map CONNECTED-BGP permit 10match ip address prefix-list AS65123set metric 100set community 65123:110!router bgp 65123network 1.1.1.1 mask 255.255.255.255redistribute connected route-map CONNECTED-BGPredistribute ospf 1 match internal external 1 external 2 nssa-external

  • Auto Summarization

    auto-summary summarizes prefixes added to BGP at classfulboundaries

    The behavior is different depending on if the prefixes were added with the network command or through redistribution

    The default is no auto-summary since IOS 12.3

    Redistribution

    Redistribute only the classful network

    Network Command

    Inject more specific and summary

  • BGP Path Attributes

    A BGP path attribute (PA) is a characteristic of a BGP prefix

    Ultimately, BGP uses path attributes and the BGP best path selection algorithm to select a valid and best path for each NLRI

    Path attributes are categorized into one of four groups

    Well-known

    mandatory

    discretionary

    Optional

    transitive

    nontransitive

  • Path Attributes

    Attribute Class

    ORIGIN well-known mandatory

    AS_PATH well-known mandatory

    NEXT_HOP well-known mandatory

    LOCAL_PREF well-known discretionary

    ATOMIC_AGGREGATE well-known discretionary

    AGGREGATOR optional transitive

    COMMUNITY optional transitive

    MULTI_EXIT_DISC optional nontransitive

    ORIGINATOR_ID optional nontransitive

    CLUSTER_LIST optional nontransitive

  • ORIGIN Path Attribute

    How was this prefix entered into BGP? Where did it come from?

    IGP (i) Prefix was learned internal to the AS Prefixes added to BGP with the network command

    EGP (e) Prefix was learned via EGP

    Incomplete (?) Prefix was learned through some other method Redistributed routes have an origin of incomplete

  • ORIGIN Path Attribute

    R1#show ip bgp | i 1.1.1.1BGP table version is 188, local router ID is 1.1.1.1*> 1.1.1.1/32 0.0.0.0 0 32768 i

    R1#show ip bgp 1.1.1.1 | b OriginOrigin IGP, metric 0, localpref 100, weight 32768, valid, sourced,

    local, best

    R1#show ip bgp | i 10.0.45.0*>i10.0.45.0/30 2.2.2.2 0 100 0 65004 ?

    R1#show ip bgp 10.0.45.0 | b OriginOrigin incomplete, metric 0, localpref 100, valid, internal, best

  • AS_PATH Path Attribute

    Generally, AS_PATH lists all the AS a prefix has gone through

    A router drops any BGP prefix that contains its own AS in the AS_PATH

    AS_PATH influences inbound routing (shortest AS_PATH wins)

    Technically, AS_PATH can contain four different sub-components

    AS_SEQ Ordered list of AS numbers

    AS_SET Unordered set of AS numbers enclosed in { } Used when prefixes have been aggregated

    AS_CONFED_SEQUENCE Similar to AS_SEQ but used in confederations

    AS_CONFED_SET Similar to AS_SET but used in confederations

  • AS_PATH Path Attribute

    Router#sh ip bgp | b 10.64*> 10.64.0.0/16 192.168.100.161 500 0 13979 21326 4809 65103 i*> 10.65.0.0/16 192.168.100.161 500 0 13979 21326 4809 65106 i*> 10.66.0.0/16 192.168.100.161 500 0 13979 21326 4809 65107 i*> 10.67.0.0/16 192.168.100.161 500 0 13979 21326 65109 i

    Router#sh ip bgp 10.64.0.0BGP routing table entry for 10.64.0.0/16, version 2698Paths: (1 available, best #1, table default)

    Advertised to update-groups:1 2

    Refresh Epoch 113979 21326 4809 65103, (aggregated by 65103 192.168.101.3)

    192.168.100.161 from 192.168.100.161 (12.123.71.116)Origin IGP, localpref 500, valid, external, atomic-aggregate, bestCommunity: 13979:5000

  • LOCAL_PREF Path Attribute

    Local Preference

    Influences outbound path. Default is 100 and highest wins

    Well-known discretionary attribute only sent between iBGP peers

    Diagram courtesy cisco.com

  • Configuring LOCAL_PREF

    ip prefix-list PREFER_ME_PLEASE permit 1.1.1.1/32!route-map SET_LOCAL_PREF permit 10match ip address prefix-list PREFER_ME_PLEASEset local-preference 500!router bgp 65123neighbor 10.0.45.1 route-map SET_LOCAL_PREF in

    !R5#sh ip bgp 1.1.1.1BGP routing table entry for 1.1.1.1/32, version 183Paths: (2 available, best #2, table Default-IP-Routing-Table)

    Advertised to update-groups:2

    65004 651236.6.6.6 (metric 156160) from 6.6.6.6 (6.6.6.6)

    Origin IGP, metric 0, localpref 100, valid, internal65004 65123

    10.0.45.1 from 10.0.45.1 (172.16.46.193)Origin IGP, localpref 500, valid, external, best

  • MULTI_EXIT_DISC Path Attribute

    Multi-Exit-Discriminator (MED), sometimes known as metric

    Optional nontransitive attribute that influences inbound routing

    Default value is 0 and lowest wins

    MED is only compared when prefixes are coming from the same AS!!!

    Diagram courtesy cisco.com

  • Configuring MED

    ip prefix-list PREFER_ME_PLEASE permit 1.1.1.1/32!route-map SET_MED permit 10match ip address prefix-list PREFER_ME_PLEASEset metric 50!route-map SET_MED permit 20set metric 100!router bgp 65123neighbor 10.0.45.1 route-map SET_MED out

    !R5#sh ip bgp 1.1.1.1BGP routing table entry for 1.1.1.1/32, version 183Paths: (2 available, best #2, table Default-IP-Routing-Table)

    Advertised to update-groups:2

    65004 651236.6.6.6 (metric 156160) from 6.6.6.6 (6.6.6.6)

    Origin IGP, metric 50, localpref 100, valid, internal65004 65123

    10.0.45.1 from 10.0.45.1 (172.16.46.193)Origin IGP, localpref 500, valid, external, best

  • ATOMIC_AGGREGATE Path Attribute

    When aggregating prefixes that came from different AS_PATHs, AS_PATH information is lost

    When aggregating, BGP sets the ATOMIC_AGGREGATE path attribute Signals to receiving routers that AS_PATH information has been lost

    A router that receives a prefix with ATOMIC_AGGREGATE set cannot advertise a more specific prefix of the aggregate, and must keep ATOMIC_AGGREGATE set on updates

    Additionally, the AGGREGATOR path attribute is set AGGREGATOR specifies the RID and AS that aggregated the prefix

  • Configuring BGP Aggregation

    At least one subnet of the aggregate must be present

    By default, BGP will advertise the aggregate and more specific prefix

    R5#sh ip bgp | i 172.16.56*> 172.16.56.0/26 0.0.0.0 0 32768 ?*> 172.16.56.64/26 0.0.0.0 0 32768 ?*>i172.16.56.128/26 6.6.6.6 0 100 0 ?*>i172.16.56.192/26 6.6.6.6 0 100 0 ?

    router bgp 65056aggregate-address 172.16.56.0 255.255.255.0

    R5#sh ip bgp | i 172.16.56*> 172.16.56.0/26 0.0.0.0 0 32768 ?*> 172.16.56.0/24 0.0.0.0 32768 i*> 172.16.56.64/26 0.0.0.0 0 32768 ?*>i172.16.56.128/26 6.6.6.6 0 100 0 ?*>i172.16.56.192/26 6.6.6.6 0 100 0 ?

    router bgp 65056aggregate-address 172.16.56.0 255.255.255.0 summary-only

    R5#sh ip bgp | i 172.16.56s> 172.16.56.0/26 0.0.0.0 0 32768 ?*> 172.16.56.0/24 0.0.0.0 32768 is> 172.16.56.64/26 0.0.0.0 0 32768 ?s>i172.16.56.128/26 6.6.6.6 0 100 0 ?s>i172.16.56.192/26 6.6.6.6 0 100 0 ?

  • AS_SET

    Due to AS_PATH information being lost during aggregation, routing loops are a possibility

    The AS_SET path attribute helps address this by placing an unordered list of all the AS from the more specific prefixes into AS_SET

    Additionally, AS_SEQ is still set to the aggregating routers AS

    No more need to set ATOMIC_AGGREGATE

    AS_SET is dynamic If more specific routes downstream fail, AS_SETcan be updated on the fly, and those changes are advertised

  • Configuring AS_SET

    RouterC(config)#router bgp 300aggregate-adddress 160.0.0.0 255.0.0.0 summary-only as-set

    RouterD# show ip bgp | b Network

    Network Next Hop Metric LocPrf Weight Path*> 160.0.0.0/8 4.4.4.1 0 300 {200,100} i

    Diagram courtesy cisco.com

  • Adding a Default Route to the BGP Table

    There are multiple ways to get a default route into the BGP table

    network 0.0.0.0 0.0.0.0/0 must already exist in the routing table

    default-information originate 0.0.0.0/0 must already exist in the routing table Requires redistribution of 0.0.0.0/0 to work

    neighbor default-originate Unconditionally advertises 0.0.0.0/0 to a specific neighbor

  • Conditional Default Routing

    ip prefix-list MUST_EXIST permit 10.1.1.1/32!route-map CONDITION permit 10match ip address prefix-list MUST_EXIST

    !Router bgp 65123neighbor 10.0.123.2 default-originate route-map CONDITION

    ip prefix-list MUST_EXIST permit 10.1.1.1/32ip prefix-list DEFAULT_ROUTE permit 0.0.0.0/0!route-map MUST_EXIST permit 10match ip address prefix-list MUST_EXIST

    !route-map DEFAULT_ROUTEmatch ip address prefix-list DEFAULT_ROUTE

    !router bgp 65123neighbor 10.0.123.2 advertise-map DEFAULT_ROUTE exist-map MUST_EXIST

    Option 1: route-map

    Option 2: advertise-map

  • BGP Lab Diagrams

  • Lab L2/L3 Diagram

  • Constructing the BGP TableBGP Table SummaryBGP Table SourcesBGP Network CommandRedistribution into BGPAuto SummarizationBGP Path AttributesPath AttributesORIGIN Path AttributeORIGIN Path AttributeAS_PATH Path AttributeAS_PATH Path AttributeLOCAL_PREF Path AttributeConfiguring LOCAL_PREFMULTI_EXIT_DISC Path AttributeConfiguring MEDATOMIC_AGGREGATE Path AttributeConfiguring BGP AggregationAS_SETConfiguring AS_SETAdding a Default Route to the BGP TableConditional Default RoutingBGP Lab DiagramsLab L2/L3 DiagramSlide Number 25