Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

39. Basic configuration of BGP configuration experiment

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1. Experimental Topology

2. Basic configuration

R1 configuration

Interface Loopback0

Ip address 1.1.1.1 255.255.255.0

Interface Serial0/0

Ip address 13.1.1.1 255.255.255.0

Interface Serial0/1

Ip address 12.1.1.1 255.255.255.0

Router ospf 110

Router-id 1.1.1.1

Network 1.1.1.0 0.0.0.255 area 0

Network 12.1.1.0 0.0.0.255 area 0

Network 13.1.1.0 0.0.0.255 area 0

R2 configuration

Interface Loopback0

Ip address 2.2.2.2 255.255.255.0

Interface Serial0/0

Ip address 24.1.1.2 255.255.255.0

Interface Serial0/1

Ip address 12.1.1.2 255.255.255.0

Router ospf 110

Router-id 2.2.2.2

Network 2.2.2.0 0.0.0.255 area 0

Network 12.1.1.0 0.0.0.255 area 0

R3 configuration

Interface Loopback0

Ip address 3.3.3.3 255.255.255.0

Interface Serial0/0

Ip address 13.1.1.3 255.255.255.0

Interface Serial0/1

Ip address 35.1.1.3 255.255.255.0

Router ospf 110

Router-id 3.3.3.3

Network 3.3.3.0 0.0.0.255 area 0

Network 13.1.1.0 0.0.0.255 area 0

R4 configuration

Interface Loopback0

Ip address 4.4.4.4 255.255.255.0

Interface Serial0/0

Ip address 24.1.1.4 255.255.255.0

R5 configuration

Interface Loopback0

Ip address 5.5.5.5 255.255.255.0

Interface Serial0/1

Ip address 35.1.1.5 255.255.255.0

3. BGP neighbor establishment

IBGP builds neighbors with loop backlinks, and the default source address is the physical interface, so when using loopback to build neighbors, you need to specify the update source manually, for example: neighbor 3.3.3.3 update-source lo 0 (neighbors can be established in one way, but usually only update sources are determined on both sides)

EBBP generally uses physical interfaces to build neighbors. If you use loop backports, you need to change the TTL value, that is, to multi-hop. The default TTL value is 1, for example: neighbor 3.3.3.3 ebgp-multihop 2 (default is 255 if you do not specify a value)

R4 and R2 physical interfaces establish EBGP neighbors

R4 configuration

Router bgp 4

No synchronization

Bgp router-id 4.4.4.4

Neighbor 24.1.1.2 remote-as 1

R2 configuration

Router bgp 1

No synchronization

Bgp router-id 2.2.2.2

Neighbor 24.1.1.4 remote-as 4

R2 and R3 loops back to establish IBGP neighbors

R2 configuration

Router bgp 1

Neighbor 3.3.3.3 remote-as 1

Neighbor 3.3.3.3 update-source Loopback0

R3 configuration

Router bgp 1

No synchronization

Bgp router-id 3.3.3.3

Neighbor 2.2.2.2 remote-as 1

Neighbor 2.2.2.2 update-source Loopback0

R3 and R5 loops back to establish EBGP neighbors

R3 configuration

Router bgp 1

Neighbor 5.5.5.5 remote-as 5

Neighbor 5.5.5.5 ebgp-multihop 2

Neighbor 5.5.5.5 update-source Loopback0

R5 configuration

Router bgp 5

No synchronization

Bgp router-id 5.5.5.5

Neighbor 3.3.3.3 remote-as 1

Neighbor 3.3.3.3 ebgp-multihop 2

Neighbor 3.3.3.3 update-source Loopback0

R3 (config) # ip route 5.5.5.0 255.255.255.0 s0plash 1

R5 (config) # ip route 3.3.3.0 255.255.255.0 s0max 1

4. Network advertises the network

Network command:

When IGP sends hello packets to build neighbors, it advertises the network segment of the interface.

BGP must first build neighbors with neighbor, and then advertise routes with network. The advertised routes must exist in the routing table and match exactly, for example: network 4.4.4.0 mask 255.255.255.0 (this route must exist in the routing table to advertise)

R4 (config) # router bgp 4

R4 (config-router) # network 4.4.4.0 mask 255.255.255.0

5. Control plane

In the BGP table, * indicates reachable, > represents the best, the I after * > I indicates that it is learned through IBGP, and the space after * > indicates that it is learned by itself or through EBGP.

In the BGP table of R3, we can see a non-optimal route like * i4.4.4.0.

Synchronization: when you learn routing from IBGP, you must and can learn it through IGP before putting it in the routing table and passing it on to other neighbors.

Non-optimal routing: neither placed in the routing table nor passed on to other neighbors.

The main causes of non-optimal routing are: out of sync and unreachable next hop.

The way to solve the problem of asynchrony: write static routes or turn off synchronization. For example: no synchronization (now the default is to turn off synchronization)

The solution to the unreachable next hop is to write a static route or modify the next hop on the EBGP. For example, on R2, neighbor 3.3.3.3 next-hop-self.

It can be seen that the reason for the non-optimal routing of R3 is that the next hop is unreachable. Modify the next hop on R2.

R2 (config) # router bgp 1

R2 (config-router) # neighbor 3.3.3.3 next-hop-self

At this point, the route is placed in the routing table and passed to the neighbor.

6. Data level

At this point, use the loop return ping of R5 4.4.4.4.

It is blocked at this time, mainly because of the routing black hole. Both R3 and R5 have a route to the 4.4.4.0amp 24 network, but when R3 sends the data to R1, it is discarded because there is no route for 4.4.4.0amp 24 on R1.

In order to solve this problem, we use the method of FULL MESH to establish the all-neighbor relationship, that is, R1, R2 and R3 are neighbors to each other.

R1 (config) # router bgp 1

R1 (config-router) # bgp router-id 1.1.1.1

R1 (config-router) # neighbor 2.2.2.2 remote-as 1

R1 (config-router) # neighbor 2.2.2.2 update-source loopback 0

R1 (config-router) # neighbor 3.3.3.3 remote-as 1

R1 (config-router) # neighbor 3.3.3.3 update-source loopback 0

R2 (config) # router bgp 1

R2 (config-router) # neighbor 1.1.1.1 remote-as 1

R2 (config-router) # neighbor 1.1.1.1 update-source loopback 0

R3 (config) # router bgp 1

R3 (config-router) # neighbor 1.1.1.1 remote-as 1

R3 (config-router) # neighbor 1.1.1.1 update-source loopback 0

At this time, the route learned by R1 is a non-optimal route, which is out of sync (synchronization is turned off), and the next hop is unreachable (modify the next hop).

R2 (config) # router bgp 1

R2 (config-router) # neighbor 1.1.1.1 next-hop-self

At this point, the packet can reach R4, but it is still not available.

This is mainly because R4 does not have a route that reaches 5.5.5.5, so we need to advertise 5.5.5.5 into BGP on R5.

R5 (config) # router bgp 5

R5 (config-router) # network 5.5.5.0 mask 255.255.255.0

At this time, the 5.5.5.0tic24 route on R1 and R2 is a non-optimal route, and the default is to turn off synchronization. We need to modify the next hop on R3.

R3 (config) # router bgp 1

R3 (config-router) # neighbor 1.1.1.1 next-hop-self

R3 (config-router) # neighbor 2.2.2.2 next-hop-self

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report