(ENSP) BGP experiment

1. BGP overview

  • Border Gateway Protocol
  • External routing protocol
  • Distance vector routing protocol
  • IGP: run inside AS
  • EGP: run between AS

Two, BGP characteristics

  • BGP controls the propagation of routes and selects the best route.

  • BGP uses TCP as its transport layer protocol, port number 179.

  • BGP is a path vector routing protocol. It uses the AS list to reach the destination address to measure the distance to the destination address.

  • BGP supports CIDR (Classless Inter-Domain Routing).

  • 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.

  • BGP routing completely solves the routing loop problem by carrying AS path information.

  • BGP provides a wealth of routing strategies, which can implement flexible filtering and selection of routes.

  • BGP is easy to expand and can adapt to new developments in the network.

3. BGP speakers and peers

1. BGP speaker
The router running the BGP protocol is called the BGP speaker. BGP speakers receive or generate routing information, and advertise the routing information to other BGP speakers.
2. BGP peers
BGP speakers that have TCP connections between each other and exchange routing information are BGP peers.
According to the AS where the peer is located, there are two types of peers:

  1. IBGP peer: The peer and the local router are in the same AS.
  2. EBGP peer: The peer and the local router are in different ASs.

Four, BGP route injection

  • Pure dynamic injection: inject all the routes discovered by IGP.
  • Semi-dynamic injection: selectively inject routes discovered by IGP.
  • Static injection: Inject statically configured routes.

Generally there are two ways:

  • Import method: According to the protocol type, import RIP routing, OSPF routing and other protocol routes into the BGP routing table. The Import method can also import static routes and direct routes.
  • Network method: Import the existing routes in the IP routing table into the BGP routing table one by one, which is more accurate than the Import method.

Five, BGP message types

  • Open: When establishing a BGP connection via TCP.
  • KeepAlive: After the connection is established.
  • Update: After stabilization.
  • Notification: When an error is found.

Six, BGP state machine

  • Idle status
  • Connect status
  • Active state
  • OpenSent status
  • OpenConfirm status
  • Established state

Seven, BGP attributes

  • Origin attribute
  • AS-PATH attribute
  • Next-Hop attributes
  • Local-Pref attribute
  • MED attributes

8. Experimental topology

Insert picture description here
The RIP protocol is used inside AS 100, the OSPF protocol is used inside AS 200, and the BGP protocol is used between ASs.

Nine, experimental configuration

1. First configure the router interface IP
R1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]int e0/0/0
[Huawei-Ethernet0/0/0]ip add 11.1.1.1 24
[Huawei-Ethernet0/0/0]q
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]ip add 10.1.1.1 24
[Huawei-Ethernet0/0/1]q

Other routers are configured this way.

2. Configure AS
100 internal dynamic routing protocol :
R1:

[Huawei]rip
[Huawei-rip-1]network 10.0.0.0
[Huawei-rip-1]network 11.0.0.0
[Huawei-rip-1]q

R2 :

[Huawei]rip
[Huawei-rip-1]network 13.0.0.0
[Huawei-rip-1]network 11.0.0.0
[Huawei-rip-1]q

AS 200:
R3:

[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 21.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]q

R4:

[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 22.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]q
[Huawei]q

R5:

[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 21.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 22.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]q
[Huawei]q

3. Configure BGP protocol

R1 :

[Huawei]bgp 100
[Huawei-bgp]peer 10.1.1.2 as-number 200

R3:

[Huawei]bgp 200
[Huawei-bgp]peer 10.1.1.1 as-number 100

Other routers are similar.

4. BGP route injection into
R1:

[Huawei]bgp 100
[Huawei-bgp]import-route direct
[Huawei-bgp]import-route rip 1
[Huawei-bgp]q

R6:

[Huawei]bgp 300
[Huawei-bgp]peer 23.1.1.1 as-number 200
[Huawei-bgp]network 24.1.1.10 24
[Huawei-bgp]q
  • The devices in AS 100 and AS 200 use the import method to import routes.
  • The equipment in AS 300 adopts the network method to import routes.

5. BGP synchronization
R1:

[Huawei]rip
[Huawei-rip-1]import-route bgp
[Huawei-rip-1]q
[Huawei]q

R3:

[Huawei]ospf 1
[Huawei-ospf-1]import-route bgp
[Huawei-ospf-1]q
[Huawei]q

Other routers are similar.

6, Next-Hop attribute configuration

R1 :

[Huawei]bgp 100
[Huawei-bgp]peer 10.1.1.2 next-hop-local    //要将BGP路由发送给10.1.1.2这个邻居时,将路由的下一跳设置成自己的地址,这个地址是与10.1.1.2建立邻居所使用的源地址。
[Huawei-bgp]q
[Huawei]q

7. Configure route aggregation
R1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int loo1
[Huawei-LoopBack1]ip add 14.1.1.10 24
[Huawei-LoopBack1]q
[Huawei]int loop2
[Huawei-LoopBack2]ip add 14.1.2.10 24
[Huawei-LoopBack2]q
[Huawei]int loop3
[Huawei-LoopBack3]ip add 14.1.3.10 24
[Huawei-LoopBack3]q
[Huawei]q

R1:

[Huawei]bgp 100
[Huawei-bgp]aggregate 14.1.0.0 255.255.255.0
[Huawei-bgp]q
[Huawei]q

8. Add link
Insert picture description here
9. Configure Local-Pref attribute
Purpose: Let the route from R1 to R6 go through R3 instead of R4 and
R3:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]route-policy lop permit node 10
Info: New Sequence of this List.
[Huawei-route-policy]apply local-preference 222
[Huawei-route-policy]q
[Huawei]bgp 200
[Huawei-bgp]peer 10.1.1.1 route-policy lop export
[Huawei-bgp]q
[Huawei]q
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]q
<Huawei>reset bgp all

10. Configure MED attribute
R4:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]route-policy med permit node 10
Info: New Sequence of this List.
[Huawei-route-policy]apply cost + 500
[Huawei-route-policy]q
[Huawei]bgp 200
[Huawei-bgp]peer 25.1.1.1 route-policy med export
[Huawei-bgp]q
[Huawei]q

View the routing table of R1 after configuration:
Insert picture description here

10. Experimental test

Take R3 as a test case:
View the neighbor status of R3:
Insert picture description here
You can see the neighbor status at this time.

Check the R3 BGP routing table:
the routing table before route aggregation is not
Insert picture description here
configured:
Insert picture description here
the routing table after the route aggregation is configured: the routing table contains all subnets.

Check the BGP routing table of R1:
Insert picture description here
Ping R6 from R2: The
Insert picture description here
experiment is successful!

11. Experimental message capture

1. BGP message
Insert picture description here
2. OSPF message
Insert picture description here

12. Experiment summary

In this experiment, I learned about BGP and applied it to the experiment. Basic BGP experiments are configured, route aggregation, next hop attributes, priority attributes, MED attributes, BGP synchronization, etc. are configured, but the knowledge I have presented now is far from enough to truly master the BGP protocol. Hope that in the next experiment, I will learn more!

Guess you like

Origin blog.csdn.net/weixin_44366125/article/details/105982121