HCIP-IERS deployment of enterprise-level routing and switching network - BGP protocol principle and configuration

Table of contents

foreword

The basic function of BGP

Features of BGP protocol

BGP Neighbor Discovery

BGP Neighbor Type - EBGP

BGP Neighbor Type - IBGP

BGP Neighbor Relationship Configuration

Optimization of BGP Neighbor Relationship Configuration

BGP Neighborhood Establishment

How BGP routes are generated - Network (1)

How BGP routes are generated - Network (2)

 How BGP routes are generated - Import (1)

 How BGP routes are generated - Import (2)

 BGP update message

 One of the BGP advertising principles: only advertise its own optimal routes to neighbors

 The second principle of BGP advertisement: the optimal route obtained through EBGP is sent to all BGP neighbors

 BGP Advertisement Principle 3: The optimal route obtained through IBGP will not be advertised to other IBGP neighbors

​edit

BGP Advertisement Principle 4: Synchronization between BGP and IGP

BGP routing information processing

Problems Encountered in BGP Route Selection

Rich attributes of BGP

BGP attribute - Origin

BGP Attribute - AS_Path

BGP Attributes - Next_hop

BGP attribute - Local_Preference

BGP Attributes - MED

BGP Attributes - Community

BGP route optimization principle

 Effect of Preference_Value on route selection

Effect of Aggregation Mode on Route Selection

The route of the EBGP neighbor is better than the route of the IBGP neighbor

Influence of IGP Metric in an AS on BGP Route Selection

Effect of Router-ID and IP Address on BGP Route Selection

BGP Routing Policy Configuration Example

Overview of BGP Route Aggregation

 The Necessity of BGP Route Aggregation

BGP Route Aggregation Method - Static

BGP Route Aggregation Method - Automatic Aggregation

BGP Route Aggregation Method - Manual Aggregation

Problems Caused by BGP Route Aggregation - Potential Loops

 Problems Caused by BGP Route Aggregation - Solutions

thinking questions


 

foreword

        In the EGP protocol, the concept of AS (Autonomous System, autonomous system) is introduced. AS refers to a collection of routers managed by the same technical management organization and using a unified routing strategy.
        The interior of the AS uses IGP to calculate and discover routes. The routers in the same AS trust each other, so the route calculation and information flooding of IGP are completely open, and there is little manual intervention.
        The connection requirements between different ASs promote the development of the Exterior Gateway Protocol. As an Exterior Gateway Protocol, BGP is used for routing control and optimization between ASs.

The basic function of BGP

 

⦁ The predecessor of BGP, EGP, is designed very simply. It can only simply transmit routing information between ASs, without any optimization of routes, and does not consider how to avoid routing loops between ASs. Therefore, EBP is finally replaced by BGP. replace.
⦁ Compared with EGP, BGP has more characteristics of routing protocols, as follows:
        ⦁ Neighbor discovery and neighbor relationship establishment;         ⦁ Route acquisition,
        optimization and notification;
A large amount of routing information;
        ⦁ Provide rich routing control capabilities between ASs that are not fully trusted.
⦁ Using BGP as the routing protocol, the user's routing domain is exchanged with other routing domains as a whole, and this routing domain is the AS. The concept of an AS is a collection of routers and a network composed of these routers. These routers all belong to the same management organization and implement a unified routing policy.
⦁ Running the BGP protocol requires a unified autonomous system number to identify the routing domain, that is, the AS number. Each autonomous system has a unique number, which is assigned by IANA. Before January 2009, only AS numbers with a maximum length of 2 bytes can be used, that is, 1-65535. Among them, 1-64511 is a public AS, and 64512-65534 is a private AS. After January 2009, IANA decided to use a 4-byte AS with a range of 65536-4294967295.

Features of BGP protocol

 

⦁ Because routes are passed between ASs, in order to ensure data reliability, BGP uses TCP as its bearer protocol to establish connections. Therefore, unlike IGP, which establishes neighbors by hop-by-hop routers, BGP can establish neighbor relationships across multi-hop routers.
⦁ Routers between ASs do not completely trust each other. In order to realize routing control and optimization according to requirements, BGP has designed many attributes.

BGP Neighbor Discovery

 

⦁ The BGP protocol is designed to run routes between ASs. There are WAN links between ASs. Unpredictable link congestion or loss may occur when data packets are transmitted on the WAN. Therefore, BGP uses TCP as its bearer protocol. Guaranteed reliability.
⦁ BGP uses TCP encapsulation to establish a neighbor relationship, the port number is 179, and TCP uses unicast to establish a connection, so the BGP protocol does not use multicast to discover neighbors like RIP and OSPF. The unicast connection establishment also makes BGP only manually specify neighbors.

BGP Neighbor Type - EBGP

 

⦁ EBGP is only used to transfer routes between different ASs. As shown in the figure, RTB and BTC in AS 100 learn different routes from AS 200 and AS 300 respectively. How to realize the exchange of routes between AS 200 and AS 300 in AS 100?
⦁ Exchange learned routes of AS 200 and AS 300 in AS 100, import BGP routes into the IGP protocol (OSPF protocol in the figure) on the RTB and RTC routers in the topology, and then transfer the routes of the IGP protocol Introduce the BGP protocol on the RTB and RTC routers to realize the exchange of AS 200 and AS 300 routes.
⦁ The above method has the following disadvantages:
        ⦁ The number of routes carried by BGP on the public network is very large. After the IGP protocol is introduced, the IGP protocol cannot carry a large number of BGP routes; ⦁ When
        BGP routes are imported into the IGP protocol, strict control is required and the configuration is complicated , not easy to maintain;
        ⦁ The attributes carried by BGP may be lost when the IGP protocol is introduced, because the IGP protocol cannot recognize it.
⦁ Therefore, we need to design BGP to transfer routes within the AS.

BGP Neighbor Type - IBGP

 

⦁ As shown in the figure above, because BGP uses TCP as its bearer protocol, neighbor relationships can be established across devices. As shown in the figure, an IBGP neighbor relationship is established between RTB and RTC, and each transmits the routes learned from other ASs to the peer end, realizing the transmission of BGP routes within the AS.

BGP Neighbor Relationship Configuration

 

⦁ Configuration steps:
        ⦁ Configure Router ID (identify router);
        ⦁ Configure EBGP neighbor relationship (transfer routes between ASs);
        ⦁ Configure IBGP neighbor relationship (transfer routes within AS).
⦁ Configuration explanation: ⦁ If no Router ID is configured, the BGP router will automatically         elect a         Router
        ID according to certain rules. Choose the IP address with the highest numerical value on all its physical interfaces.         ⦁ Configuration command: router id XXXX ⦁ The type of BGP neighbor relationship is mainly distinguished by the configured AS number. The peer keyword is followed by the interface IP address of the peer neighbor, and the as-number is followed by the AS number of the neighbor router. It is an IBGP neighbor relationship; if the AS number is different, it is an EBGP neighbor relationship. ⦁ The peer keyword is followed by the update source IP address of the peer neighbor, which identifies the destination address for initiating a TCP connection to the peer neighbor. This address can be the IP address of the directly connected interface of the peer neighbor, or the IP address of the non-directly connected loopback interface (but the IP address must be reachable). When establishing an IBGP neighbor relationship, generally use the IP address of the LoopBack interface, because the LoopBack interface is always in the UP state after it is enabled, as long as the route is reachable, the neighbor relationship is always in a stable state; when establishing the EBGP neighbor relationship, generally use the IP address of the directly connected interface IP address, because EBGP establishes neighbor relationships across ASs, the routes between non-directly connected interfaces are unreachable before the neighbor relationship is established.




Optimization of BGP Neighbor Relationship Configuration

 

⦁ When establishing an EBGP neighbor relationship, generally use the IP address of the directly connected interface; when establishing an IBGP neighbor relationship, generally use the IP address of the Loopback interface.

BGP Neighborhood Establishment

 

⦁ BGP completes operations such as neighbor establishment and routing update through message interaction. There are five message types: Open, Update, Notification, Keepalive, and Route-refresh.
        ⦁ Open message: It is the first message sent after the TCP connection is established, and is used to establish the connection relationship between BGP neighbors. After the BGP neighbor receives the Open message and negotiates successfully, it will send a Keepalive message to confirm and maintain the validity of the connection. After confirmation, Update, Notification, Keepalive and Route-refresh messages can be exchanged between BGP neighbors.
        ⦁ Update message: used to exchange routing information between BGP neighbors. The Update message can advertise multiple pieces of reachable routing information with the same attributes, and can also revoke multiple pieces of unreachable routing information.
                ⦁ An Update message can advertise multiple reachable routes with the same routing attributes, and these routes can share a set of routing attributes. All routing attributes contained in a given Update message apply to all destinations (indicated by IP prefixes) in the NLRI (Network Layer Reachability Information) field in the Update message.
                ⦁ One Update message can withdraw multiple unreachable routes. Each route through a destination (indicated by an IP prefix) clearly defines a previously advertised route between BGP routers.
                ⦁ An Update message can only be used to withdraw routes, so there is no need to include path attributes or NLRI. On the contrary, it can also be used only to advertise reachable routes, and there is no need to carry revocation route information.
⦁ Notification message: When a BGP router detects an error state, it sends a Notification message to its neighbors, and then the BGP connection will be interrupted immediately.
⦁ Keepalive message: BGP routers will periodically send Keepalive messages to neighbors to maintain the validity of the connection.
⦁ Route-refresh message: Route-refresh is used to request the peer to resend routing information after changing the routing policy.

How BGP routes are generated - Network (1)

 

⦁ There are two ways to generate BGP routes: the first is to use the configuration command network, and the second is to use the configuration command import.
⦁ As shown in the figure, there are two user network segments of 100.0.0.0/24 and 100.0.1.0/24 on the RTA, and the route to the 100.0.0.0/24 network segment is specified through static routing on the RTB, which is learned through OSPF Route to 100.0.1.0/24. RTB establishes an EBGP neighbor relationship with RTC, and RTB announces the routes of 100.0.0.0/24, 100.0.1.0/24, and 10.1.12.0/24 through the network command, so that the peer EBGP neighbor RTC can learn the routes in the RTB routing table.

How BGP routes are generated - Network (2)

 How BGP routes are generated - Import (1)

 

⦁ There are two user network segments of 100.0.0.0/24 and 100.0.1.0/24 on the RTA, the route to the 100.0.0.0/24 network segment is specified on the RTB through static routing, and the route to the 100.0.1.0/ 24 routes. RTB establishes an EBGP neighbor relationship with RTC, and RTB announces the routes of 100.0.0.0/24, 100.0.1.0/24, and 10.1.12.0/24 through the import command, so that the peer EBGP neighbors can learn the routes in the local AS.
⦁ In order to prevent other routes from being imported into BGP, it is necessary to configure ip-prefix for exact matching, and call route-policy to control when BGP imports routes.

 How BGP routes are generated - Import (2)

 

 BGP update message

 One of the BGP advertising principles: only advertise its own optimal routes to neighbors

 

⦁ When there are multiple valid routes, a BGP router only advertises its best route to its neighbors.
        ⦁ RTD can learn the route of 100.0.0.0/24 from BGP neighbors RTB and RTC, and at the same time, RTD publishes its own direct route 200.0.0.0/24 to BGP. Use the command display bgp routing-table on the RTD to view it as shown in the figure;
        ⦁ Use the command display bgp routing-table on the RTE to view it as shown in the figure. It can be found that RTD advertises the effective and optimal route marked by itself to the BGP neighbor RTE.
⦁ Status meaning in BGP routing table:
        ⦁ Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale ⦁ Origin : i - IGP, e -
        EGP , ? – incomplete
        ⦁ Network: display the network address in the BGP routing table
        ⦁ NextHop: the next hop address of the message sent
        ⦁ MED: routing metric value
        ⦁ LocPrf: local preference
        ⦁ PrefVal: protocol preferred value
        ⦁ Path/Ogn: display AS path number and Origin attribute⦁
        Community: community attribute information

 The second principle of BGP advertisement: the optimal route obtained through EBGP is sent to all BGP neighbors

 

⦁ The optimal route obtained by a BGP router through EBGP will be advertised to all BGP neighbors (including EBGP neighbors and IBGP neighbors).
        ⦁ As shown in the figure, there is a user network segment of 100.0.0.0/24 on RTA, and this network segment is advertised to the BGP neighbor RTB through EBGP. After RTB receives the route of 100.0.0.0/24 from the EBGP neighbor, it will notify its own IBGP neighbor RTC and EBGP neighbor RTD.

 BGP Advertisement Principle 3: The optimal route obtained through IBGP will not be advertised to other IBGP neighbors

 

⦁ The optimal route obtained by a BGP router through IBGP will not be advertised to other IBGP neighbors.
        ⦁ As shown in the figure, there is a user network segment of 100.0.0.0/24 on RTA, RTA, RTB and RTC are IBGP neighbors to each other, and RTA advertises the route of 100.0.0.0/24 to RTB and RTC through IBGP, but RTB does not advertise the received IBGP routes to its IBGP neighbor RTC.
        ⦁ The purpose of this design is to prevent routing loops inside the AS. According to regulations, when a BGP route is transmitted within the same AS, the AS_Path attribute will not change. As shown in the figure, when RTA advertises the route of 100.0.0.0/24 to RTB, the AS_Path attribute remains unchanged and is empty. If RTB can advertise the IBGP route 100.0.0.0/24 to RTC, AS_Path is still empty. Then RTC may also advertise the route of 100.0.0.0/24 to RTA, because AS_Path is empty, RTA will not reject the IBGP route, and a routing loop occurs. Therefore, the above notification principle is to prevent routing loops inside the AS.

BGP Advertisement Principle 4: Synchronization between BGP and IGP

 

⦁ There is a 100.0.0.0/24 user network segment on RTA, which is advertised to RTB through EBGP. RTB establishes an IBGP neighbor relationship with RTD. RTD learns the BGP route through IBGP and advertises the route to the EBGP neighbor RTE.
⦁ When RTE accesses the route of 100.0.0.0/24, it looks up the routing table and finds that the next hop to reach the route of 100.0.0.0/24 is RTD. After RTE finds the outbound interface, it sends the data packet to RTD; RTD receives the data packet Finally, look up the routing table and find that the next hop of the route to 100.0.0.0/24 is RTB, and the outbound interface is the interface connected to RTC on RTD, so the data packet is sent to RTC, and RTC looks up the routing table and finds that it does not reach 100.0. 0.0/24 route, so the data is discarded, forming a "routing black hole".
⦁ BGP advertisement principle: Before a route learned from an IBGP neighbor is advertised to a BGP neighbor, the route must be known through IGP, that is, BGP and IGP are synchronized.
        ⦁ As shown in the figure, after RTD receives the IBGP route sent by RTB, if it wants to publish it to the BGP neighbor RTE, it checks whether the IGP protocol (that is, the OSPF protocol) can learn the route before publishing. If yes, advertise the IBGP route to RTE.
        ⦁ On Huawei routers, the synchronization check between BGP and IGP is disabled by default, the reason is to realize the normal advertisement of IBGP routes. However, after the synchronization check between BGP and IGP is turned off, the problem of "routing black hole" will appear. Therefore, there are two solutions to solve the above problems:
        ⦁ Import BGP routes into IGP to ensure the synchronization between IGP and BGP. However, because the number of BGP routes on the Internet is very large, once it is introduced into the IGP, it will bring a huge processing and storage burden to the IGP router. If the router is overloaded, it may be paralyzed.
        ⦁ IBGP routers must be fully interconnected to ensure that all routers can learn the advertised routes. This can solve the "routing black hole" problem caused by turning off synchronization.

BGP routing information processing

 

⦁ IP routing table (IP_RIB): Global routing information base, including all IP routing information.
⦁ BGP routing table (Local_RIB): BGP routing information base, including routing information selected by local BGP routers, neighbor table, and neighbor list list.
⦁ After receiving an Update message from a BGP neighbor, the router will execute an algorithm for path selection, determine the best path for each prefix, and store the calculated best path in the local BGP routing table (Local_RIB).
⦁ If the multipath feature is enabled, the best path and all equivalent paths are submitted to IP_RIB for consideration for installation. In addition to the best paths received from BGP neighbors, Local_RIB also contains routes injected by the current router (called locally initiated routes).
⦁ In Local_RIB, only the selected prefix will be encapsulated into the Update message and advertised to its own BGP neighbors.

Problems Encountered in BGP Route Selection

⦁ The solution to the above two problems:
        ⦁ When exchanging route reachability information between ASs, BGP is designed to provide rich attributes to achieve flexible control and optimization of routes.
                ⦁ Modify the routing table and adjust the link Metric between AS; 2. Do not modify the routing table, but use the policy to modify the next hop of the route. But these methods have limitations in some cases and cannot meet the rich demands of the network.
        ⦁ Record the propagation path when the route is passed between ASs to prevent loops.

Rich attributes of BGP

 

⦁ Recognized attributes: attributes that all BGP routers must recognize and support.
        ⦁ Recognized and mandatory: The attributes that must be included in the BGP Update message.
        ⦁ Recognized as arbitrary: It does not have to exist in the BGP Update message, and can be freely selected according to requirements.
⦁ Optional attributes: attributes that are not required to be recognized by all BGP routers.
        ⦁ Optional Transition: An attribute that BGP does not recognize, but can receive and advertise to its neighbors.
        ⦁ Optional non-transitional: BGP MAY ignore messages containing this attribute and not advertise to its neighbors.

BGP attribute - Origin

 

⦁ As shown in the figure, OSPF protocol is running in AS 200, and the network segment 200.0.0.0/24 is declared to OSPF. RTB converts the route of 200.0.0.0/24 into a BGP route through the network method to notify RTA, and RTC converts the route of 200.0.0.0/24 into a BGP route through the import method to notify RTA.
⦁ BGP transfers information between ASs and carries a large number of routes. If there are multiple paths to the same destination IP, and BGP learns these routes through different methods, the Origin attribute is a factor in determining the optimal path and is used to indicate the origin of the route.
⦁ Three attributes of Origin:
        ⦁ i indicates that the BGP route is injected through the network command;
        ⦁ e indicates that the BGP route is learned from EGP. The EGP protocol is difficult to see in the live network, but the Origin attribute of the route can be set through the routing policy. Change it to e;
        ⦁ ? That is, Incomplete indicates that BGP routing has learned routing information through other methods, such as using the import command to import routes.
⦁ The priorities of the three Origin attributes are: i>e>Incomplete (?).

BGP Attribute - AS_Path

 

⦁ BGP designed the AS_Path attribute for the above two problems, which records the numbers of all ASs that the route passes through:
        ⦁ In the figure, when RTA receives the route of 100.0.0.0/24 from RTB, AS_Path is (2, 4), When RTA receives the route of 100.0.0.0/24 from RTC, the AS_Path is (3, 5, 4). It is stipulated that the shorter the AS_Path (the fewer recorded AS numbers), the better the path, so RTA will prefer the route of 100.0.0.0/24 received from RTB.
        ⦁ Taking RTE as an example, the route of 100.0.0.0/24 is advertised through BGP, and the route may form a loop through RTE->RTB->RTC->RTD->RTE. To prevent loops, when RTE receives a route from RTD, it checks the AS_Path (carried by the route) attribute, and if it finds that the AS_Path of the route contains its own AS number, it discards the route.
⦁ Four types of AS_Path:
        ⦁ AS_Sequence (will be explained in detail when BGP route aggregation is explained later);
        ⦁ AS_Set (will be explained in detail when BGP route aggregation is explained later);
        ⦁ AS_Confed_Sequence (applied to confederation, not covered in this course);
        ⦁ AS_Confed_Set (applies to leagues, not covered in this course).

BGP Attributes - Next_hop

 

⦁ When the BGP router advertises the original route of the local end to the IBGP neighbor, it will set the Next_hop of the routing information to the interface IP used by the local end to establish the neighbor relationship.
        ⦁ As shown in the figure, when RTA advertises the network segment 100.0.0.0/24 to RTB, if RTA and RTB use a direct connection interface to establish an IBGP neighbor, then Next_hop is the IP of the interface directly connected to RTB on RTA; if RTA and RTB If a loopback interface is used to establish an IBGP neighbor relationship, Next_hop is the IP address of the loopback interface of the RTA.
⦁ When a BGP router advertises a route to an EBGP neighbor, it will set the Next_hop of the routing information to the IP of the interface that establishes a BGP neighbor relationship between the local end and the peer end.
        ⦁ As shown in the figure, when RTB publishes the network segment of 100.0.0.0/24 to RTC, Next_hop is the interface IP directly connected to RTC on RTB.
⦁ When a BGP router advertises a route learned from EBGP to IBGP neighbors, it does not change the next-hop attribute of the route.
        ⦁ Special case: As shown in the figure, when RTA learns the network segment of 200.0.0.0/24 released by RTC from RTB, Next_hop is the outgoing interface IP of RTD, because RTB and RTD are in the same network segment, and the Next_hop notified by RTC to RTB is IP address of the outgoing interface of the RTD.
⦁ Explanations for the above three situations:
        ⦁ EBGP neighbors generally use direct interfaces to establish neighbor relationships, and EBGP neighbors will modify Next_hop to their own outbound interface IP when advertising routes to each other; ⦁ IBGP neighbors usually
        use Loopback interfaces to establish neighbors, When the route originates from the router, Next_hop is changed to its own update source address after it is sent to neighbors, so that even if there is a link failure in the network, as long as Next_hop is reachable, the destination network segment can also be accessed, improving network stability;
        ⦁ Compared with IGP, for example, when RIP advertises routes, it will modify the next hop every time it passes through a router. The routers that advertise routes all claim that they can reach the target address, and send the data packet to the target network in a hop-by-hop manner. The routers in the network do not know who the real originating router is, thus creating loops. BGP only modifies Next_hop when transferring between EBGPs, and IBGP does not modify the next hop when sending routes learned from EBGP to IBGP neighbors, which prevents loops to a certain extent.

BGP attribute - Local_Preference

 

⦁ As shown in the figure, there is a user network segment of 200.0.0.0/24 in AS 200, which is advertised to AS 100 through BGP. How do administrators in AS 100 set up to access the network of 200.0.0.0/24 through a high-bandwidth link?
⦁ Solution:
        ⦁ Set the ip-prefix on the RTC to match the route of 200.0.0.0/24, use the route-policy to call the ip-prefix, and set the Local_Preference to 200, and apply the policy to the export direction of the route published by the RTA.
⦁ The Local_Pref attribute is only valid between IBGP neighbors and is not advertised to other ASs. It indicates the BGP priority of the router, the larger the value, the better.
⦁ The Local_Pref attribute is used to determine the best route for traffic leaving the AS. When a BGP router obtains multiple routes with the same destination address but different next hops through different IBGP neighbors, it will preferentially select the route with a higher value of the Local_Pref attribute, and its default value is 100.

BGP Attributes - MED

 

⦁ As shown in the figure, the administrator in AS 300 wants to operate in AS 300 to influence AS 200 to access 100.0.0.0/24 through a high-bandwidth link. How to achieve this?
⦁ Solution:
⦁ Set the ip-prefix on the RTE to match the route of 100.0.0.0/24, then set the route-policy to call the ip-prefix, and set the MED to 100, and apply the policy to the export direction of the route published by RTC.
⦁ The MED (Multi-Exit-Discriminator) attribute is only transmitted between two adjacent ASs, and the AS that receives this attribute will not announce it to any other third-party AS. As shown in the figure, AS100 will not receive the MED value set in AS 300, but AS 200 will receive the MED value set in AS 300, so AS 200 can choose a high-bandwidth route.
⦁ The MED attribute is equivalent to the metric value (Metric) used by IGP, which is used to determine the best route when traffic enters the AS. When a router running BGP obtains multiple routes with the same destination address but different next hops through different EBGP neighbors, under the same conditions, the route with the smaller MED value will be preferred as the best route. The default value is is 0.

BGP Attributes - Community

 

⦁ As shown in the figure, there is a user network segment of 10.1.10.0/24 in AS 10, and a user network segment of 10.1.11.0/24 in AS 11. In order to distinguish user network segments, 10.1.10.0/24 in AS 10 is configured with a community of 10:12, and 10.1.11.0/24 of AS 11 is configured with a community of 11:12. After sending the message to AS 12 through BGP, AS 12 expects After summarizing, shield the detailed routes and send them to AS 13, and hope that AS 13 will not pass the routes to other ASs after receiving them. How to achieve this?
⦁ Solution:
        ⦁ Set Community-filter on RTC to match the routes with Community 10:12 and 11:12, and then set route-policy to match Community-filter, aggregate the two routes into a route of 10.1.10.0/23 and Call route-policy.
        ⦁ Set the route-policy on the RTC, set the community attribute to no-export, and call the route-policy in the export direction notified by the RTC to the RTD.

BGP route optimization principle

 

 Effect of Preference_Value on route selection

 

⦁ As shown in the figure, there is a user network segment of 200.0.0.0/24 in AS 200. The administrator in AS 100 wants to access the network segment of 200.0.0.0/24 in AS 200 through a high-bandwidth link, and hopes to The policy on the network can only affect its own route selection, but not other devices. How to implement it?
⦁ Solution:
        ⦁ Set the ip-prefix on the RTA to match the route of 200.0.0.0/24, then set the route-policy to call the ip-prefix, and set the Preference_Value to 100, and apply the policy to the import direction of the route published by RTC.
⦁ Verification: Use the Tracert command on the RTC to view the routers that access the 200.0.0.0/24 network segment.

Effect of Aggregation Mode on Route Selection

 

⦁ As shown in the figure, in AS 200, there are users on the network segment 200.0.0.0/24 on RTB and RTC. After route aggregation is sent to RTA, and automatic aggregation and manual aggregation are enabled at the same time, how does RTB optimize the aggregated route?
⦁ As shown in the figure, enable automatic aggregation and manual aggregation on RTB at the same time, use the command to view, you can find that the routing entries of manual aggregation are sent to RTA, and the routing entries of automatic aggregation are not notified, indicating the priority of manual aggregation Higher than automatic aggregation.
⦁ When using route aggregation, it should be noted that automatic aggregation can only aggregate imported BGP routes, and manual aggregation can aggregate routes that exist in the BGP routing table, which will be introduced in detail in BGP route aggregation later. In the above scenario, because the routes that need to be aggregated are all imported routes, the purpose of aggregation can be achieved by using automatic aggregation or manual aggregation. If there are both imported routes and network-declared routes in the BGP routing table, manual aggregation can only be used.

The route of the EBGP neighbor is better than the route of the IBGP neighbor

 

⦁ As shown in the figure, there is a network segment of 200.0.0.0/24 in AS 200, which is notified to RTA and RTB through the EBGP neighbor relationship, and RTB will notify the network segment of 200.0.0.0/24 to RTA through the IBGP neighbor relationship. So RTA will receive two routes to 200.0.0.0/24, how will RTA optimize?
⦁ According to the route selection principle, RTA will prefer the route learned from EBGP neighbors.

Influence of IGP Metric in an AS on BGP Route Selection

 

⦁ As shown in the figure, there is a user network segment of 200.0.0.0/24 in AS 200, which is advertised to RTB and RTC through EBGP, and RTB and RTC advertise the route to RTA through IBGP. The administrator in AS 100 wants to access network segment 200.0.0.0/24 in AS 200 through a high-bandwidth link. How to implement it on RTA?
⦁ Adjust the OSPF Cost value of the interface connecting RTA and RTB to 100, and RTA will choose the path of RTA->RTC->RTD to access the 200.0.0.0/24 network segment: ⦁ The reason is that when
        RTA accesses 200.0.0.0/24, The Cost (2) to Next_hop 10.1.34.4 is less than the Cost to Next_hop 10.1.24.4 (101).

Effect of Router-ID and IP Address on BGP Route Selection

 

⦁ As shown in the figure, there is a user network segment of 200.0.0.0/24 in AS 200, which is advertised to RTB and RTC through EBGP, and RTB and RTC advertise the route to RTA through IBGP. RTA and RTB are connected by two links, how should RTA be optimized?
⦁ RTA will select the next hop as 10.1.12.2 as the next hop to access the network segment of 200.0.0.0/24:
        ⦁ RTA selects the path of RTA->RTB->RTD to access the network segment of 200.0.0.0/24, the reason is RTB Router-ID is smaller than RTC, BGP prefers the route published by the router with smaller Router-ID;
        ⦁ RTA selects the interface with the next hop as 10.1.12.2 address as the outgoing interface, because BGP prefers the neighbor with the smaller IP address routing.
⦁ Use the command display bgp routing-table 200.0.0.0 on RTA to view the following:
<RTA>display bgp routing-table 200.0.0.0
 BGP local router ID : 1.1.1.1
 Local AS number : 100
 Paths: 2 available, 1 best, 1 select
 BGP routing table entry information of 200.0.0.0/24:
 From: 2.2.2.2 (2.2.2.2)
 Route Duration: 00h02m10s  
 Relay IP Nexthop: 10.1.12.2
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 10.1.24.4
 Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre255, IGP cost 2, not preferred for router ID
……

BGP Routing Policy Configuration Example

 

⦁ As shown in the figure, there are two user network segments in AS 300, one is 200.0.0.0/24 and the other is 100.0.0.0/24. To distinguish users on different network segments, assign the community attribute 300:100 to the network segment 100.0.0.0/24 in AS 300, and assign the community attribute 300:200 to the network segment 200.0.0.0/24. When users in AS 100 access these two network segments, they want to implement traffic sharing on RTB and RTC. When AS 200 accesses these two network segments, it is hoped that traffic sharing will be implemented on RTE and RTF. Please use as many methods as possible to achieve the above requirements.
⦁ According to requirements, when AS 100 accesses these two network segments, it is hoped to implement traffic sharing on RTB and RTC; when AS 200 accesses these two network segments, it is expected to implement traffic sharing on RTE and RTF. Assume that the path when RTA accesses 100.0.0.0/24 is RTA->RTB->RTD->RTE->RTG, and the path when accessing 200.0.0.0/24 is RTA->RTC->RTD->RTF->RTG, Based on the knowledge of the learned path attributes, the following solutions are available for reference:
        ⦁ RTE and RTF notify RTD of routes carrying community attributes;
        ⦁ RTD uses two Community-filters to match different communities after receiving the route carrying community attributes attributes, and then use two route-policies to call Community-filter respectively, set the next hop of the route matching the community attribute 300:100 to the outgoing interface address on the RTE; set the next hop of the route matching the community attribute 300:200 Set it as the outgoing interface address on RTF;
        ⦁ Set two route-policies on RTD, one is to set the MED value of the route whose matching community attribute is 300:100 to 100, and call it in the export direction of RTC; the other is Match the route whose community attribute is 300:200 and set its MED value to 100, and call it in the export direction of RTB.

Overview of BGP Route Aggregation

 The Necessity of BGP Route Aggregation

 

⦁ Solution:
        ⦁ Summarize the detailed routes in AS 100 and AS 200 into a route of 10.1.8.0/21 on RTC, and advertise this aggregated route to Client AS.
⦁ There are a large number of routing entries on the Internet, and the following problems exist when processing these routes:
        ⦁ The routing table for storing routing entries will occupy a large amount of memory resources, and the transmission of routing information requires a large amount of bandwidth resources;
        ⦁ Frequent vibration of detailed routes causes network instability. Stablize.
⦁ Therefore, it is inevitable to save memory and bandwidth resources and reduce the impact of route flapping through route aggregation.

BGP Route Aggregation Method - Static

 

⦁ The idea of ​​using static routing to configure route aggregation:
        ⦁ Use static routing to aggregate the detailed route into 10.1.8.0/22, and the next hop points to NULL 0, because the aggregated route is not a specific address, and it is only the detailed route when it is sent to AS 200 Instead, in order to prevent routing loops, point the next hop to Null 0;
        ⦁ Due to the use of static routing, a route of 10.1.8.0/22 ​​is generated in the routing table, and the next hop is Null 0. Use the network command to change the 10.1.8.0/22 ​​route in the IP routing table into a BGP route, and advertise it to the peer BGP neighbor to achieve aggregation.

BGP Route Aggregation Method - Automatic Aggregation

 

⦁ As shown in the figure, there are 4 user network segments in AS 100, which are converted into BGP routes through import, and AS 200 is connected to a Client AS. How to solve this problem if the network segment in AS 200 does not want to receive too many routes?
⦁ The configuration is as shown in the figure. Use the command display bgp routing-table on the RTB and RTC routers to view, and the output is as follows:
<RTB>display bgp routing-table

       Network          NextHop        MED        LocPrf    PrefVal  Path/Ogn
*>   10.0.0.0           10.1.12.1                                           0       100?
<RTC>display bgp routing-table

       Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.0.0.0 10.1.23.2 0 200 100?
⦁ Automatic summarization only sums up the routes imported from BGP, and sends them to neighbors after summarizing the natural network segment.

BGP Route Aggregation Method - Manual Aggregation

 

⦁ As shown in the figure, there are 4 user network segments in AS 100. There are BGP routes imported through import and BGP routes imported through network. AS 200 is connected to a Client AS. The routers in this AS have low processing capacity. Therefore, it is desired to access the network segments in AS 100 and AS 200 without receiving too many routes. How to solve this problem?
⦁ The configuration is as shown in the figure. Use the command display bgp routing-table on the RTB and RTC routers to view, and the output is as follows:
<RTB>display bgp routing-table

       Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
*>   10.1.8.0/22        10.1.12.1                                           0      100?
<RTC>display bgp routing-table

        Network NextHop MED LocPrf PrefVal Path/Ogn
 *> 10.1.8.0/22 ​​10.1.23.2 0 200 100?
⦁ Manual aggregation aggregates the routes existing in the BGP local routing table, and can specify the mask of the aggregated routes.

Problems Caused by BGP Route Aggregation - Potential Loops

 Problems Caused by BGP Route Aggregation - Solutions

 

⦁ In order to solve the problems caused by BGP route aggregation, two AS_Path attributes are set:
        ⦁ Atomic-Aggregate: Recognized as arbitrary attributes, it is used to warn downstream routers of information loss. As shown in the figure, AS 200 is configured with route aggregation After the router aggregates, path loss occurs. At this time, the router notifies its neighbors of the path loss by carrying this attribute in an Update packet.
        ⦁ Aggregator: Optional transition attribute, which contains the AS number and Router-ID of the router that initiates the aggregation, indicating where the aggregation occurs.
⦁ There are two types of AS_Path attributes:
        ⦁ AS_Sequence: Indicates that the AS number in AS_Path is an ordered list.
        ⦁ AS_Set: Indicates that the AS number in AS_Path is an unordered list.
⦁ AS_Path itself is an ordered list, because every time AS_Path passes through an AS, the AS number will be added to AS_Path, and the AS_Path will be arranged from left to right in the order of passing.
        ⦁ As shown in the figure, when AS 400 advertises the aggregated route to AS 300, the AS_Path attribute (except those in curly brackets) indicates that the aggregated route passes through AS 200 and AS 400 in turn.
⦁ After aggregation occurs, if the aggregated route needs to carry the AS numbers passed by all detailed routes to prevent loops, add the as-set parameter after the aggregated command.
        ⦁ As shown in the figure, if aggregation occurs in AS 200 and the as-set parameter is configured, the aggregation routing will represent the AS_Path information of the detailed route with an AS-Set set (the AS number information in square brackets, the set The AS numbers are not in sequence), carried after the aggregated route to prevent loops.
⦁ Routing aggregation solves two types of problems. One is to reduce the burden of resources required for device transmission and calculation of routes, and the other is to hide specific routing information and reduce the impact of route flapping. However, after the route is aggregated, the AS_Path attribute is lost, which may cause a loop.
⦁ If the aggregated routes carry the AS information of all detailed routes, when the detailed routes fluctuate frequently, the aggregated routes may also be affected by frequent refreshes.
⦁ Therefore, whether the aggregated route carries the missing AS_Path information requires the designer to comprehensively consider the network environment.

thinking questions

 

⦁ Answer: ABC.
⦁ Answer: B.

Guess you like

Origin blog.csdn.net/weixin_57099902/article/details/132468202