操纵BGP AS-PATH 属性案例(配图+详细验证过程)

简介:


BGP总是优先选择具有最短AS路径的路由。本案例中,我们将配置R1,将1.0.0.0通告给R2、R3之前预先添加两个额外的AS路径到1.0.0.0上(AS300、AS400)
 
具体配置如下:
//// r1 ////
int f2/0
  ip ad 192.1.1.1 255.255.255.0
 
int f3/0
  ip ad 193.1.1.1 255.255.255.0
 
int lo0
  ip ad 1.1.1.1 255.255.255.0
 
int lo1
  ip ad 2.2.2.2 255.255.255.0
 
router bgp 100
  no syn
  neighbor 192.1.1.2 remote-as 200
  neighbor 193.1.1.3 remote-as 200
  network 1.0.0.0
  network 1.0.0.0
   neighbor 193.1.1.3 route-map aspath out
 
access-list 1 permit 1.0.0.0 0.255.255.255
 
route-map aspath 10
  match ip ad 1
  set as-path prepend 300 400
route-map aspath 20
 
 
 
//// r2 ////
int f2/0
  ip ad 192.1.1.2 255.255.255.0
 
int f4/0
  ip ad 194.1.1.2 255.255.255.0
 
router os 1
  netw 0.0.0.0 255.255.255.255 a 0
  passive-interface f2/0
 
router bgp 200
  no syn
  neighbor 192.1.1.1 remote-as 100
  neighbor 194.1.1.4 remote-as 200
  neighbor 195.1.1.3 remote-as 200
  neighbor 194.1.1.4 next-hop-self
 
 
//// r3 ////
int f3/0
  ip ad 193.1.1.3 255.255.255.0
 
int f5/0
  ip ad 195.1.1.3 255.255.255.0
 
router os 1
  netw 0.0.0.0 255.255.255.255 a 0
  passive-interface f3/0
 
router bgp 200
  no syn
  neighbor 193.1.1.1 remote-as 100
  neighbor 195.1.1.4 remote-as 200
  neighbor 195.1.1.4 next-hop-self
  neighbor 194.1.1.2 remote-as 200
 
 
//// r4 ////
int f4/0
  ip ad 194.1.1.4 255.255.255.0
 
int f5/0
  ip ad 195.1.1.4 255.255.255.0
 
int lo0
  ip ad 4.4.4.4 255.255.255.0
 
router os 1
  netw 0.0.0.0 255.255.255.255 a 0
 
router bgp 200
  no syn
  neighbor 194.1.1.2 remote-as 200
  neighbor 195.1.1.3 remote-as 200
  netw 4.0.0.0
 
 
 
验证:
 
r3#sh ip b
   Network          Next Hop            Metric LocPrf Weight Path
*>i1.0.0.0          192.1.1.1                0    100      0 100 i
*                   193.1.1.1                0             0 100 300 400 i
* i2.0.0.0          192.1.1.1                0    100      0 100 i
*>                  193.1.1.1                0             0 100 i
*>i4.0.0.0          195.1.1.4                0    100      0 i
 
 
r3#sh ip ro
B    1.0.0.0/8 [200/0] via 192.1.1.1, 00:05:23
B    2.0.0.0/8 [20/0] via 193.1.1.1, 00:05:23

     4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O       4.4.4.4/32 [110/65] via 195.1.1.4, 00:10:38, Serial5/0
B       4.0.0.0/8 [200/0] via 195.1.1.4, 00:10:13
C    193.1.1.0/24 is directly connected, Serial3/0
O    192.1.1.0/24 [110/192] via 195.1.1.4, 00:10:38, Serial5/0
C    195.1.1.0/24 is directly connected, Serial5/0
O    194.1.1.0/24 [110/128] via 195.1.1.4, 00:10:38, Serial5/0









本文转自 ciscodocu51CTO博客,原文链接:http://blog.51cto.com/ciscodocu/52841,如需转载请自行联系原作者
目录
相关文章
|
JSON API 数据格式
LangChain Agent:赋予 LLM 行动力的神秘力量
LangChain Agent 是什么?有什么用?基本原理是什么?那么多 Agent 类型在实际开发中又该如何选择?
1131 8
LangChain Agent:赋予 LLM 行动力的神秘力量
|
域名解析 网络协议 网络架构
追踪数据包路径 - traceroute
【1月更文挑战第22天】
517 1
|
7月前
|
存储 JavaScript 中间件
Vuex 中间件和 Pinia 中间件的性能有何区别?
Vuex 中间件和 Pinia 中间件的性能有何区别?
297 74
|
JavaScript 网络安全 开发工具
[保姆级-从0到1]利用hexo+github托管实现搭建个人博客
[保姆级-从0到1]利用hexo+github托管实现搭建个人博客
|
算法 安全 数据中心
BGP MD5认证的原理与实现
【7月更文挑战第15天】
327 3
BGP MD5认证的原理与实现
|
存储 算法 安全
BGP Keychain认证的原理与实现
【7月更文挑战第15天】
330 2
BGP Keychain认证的原理与实现
|
存储 JavaScript
ThreeJS创建关键帧动画
这篇文章讲解了如何在Three.js中利用关键帧轨道 (`KeyframeTrack`) 创建动画效果,并提供了详细的步骤和代码示例。
329 0
|
网络协议 数据安全/隐私保护 网络架构
|
JavaScript Java 测试技术
基于springboot+vue.js的基于HTML5的问卷调查系统附带文章和源代码设计说明文档ppt
基于springboot+vue.js的基于HTML5的问卷调查系统附带文章和源代码设计说明文档ppt
210 0
|
存储 机器学习/深度学习 安全
一文搞懂什么是Raid
一文搞懂什么是Raid
1186 0