HCIP course notes-13-BGP routing principles

Posted by jtbaker on Sat, 22 Jan 2022 03:43:33 +0100

HCIP course notes-13

IBGP horizontal segmentation

  • That is, when the router learns a route information from an IBGP peer, it will no longer announce the route to other IBGP peers.

Route Reflector

  • Router Reflector — RR
    We can configure an IBGP device as a routing reflector (RR), and the device configured as a routing reflector will reflect the learned routing information under certain conditions.

  • When we specify a device as the routing reflector RR, we must specify one or more neighbors as its customers. The system formed between RR and customers is called reflection cluster. Each cluster is set with a cluster ID - the RID of the RR in the reflection cluster. Other neighbors not defined as customers are called non customers.

Reflection rule:

  1. If the route reflector learns an IBGP route from its own customers, it will reflect it to all its customers and non customers.

  2. If the route reflector learns an IBGP route from its non customers, it will reflect it to all its customers, but not to non customers----- Non non non transmission

  3. When a router reflects a route, it only reflects the best route in its own BGP route The delivery rules are the same as those of BGP routing.

  • Because IBGP horizontal segmentation is mainly to prevent the generation of routing loop, and the reflection of routing reflector is equivalent to breaking the rules of IBGP horizontal segmentation, routing loop may appear. Therefore, in order to avoid the generation of routing loops, two attributes are specially introduced in the design of routing reflectors to avoid the generation of loops----- Originator_ID (originator ID), Cluster_list (cluster list)

Originator ID

  • Radiate the RID of the originator of this route information -- when this route is reflected by RR, this attribute will be added to the reflected route information. If RR receives that the originator ID attribute already exists in a routing message, it will not modify this attribute. When a device receives a routing message and finds that the originator ID in it is its own local RID, it will not accept the routing message to avoid routing backhaul.

  • If there are multiple reflections in an AS, there must be multiple reflection clusters. When radiating routing information, each RR will add the local cluster ID to the cluster list attribute in the routing information.

  • Note: these two attributes are only used for ring prevention within IBGP. Therefore, when these routes are passed to EBGP peers, they will not be carried.
    When RR performs route reflection, other attributes remain unchanged except the above two attributes will be added to the route information.

Configuration of RR

[R3 BGP] peer 2.2.2.2 reflect client -- specify R2 as the reflector client, and R3 itself becomes RR.

federal

  • The Federation EBGP relationship only inherits the routing rules between EBGP, but it cannot modify the routing attributes like EBGP peers. It also needs to abide by the AS-BY-AS rules, which is a special existence.

  • The mechanism of EBGP horizontal segmentation can be directly used to prevent the ring between federal EBGP and AS_ Add the member AS number in the path attribute to prevent ring, but the federated AS number will be enclosed in parentheses to distinguish---- This attribute is mainly used for AS internal ring protection, so it will not be passed to EBGP peers.

Federated configuration

[r2]bgp 64512 ---- Federal member start BGP The process needs to use a small number (the name of a federated member) AS No.) start
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 2 ---- Federal members must declare their large (real) size in the process AS No.)
[r2-bgp]peer 12.0.0.1 as-number 1
[r2-bgp]peer 3.3.3.3 as-number 64512 --- And federal members IBGP Use a trumpet for neighbor relationships
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 2.2.2.2 as-number 64512 
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r3-bgp]confederation peer-as 64513 ---- Need to establish a federation EBGP When peer relationships,
You need to declare the other party's trumpet first
[r3-bgp]peer 4.4.4.4 as-number 64513
[r3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r3-bgp]peer 4.4.4.4 ebgp-max-hop 2 --- 
Because the Federation EBGP Between is according to EBGP Peer to peer transmission rules to complete, so the default TTL Value 1,
And there is direct connection detection, so it needs to be modified TTL Value to turn off direct connection detection.
  • The defect of Federation in solving IBGP horizontal segmentation is that only one pair of IBGP peers can exist in a federation, because the route between IBGP can only be transmitted once. Therefore, in practical engineering, Federation and routing reflector can often be used together.

Routing principle of BGP

  • Prerequisite for BGP Routing - discard all unavailable routing information
Attribute nameareal limitsDefault valueEvaluation criteria (big or small)
PVNon dissemination0(0 - 65535)The bigger the better
LPBetween IBGP peers100The bigger the better
AS_PATHBetween BGP peersThe fewer records, the better
OGNBetween BGP peersDepending on the type of originI > e > ?
MEDBetween BGP peersThe default value is the overhead value in the global routing tableThe smaller the better

  1. The route with the largest value of the preferred value attribute is preferred

    • This attribute is a private attribute of Huawei equipment and can be understood as weight.

    • PV attribute is the attribute with the highest routing priority on the device. The larger the attribute, the better This attribute will not be transferred. It can only be modified on this device and can only take effect on this device. The passed route entry will not carry this attribute. Therefore, after the other party receives the route, this attribute will still be added according to the default value.

    • Therefore, this attribute is the most convenient attribute for interference routing on the device.

    The first modification method:
    [R4 BGP] peer 3.3.3.3 preferred value 100 - use this command to modify the PV value of the routing information sent by the corresponding neighbor

    Load sharing - that is, different flows take different lines to share the pressure of a single line.

    The second modification method: modify attributes through traffic capture

    1. Prefix list fetching traffic

      [r4]ip ip-prefix pv permit 10.0.0.0 24
      
    2. Routing policy modification properties

      [r4]route-policy pv permit node 10
      Info: New Sequence of this List.
      [r4-route-policy]if-match ip-prefix pv
      [r4-route-policy]apply preferred-value 100
      [r4]route-policy pv permit node 20 ---- Add an empty table to discharge the remaining flow
      Info: New Sequence of this List.
      
    3. Call routing policy in BGP

      [r4-bgp]peer 3.3.3.3 route-policy pv import ---- Note that you need to select the direction when calling; The direction of entry affects itself and the direction of exit affects others.
      
  2. The route with the largest local preference attribute is preferred
    LP - local priority attribute. The default value is 100. The higher the priority, the better. LP attribute can be passed, but it can only be passed between IBGP neighbors. It will not be carried when passing to EBGP neighbors. Therefore, this attribute is the most commonly used attribute for routing within IBGP.

    Modification method 1:
    [r3-bgp]default local-preference 200 --- take R3 In the routing information sent LP Change the value to 200
     Modification method 2:
    [r3]ip ip-prefix lp permit 10.0.0.0 24
    [r3]route-policy lp permit node 10
    Info: New Sequence of this List.
    [r3-route-policy]if-match ip-prefix lp
    [r3-route-policy]apply local-preference 200
    [r3-route-policy]q
    [r3]route-policy lp permit node 20
    Info: New Sequence of this List.
    [r3-bgp]peer 4.4.4.4 route-policy lp export ---- For 4.4.4.4 Execute outbound routing policy
    
  3. The priority of multiple methods of routing published by yourself is: manual aggregation > automatic aggregation > Network > republishing

  4. Preferred as_ The path property the shortest route
    AS_ Basic principle of path routing - the less the as number recorded, the better

    1. We turn on AS when aggregating routes_ After the set function, the AS numbers of different AS detailed routes are enclosed in braces and placed in AS_PATHS attribute. However, note that when comparing routes, no matter how many AS numbers are contained in braces, we treat them AS one.

    2. When federating, we also need to use AS to prevent ring within the Federation, which is enclosed in parentheses. In this case, we are conducting AS_ When comparing path lengths, the contents in parentheses are not considered.

      R1 Direction of exit
      [r1]ip ip-prefix as permit 10.0.0.0 24
      [r1]route-policy as permit node 10
      Info: New Sequence of this List.
      [r1-route-policy]apply as-path 11 22 33 ?
       additive Append to original As Number ----In the original AS Added based on No AS number
       overwrite Overwrite original As Number ----Clear the original AS Number, add after AS number
      [r1-route-policy]apply as-path 11 22 33 additive ---- In consideration of anti ring, it is recommended to use additive
      [r1]route-policy as permit node 20 --- Empty meter put through all
      [r1-bgp]peer 12.0.0.2 route-policy as export --- Influence of outgoing direction call AR2
      ------------------------------------------------------------------
      [r2-route-policy]apply as-path 1 1 1 additive 
      We just added it AS Number, which may exist in the real network. because AS_PATH Attributes can also be protected against rings, so writing in this way may lead to these problems AS The routing information cannot be accepted. So, to avoid this, we can add AS All the numbers are changed to real ones AS No. after all, the route selection is only related to the length, not the content.
      
  5. Optimal origin code attribute
    OGN - origin code

    1. The route published through the Network -- I -- I represents that the route originates from IGP protocol (including static route and direct route).

    2. The route published through the EGP protocol - E - refers to the external gateway protocol - EGP protocol before the BGP protocol. Because the protocol is basically not used at present, the e tag is very rare.

    3. Routes published in addition to the above two ways ----- The origin code mark of republishing route is?

      The priority relationship of the three origin codes is: I > e >?

[r1]route-policy ogn permit node 10
Info: New Sequence of this List.
[r1-route-policy]if-match ip-prefix ogn
[r1-route-policy]apply origin ?
 egp 		Remote EGP
 igp 		Local IGP
 incomplete Unknown heritage
[r1-route-policy]apply origin incomplete 
  1. The route with the lowest MED value is preferred

    • Med - Multi exit authentication attribute - the initial value of MED attribute, which is the overhead value in the routing table of inherited IGP protocol or static route or direct route.

      • This attribute can affect how traffic from other AS flows into your own AS

      • When announcing, BGP protocol can announce any route entry in the route table. By default, the overhead value of these routes is inherited into the MED attribute of BGP route. If the locally announced BGP route is passed to the EBGP neighbor, the MED value will be carried to facilitate the routing of the equipment in the AS where the EBGP neighbor is located. If the BGP route learned locally through the IBGP neighbor, it will also be passed to its own EBGP neighbor, but the MED value will be set to 0. Because these metrics are not generated locally.

    • Summary: it is recommended that all devices with EBGP neighbor relationship declare the routing of internal AS.

    • Note: when comparing MED values, multiple identical route information must come from the same AS, that is, AS_ The leftmost AS number in the path attribute must be the same, otherwise there is no comparability, and the comparison will be skipped directly.

    [r2]route-policy med permit node 10
    Info: New Sequence of this List.
    [r2-route-policy]if-match ip-prefix med 
    [r2-route-policy]apply cost 100
    --------------------------------------------
    [r4]ping -r -a 4.4.4.4 1.1.1.1 --- Record command, which can record the path information of data transmission
    

Topics: network