侧边栏壁纸
博主头像
一揽芳华 博主等级

行动起来,活在当下

  • 累计撰写 265 篇文章
  • 累计创建 24 个标签
  • 累计收到 4 条评论

目 录CONTENT

文章目录

18、BGP配置之Preferred Value 选路一

芳华是个男孩!
2024-10-14 / 0 评论 / 0 点赞 / 7 阅读 / 0 字
广告 广告

一、实验拓扑

image-1657089511352
image-1656994687499
二、实验需求

1、如图配置全网互通。要求BGP只发布和学习设备环回地址和10.0.45.0/24

2、要求R1访问10.0.45.0/24从R3走

三、实验过程

1、R1的配置

sys
un in en
sys R1
int g0/0/0
ip add 10.0.12.1 24
int g0/0/1
ip add 10.0.13.1 24
int loo0
ip add 1.1.1.1 32
ospf 1 router-id 1.1.1.1
area 0
net 10.0.12.0 0.0.0.255
net 10.0.13.0 0.0.0.255
net 1.1.1.1 0.0.0.0
bgp 200
router-id 1.1.1.1
pe 2.2.2.2 as 200
pe 2.2.2.2 con loo0
pe 3.3.3.3 as 200
pe 3.3.3.3 con loo0
net 1.1.1.1 32

2、R2的配置

sys
un in en
sys R2
int g0/0/0
ip add 10.0.12.2 24
int g0/0/1
ip add 10.0.24.2 24
int loo0
ip add 2.2.2.2 32
ospf 1 router-id 2.2.2.2
area 0
net 2.2.2.2 0.0.0.0
net 10.0.12.0 0.0.0.255
acl number 2000
rule 1 permit source 1.1.1.1 0
route-policy 1 permit node 1
if-match acl 2000
bgp 200
router-id 2.2.2.2
pe 1.1.1.1 as 200
pe 1.1.1.1 con loo0
pe 1.1.1.1 next-hop-local
pe 3.3.3.3 as 200
pe 3.3.3.3 con loo0
pe 3.3.3.3 next-hop-local
pe 10.0.24.4 as 100
net 2.2.2.2 32
import-route ospf 1 route-policy 1

3、R3的配置

sys
un in en
sys R3
int g0/0/1
ip add 10.0.13.3 24
int g0/0/0
ip add 10.0.35.3 24
int loo0
ip add 3.3.3.3  32
ospf 1 router-id 3.3.3.3
area 0
net 10.0.13.0 0.0.0.255
net 3.3.3.3 0.0.0.0
acl number 2000 
rule 1 permit source 1.1.1.1 0
route-policy 1 permit node 1
if-match acl 2000
bgp 200
router-id 3.3.3.3
pe 1.1.1.1 as 200
pe 1.1.1.1 con loo0
pe 1.1.1.1 next-hop-local
pe 2.2.2.2 as 200
pe 2.2.2.2 con loo0
pe 2.2.2.2 next-hop-local
pe 10.0.35.5 as 300
net 3.3.3.3 32
import-route ospf 1 route-policy 1

4、R4的配置

sys
un in en
sys R4
int g0/0/1
ip add 10.0.24.4 24
int g0/0/2
ip add 10.0.45.4 24
int loo0
ip add 4.4.4.4 32
acl number 2000
rule 1 permit source 4.4.4.4 0
rule 2 permit source 10.0.45.0 0.0.0.255
route-policy 1 permit node 1
if-match acl 2000
bgp 100
router-id 4.4.4.4
pe 10.0.24.2 as 200
pe 10.0.45.5 as 300
import-route direct route-policy 1

5、R5的配置

sys
un in en
sys R5
int g0/0/0
ip add 10.0.35.5 24
int g0/0/2
ip add 10.0.45.5 24
int loo0
ip add 5.5.5.5 32
acl number 2000
rule 1 permit source 5.5.5.5 0
rule 2 permit source 10.0.45.0 0.0.0.255
route-policy 1 permit node 1
if-match acl 2000
bgp 300
router-id 5.5.5.5
pe 10.0.45.4 as 100
pe 10.0.35.3 as 200
import-route direct route-policy 1

四、结果验证

1、在R1上查看BGP路由表

image-1656995065966

2、在R4和R5上查看BGP路由表

image-1656994897583

image-1656994927792

3、测试R1访问10.0.45.4/24的路径

image-1656995009736

0
BGP
广告 广告

评论区