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

Modify BGP routing using BGP origin-code attribute

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Experimental topology

Basic configuration:

R1

L0:1.1.1.1/32

L1:11.1.1.1/32

E1/0:10.1.12.1/24

E1/1:10.1.14.1/24

R2

L0:2.2.2.2/32

L1:22.2.2.2/32

E1/0:10.1.12.2/24

E1/1:10.1.24.2/24

R4

L0:4.4.4.4/32

L1:44.4.4.4/32

E1/0:10.1.24.4/24

E1/1:10.1.14.4/24

Configure IGP (RIP):

R1

Router rip

Version 2

Network 1.0.0.0

Network 10.0.0.0

No auto-summary

R2

Router rip

Version 2

Network 2.0.0.0

Network 10.0.0.0

No auto-summary

R4

Router rip

Version 2

Network 4.0.0.0

Network 10.0.0.0

No auto-summary

Configure BGP:

Router bgp 1

Bgp router-id 1.1.1.1

Bgp log-neighbor-changes

Network 1.1.1.1 mask 255.255.255.255

Network 2.2.2.2 mask 255.255.255.255 backdoor

Network 4.4.4.4 mask 255.255.255.255 backdoor

Network 11.1.1.1 mask 255.255.255.255

Neighbor 2.2.2.2 remote-as 23

Neighbor 2.2.2.2 ebgp-multihop 2

Neighbor 2.2.2.2 update-source Loopback0

Neighbor 4.4.4.4 remote-as 23

Neighbor 4.4.4.4 ebgp-multihop 2

Neighbor 4.4.4.4 update-source Loopback0

R2

Router bgp 23

Bgp router-id 2.2.2.2

Bgp log-neighbor-changes

Network 1.1.1.1 mask 255.255.255.255 backdoor

Network 2.2.2.2 mask 255.255.255.255

Network 22.2.2.2 mask 255.255.255.255

Neighbor 1.1.1.1 remote-as 1

Neighbor 1.1.1.1 ebgp-multihop 2

Neighbor 1.1.1.1 update-source Loopback0

Neighbor 4.4.4.4 remote-as 23

Neighbor 4.4.4.4 update-source Loopback0

R4

Router bgp 23

Bgp router-id 4.4.4.4

Bgp log-neighbor-changes

Network 1.1.1.1 mask 255.255.255.255 backdoor

Network 4.4.4.4 mask 255.255.255.255

Network 44.4.4.4 mask 255.255.255.255

Neighbor 1.1.1.1 remote-as 1

Neighbor 1.1.1.1 ebgp-multihop 2

Neighbor 1.1.1.1 update-source Loopback0

Neighbor 2.2.2.2 remote-as 23

Neighbor 2.2.2.2 update-source Loopback0

View the routing table of R1: origin is I, which indicates the route learned from IGP.

R1#sh ip bgp

BGP table version is 5, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, I-internal

R RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter

X best-external, an additional-path, c RIB-compressed

Origin codes: I-IGP, e-EGP,?-incomplete

RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path

R 2.2.2.2/32 4.4.4.4 0 23 i

R > 2.2.2.2 0 023 I

R 4.4.4.4/32 4.4.4.4 0 0 23 i

R > 2.2.2.2 0 23 I

* 22.2.2.2 Universe 32 4.4.4.4 0 23 I

* > 2.2.2.2 00 23 I

* 44.4.4.4Compact 32 4.4.4.4 0 0 23 I

* > 2.2.2.2 0 23 I

View the routing table of 22.2.2.2 44.4.4.4:

R1#sh ip bgp 22.2.2.2

BGP routing table entry for 22.2.2.2/32, version 4

Paths: (2 available, best # 2, table default)

Advertised to update-groups:

eighteen

Refresh Epoch 1

twenty-three

4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

Origin IGP, localpref 100, valid, external

Rx pathid: 0, tx pathid: 0

Refresh Epoch 1

twenty-three

2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

Origin IGP, metric 0, localpref 100, valid, external, best

Rx pathid: 0, tx pathid: 0x0

R1#sh ip bgp 44.4.4.4

BGP routing table entry for 44.4.4.4/32, version 5

Paths: (2 available, best # 2, table default)

Advertised to update-groups:

eighteen

Refresh Epoch 1

twenty-three

4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

Origin IGP, metric 0, localpref 100, valid, external

Rx pathid: 0, tx pathid: 0

Refresh Epoch 1

twenty-three

2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

Origin IGP, localpref 100, valid, external, best

Rx pathid: 0, tx pathid: 0x0

Origin is all IGP. Modify the bgp origin-clde property to make the 22.2.2.2 of R1 to R2 go permanently from R4 to 44.4.4.4 of R4.

Configure on R1:

Step 1: configure prefix-list

Ip prefix-list 22 seq 5 permit 22.2.2.2/32

Ip prefix-list 44 seq 5 permit 44.4.4.4/32

Step 2: configure route-map

Route-map ori-r2 permit 10

Match ip address prefix-list 22

Set origin incomplete

Route-map ori-r2 permit 20

Route-map ori-r4 permit 10

Match ip address prefix-list 44

Set origin incomplete

Route-map ori-r4 permit 20

Step 3: in BGP, call route-map in the corresponding neighbor in direction.

Neighbor 2.2.2.2 route-map ori-r2 in

Neighbor 4.4.4.4 route-map ori-r4 in

Step 4: reset BGP neighbors and relearn routing

Clea ip bgp *

View the R1 BGP routing table:

R1#sh ip bgp

BGP table version is 16, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, I-internal

R RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter

X best-external, an additional-path, c RIB-compressed

Origin codes: I-IGP, e-EGP,?-incomplete

RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path

* > 1.1.1.1 Compact 32 0.0.0.0 0 32768 I

R 2.2.2.2/32 4.4.4.4 0 23 i

R > 2.2.2.2 0 023 I

R 4.4.4.4/32 4.4.4.4 0 0 23 i

R > 2.2.2.2 0 23 I

* > 11.1.1.1 Compact 32 0.0.0.0 0 32768 I

* > 22.2.2.2Compact 32 4.4.4.4 0 23 I

* 2.2.2.2 0 023?

* 44.4.4.4Compact 32 4.4.4.4 0 023?

* > 2.2.2.2 0 23 I

This is, the BGP table shows the 22.2.2.2 routes learned from R2, and the origin-code attribute has been changed to? (incomplete), the 44.4.4.4 route learned from R4, the attribute is also changed to? (incomplete), give priority to routes with an origin-clde of I.

IGP (I) is better than EGP (e) and incomplete (?) The route of the.

R1#sh ip bgp 22.2.2.2

BGP routing table entry for 22.2.2.2/32, version 16

Paths: (2 available, best # 1, table default)

Advertised to update-groups:

eighteen

Refresh Epoch 1

twenty-three

4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

Origin IGP, localpref 100, valid, external, best

Rx pathid: 0, tx pathid: 0x0

Refresh Epoch 1

twenty-three

2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

Origin incomplete, metric 0, localpref 100, valid, external

Rx pathid: 0, tx pathid: 0

R1#sh ip bgp 44.4.4.4

BGP routing table entry for 44.4.4.4/32, version 15

Paths: (2 available, best # 2, table default)

Advertised to update-groups:

eighteen

Refresh Epoch 1

twenty-three

4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

Origin incomplete, metric 0, localpref 100, valid, external

Rx pathid: 0, tx pathid: 0

Refresh Epoch 1

twenty-three

2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

Origin IGP, localpref 100, valid, external, best

Rx pathid: 0, tx pathid: 0x0

The experiment is complete.

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