The experimental configuration process and principle analysis of the bgp protocol are understood by Xiaobai (detailed experimental configuration process) (Huawei ensp simulator)

1. Autonomous Domain AS (Autonomous System)

An autonomous system is a collection of multiple routers under a single technical management system. The internal gateway protocol (such as RIP, OSPF) and common parameters are used to determine how to route data packets within the autonomous system, and the inter-AS routing protocol is used between autonomous systems To route data packets (such as BGP).
The Autonomous System Number (ASN) consists of 16 bits and has a total of 65,536 possible values.
The number 0 is reserved and may be used to identify non-routed networks. The maximum number 65536 is also reserved. The number block between 64512 and 65534 is designated as dedicated, and 23456 is reserved for use in ASN pool conversion, from 1 The number between 64511 (except 23456) is possible.
The ASN number is non-structural, because there are no internal fields in the ASN number structure, and the ASN does not have the function of summarizing or summarizing. The
autonomous system number needs to be applied for. For specific applications, please go to this website to learn about http://www.iana.org/

Second, the classification of dynamic routing

1. Divided by autonomous system

IGP: Autonomous system internal routing protocol, mainly: RIP1/RIP2, OSPF, ISIS
IGP is a routing protocol running inside AS, mainly to solve the problem of routing within the AS, find and calculate routing
EGP: routing protocol between autonomous systems, Usually: BGP
EGP is a routing protocol running between AS and AS, it solves the problem of routing between ASs.

2. Classified by agreement type

Distance vector routing protocol: rip1/2, BGP (Path Vector Protocol)
link state routing protocol: OSPF, ISIS

Three, the concept of BGP

1. Introduction to BGP

BGP is a dynamic routing protocol that runs between AS and AS. Its main function is to automatically exchange loopless routing information between ASs to construct the topology of the AS, thereby eliminating routing loops and implementing user-configured routing strategies . At present, there are many public network entries, which cannot be carried by the IGP protocol, but BGP can easily handle it. Generally, the BGP protocol is used for routing information between ISPs (network providers such as telecommunications, mobile, etc.) and ISPs or between cross-domain and regional headquarters and branches. exchange

2. Features of BGP

  1. BGP is an exterior gateway protocol (EGP), which is different from interior gateway protocols (IGP) such as OSPF and RIP. Its focus is not on discovering and calculating routes, but on selecting the best route between ASs and controlling the propagation of routes.
  2. BGP uses TCP as its transport layer protocol, which improves the reliability of the protocol.
  • BGP carries out route selection between domains, which requires very high protocol stability. Therefore, the high reliability of the TCP protocol is used to ensure the stability of the BGP protocol.
  • The BGP peers must be logically connected and have TCP connections. The destination port number is 179, and the local port number is arbitrary.
  1. When routing updates, BGP only sends updated routes, which greatly reduces the bandwidth occupied by BGP to propagate routes, and is suitable for propagating a large amount of routing information on the Internet.
  2. BGP is a distance vector (Distance-Vector) routing protocol, BGP avoids loops by design.
  • Between ASs: BGP carries AS path information to mark the passing ASs, and routes with local AS numbers will be discarded, thus avoiding loops between domains.
  • Inside the AS: The routes learned by BGP in the AS are no longer advertised to the BGP neighbors in the AS, avoiding loops in the AS.
  1. BGP provides a wealth of routing strategies, which can implement flexible filtering and selection of routes.
  2. BGP provides a mechanism to prevent route oscillation, which effectively improves the stability of the Internet network.
  3. BGP is easy to expand and can adapt to new developments in the network.
  4. BGP has a reliable routing update mechanism, rich metric measurement methods, and multiple attribute information for routing entries
  5. BGP does not require periodic updates, only incremental routes are sent when routing updates, and KeepAlive messages are sent periodically to maintain TCP connectivity

3. BGP message

Open message

The OPen message is the first message sent after TCP is established. It is used to establish a connection between
BGP peers . It mainly contains information such as BGP version number, local AS number, and Holdtime.

UPdate message

Update messages are used to update routing information between BGPs. Updata messages can advertise multiple reachable routing information with the same attributes,
and can also withdraw multiple unreachable routing information.

Notification message

The function of the message is that when BGP detects an error state, it immediately sends a NOtification message to the peer. After that, BGP will stop and
return to the idle state as long as it receives a Notification message (this message will only be sent when BGP has an error) Text, normal packet capture is not available)

Route-Refresh message

It is used to inform the peer of the ability to refresh the routes supported by the peer. When the ingress policy routing of BGP changes, the local BGP route will send
Route-Refresh packets to the peer. After receiving the information, the peer will re-route its routing information. Sent to the local BGP router (this message will only be sent when the BGP policy is changed to request the neighbor's route to be re-obtained. Normally, packet capture cannot be captured)

KeepAlive message

The message is sent periodically between peers to maintain the validity of the connection and maintain its connection. The KeepAlive message has only one BGP
header. The default KeepAlive message sending cycle is 60S and the hold time is 180S. This is similar to the Hello message in OSPF
Insert picture description here

4. Types of BGP
IBGP

BGP neighbor relationship within the same AS. IBGP neighbor refers to that the two ends of the peer running BGP are in the same AS domain and belong to the BGP AS.

EBGP

The BGP neighbor relationship between ASs. EBGP usually means that the two ends of the peers running the BGP protocol are in different ASs.

4. BGP application experiment (ospf, rip, route redistribution)

1. Experiment purpose and environment

The test network segment in ospf is transmitted to the rip in different areas through BGP, and the route is successfully learned, that is, the experiment is successful. Experimental environment Huawei ensp

2. Experimental planning topology diagram

Insert picture description here

3. Experimental configuration (detailed text analysis configuration process)
  • R1 configuration

sysname R1----------------------------------------Rename
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.252
interface GigabitEthernet0/0/1
ip address 15.0.0.1 255.255.255.252
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
bgp 100 ---------------- -------------------------------Start the BGP process
router-id 1.1.1.1 of AS (Autonomous Domain) 100 --- ----------------------------------Specify router -id
peer 2.2.2.2 as-number 100 ---- ----------------Specify the neighbor
peer whose IP in AS100 is 2.2.2.2 2.2.2.2 connect-interface LoopBack0—Establish a neighbor
peer with its own loopback port 0 4.4.4.4 as -number 100 -------------------Specify the neighbor
peer whose IP is 4.4.4.4 in AS100 4.4.4.4 connect-interface LoopBack0—Establish with its own loopback port 0 neighbor
network 1.1.1.1 255.255.255.255--------------Declare network segment
ospf 1 router-id 1.1.1.1 ------------------ ----------Create
area 0 in the ospf process with router-id 1.1.1.1 ------------------------- -----------------------Select area 0
network 1.1.1.1 0.0.0.0 ----------------- ---------Declare the area network segment
network 12.0.0.0 0.0.0.3
network 15.0.0.0 0.0.0.3

  • R2 configuration

sysname R2
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.252
interface GigabitEthernet0/0/1
ip address 23.0.0.1 255.255.255.252
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
bgp 100
router-id 2.2.2.2
peer 1.1 .1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 ebgp-max-hop 2 ------------------ ---Allow BGP to establish EBGP connections with peers on non-directly-connected networks, and at the same time, you can specify the maximum number of hops allowed to be 2, because 2 hops are required to cross out of your own area and enter other areas. If it is not set, the experiment will not succeed.
peer 3.3.3.3 connect-interface LoopBack0
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack0
network 2.2.2.2 255.255.255.255
ospf 1 router-id 2.2.2.2
import-route rip 1 cost 5 type 1
area 0
network 2.2.2.2 0.0.0.0
network 12.0.0.0 0.0.0.3
rip 1----------------------- ------------------------------------Create and enter rip
version 2 --------- -----------------------------------------Select the rip version
network 23.0.0.0-- -------------------------------------- Declare network segment
network 2.0.0.0

  • R3 configuration

sysname R3
interface GigabitEthernet0/0/1
ip address 23.0.0.2 255.255.255.252
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
bgp 200
router-id 3.3.3.3
peer 2.2.2.2 as-number 100
peer 2.2.2.2 ebgp-max- hop 2 --------------------- Allow BGP to establish EBGP connections with peers on non-directly connected networks, and at the same time, you can specify the maximum number of hops allowed to be 2 , Because you have to step out of your own area and enter other areas, you need 2 jumps. If it is not set, the experiment will not succeed.
peer 2.2.2.2 connect-interface LoopBack0
network 3.3.3.3 255.255.255.255
rip 1
version 2
network 3.0.0.0
network 23.0.0.0

  • R4 configuration

sysname R4
interface GigabitEthernet0/0/1
ip address 15.0.0.2 255.255.255.252
interface GigabitEthernet0/0/2
ip address 4.4.4.4 255.255.255.255
interface LoopBack1
ip address 202.0.0.1 255.255.255.0
interface LoopBack2
ip address 202.0.1.1 255.255.255.0
bgp 100
router-id 4.4.4.4
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
network 4.4.4.4 255.255.255.255
import-route direct -------------------------------- The command means that all network segments directly connected to this router do not need to be declared You can learn from other routes
import-route ospf 1--------------------------------Inject ospf into BGP Routing ( route redistribution
ospf 1 router-id 4.4.4.4
area 0
network 4.4.4.4 0.0.0.0
network 15.0.0.0 0.0.0.3

4. Test results

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/wulimingde/article/details/107448869
Recommended