博客统计信息

51cto推荐博客
用户名:ciscodocu
文章数:59
评论数:96
访问量:94195
无忧币:926
博客积分:1437
博客等级:4
注册日期:2007-11-29

我最近发表的评论

BSR and RP's.. 回复
另外在文档上也是这么写的,说全了..
BSR and RP's.. 回复
我这个是反复实验结论,没看卷二上..
BGP常用过滤策略 回复
非常好的总结
五、RIPv2解决与R.. 回复
::) 共同期待
51CTO网站博客改.. 回复
现在已经很不错了,功能强

背景音乐

我的音乐

00:00 | 00:00

公告

2008-05-16 09:13:49
刷到凌晨三点,思科很沉稳,看不到出结果的意思。
 
梦中一个激灵,看了看表,7点整,难道成绩出来了?
 
开机,上网,打开页面后,果然有些不一样,虽然最上面显示的仍是not certified,但下面tes..
多播PIM中,为提高冗余可靠性,常会布置多台BSR、RP,这些设备之间肯定会存在竞争,谁作主,谁备选?
 
一、RP-CANDIDATE
首先说一个特例,RP-CANDIDATE,我们通常会用下面的命令设置
ip pim rp-candida..
今天写东西比较舒服,干脆再来一篇
 
QOS中使用MQC定义完类型,做好策略之后,最后看似不起眼的一步,完全有可能让你功亏一篑。
 
这就是service-policy的方向问题
 
我们在使用过程中也会..
2008-05-01 18:51:58
刚写了Priority与Bandwidth的区别,趁热打铁,把police vs bandwidth也拿来来晒晒。
 
乍一看这两者后面带的都是带宽,其实区别还是很明显的,先把QOS的列出:
 
classification and marking ..
2008-05-01 18:39:29
Priority and Bandwidth是我们在QOS里经常会用到的两个命令,但是他们的区别倒底是什么
 
 
Priority 在cisco官方文档里经常被这样描述:reserved bandwidth
Bandwidth : Minimum bandwidth guara..
OSPF默认路由生成是个很实际的问题,但是在使用中得出以下这些结论着实费了很大力气。
 
一、、STUB区域中生成默认路由:
default-information-originate always
 
二、、NSS区域中生成默认路由:..
OSPF NSSA区域看似不起眼,但是他解决了STUB区域不能引入外部路由的问题,因为STUB区域只允许1、2、3类LSA进入,作为5类的外部路由肯定是无法注入OSPF的。
 
NSSA作为一个标准,提出了7类LSA,并允许其作..
为了在EIGRP中实现类似于OSPF中STUB区域的功能,避免分支机构路由学习全网路由时占用过多的广域网带宽,我们引入了EIGRP STUB命令,但是在使用过程中仍需注意它所带来的“负面效应”,即过滤一切传往对端的路由。..
本文全称应该是:Frame Relay Voice-Adaptive Traffic Shaping and Fragmentation,标题限制字数,没办法了
 
帧中继的流量整型向来是个头疼的地方,因为本身QOS就已经够乱,所以专门在这儿整理一下
&nbs..
路由过滤常用的方法如下,作用效果一致,可任选:
 
一、基于路由进程的过滤
1、Route-map
 
router ospf 10
 
Redistribute eigrp 10 subnets route-map Jackson
 
ip prefix-list..
思科SLA(Ip Service Level Aggrement)作为一种新的用来衡量服务质量,服务级别的技术,解决了以往只能在二层实现服务质量,以及只能以带宽作为服务级别分类的标准等等问题。
 
SLA可以实现端..
2007-11-04 08:33:21
1、如果下一跳不可达,不考虑下一跳。
2、优先选取有最大权重的路径。WEIGHT
3、如果多余路由有同样的权重,优先选取具有最高本地优先级的路由。LOCALPREF
4、如果有多条路由有相同的本地优先级,优先选取源自..
这两天stim写了很多不错的关于BGP的文章,从整体上给大家做了精彩的论述,我来换个角度,从细节方面一步步给大家展示BGP的强大威力。

我们知道在国干出口路由器上,肯定要有INTERNET全网路由注入国内运营商的..


为避免在AS内部的路由环路,BGP不会向内部BGP邻居通告它从其它内部BGP对等体中获得的路由。
 
上图中,R2会通告给R3所有它从R1学来的EBGP路由条目。但是这些路由不会通告给R4,因为R3不会在R2和R4之间传递IBGP路由。为使R4得知这些路由,R2和R4之间就必须有一对IBGP连接。
 
这些对IBGP全互连的要求造成了对每个IBGP路由器定义邻居语句的需求。在一个有100个路由器的AS中,这种情况要求定义100个邻居语句。因此,这对扩展性造成了严重的问题。
 
为克服这个问题,BGP里定义了路由反射器的概念(RR),RR是所有内部BGP(IBGP)会话的集中路由器或焦点。与路由反射器对等的路由
器称为路由反射器客户。这些客户与路由反射器相匹配并交换路由信息。路由反射器接着交换或者“反射”这一信息给所有客户,从而消除了对全互连环境的需要。
 
我们在此例中,把R3设置为路由反射器。
 
 
//// R1 ////
int f0/0
  ip ad 192.1.1.1 255.255.255.0
int lo0
  ip ad 1.1.1.1
 
router bgp 200
  no syn
  neighbor 192.1.1.2 remote-as 200
  network 1.0.0.0
 
 
//// R2 ////
int f0/0
  ip ad 192.1.1.2 255.255.255.0
 
int f0/1
  ip ad 193.1.1.2 255.255.255.0
 
router bgp 200
  no syn
  neighbor 192.1.1.1 remote-as 100
  neighbor 193.1.1.3 remote-as 200
  neighbor 193.1.1.3 next-hop-self
 
 
//// R3 ////
int f0/1
  ip ad 193.1.1.3 255.255.255.0
 
int f0/0
  ip ad 194.1.1.3 255.255.255.0
 
router bgp 200
  no syn
  neighbor 193.1.1.2 remote-as 200
  neighbor 193.1.1.2 route-reflector-client
  neighbor 194.1.1.4 remote-as 200
  neighbor 194.1.1.4 route-reflector-client
 
 
 
//// R4 ////
int f0/0
  ip ad 194.1.1.4 255.255.255.0
 
router bgp 200
  no syn
  neighbor 194.1.1.3 remote-as 200
 
 
 
验证:
show ip bgp
show ip ro
[/img]..


//// r1 ////
int lo0
  ip ad 1.1.1.1 255.255.255.0
 
int e2/0
  ip ad 192.1.1.1 255.255.255.0
 
router os 1
  net 0.0.0.0 255.255.255.255  //宣告所有接口,内部路由协议IGP先将AS内路由打通
 
router bgp 65000  //启用BGP,注意此时为子AS号.
  no syn         
//关闭同步.同步是一种过时的技术,当初是用来防止IGP不知道EGP路由条目的情况下做数据转发,会产生黑洞的问题应运而生的.同步的存在要求IGP
路由协议必须知道所有EGP路由条目,这就要求将EGP路由条目全部重分发进IGP路由表.最初的网络规模较小,这也许算不上什么问题.但现在全球路由条
目已经超过了18万,这样多的路由条目同时出现在一台普通的路由器上,只能说后果很严重了.曾经有过某省的核心骨路器因为错误地注入了EGP路由导致网络
大规模断线4个小时的严重后果.
ps:现在我们要求统一关闭同步,并且所有路由器全互连!
 
  neighbor 192.1.1.2 remote-as 65000
  network 1.0.0.0
 
 
//// r2 ////
int lo0
  ip ad 2.2.2.2 255.255.255.0
 
int e2/0
  ip ad 192.1.1.2 255.255.255.0
 
int e3/0
  ip ad 193.1.1.2 255.255.255.0
 
int e5/0
  ip ad 195.1.1.2 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 a 0  //宣告所有接口,注意掩码格式的意义
 
router bgp 65000
  no syn  //关闭同步
  bgp confederation identifier 200
  bgp confederation peers 65001
  neighbor 192.1.1.1 remote-as 65000
  neighbor 193.1.1.3 remote-as 65001
  neighbor 193.1.1.3 next-hop-self
  neighbor 195.1.1.4 remote-as 100
  network 2.0.0.0
 
 
 
//// r3 ////
int lo0
  ip ad 3.3.3.3 255.255.255.0
 
int e3/0
  ip ad 193.1.1.3 255.255.255.0
 
int e4/0
  ip ad 194.1.1.3 255.255.255.0
 
int e6/0
  ip ad 196.1.1.3 255.255.255.0
 
router os 1
  network 3.3.3.3 255.255.255.0
 
router bgp 65001
  no syn
  bgp confederation identifier 200     //bgp联邦设置,标识出真正的AS
  bgp confederation peers 65000        //BGP联邦内部成员
  neighbor 193.1.1.2 remote-as 65000
  neighbor 193.1.1.2 next-hop-self     //从AS100学来的路由下一跳改为自已
  neighbor 194.1.1.4 remote-as 65001
  neighbor 196.1.1.4 remote-as 100
  network 3.0.0.0
 
 
 
//// r4 ////
int lo0
  ip ad 4.4.4.4 255.255.255.0
 
int e4/0
  ip ad 194.1.1.4 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.0 area 0
 
router bgp 65001
  no syn
  neighbor 194.1.1.3 remote-as 65001
  network 4.0.0.0
 
 
 
//// r5 ////
int lo0
  ip ad 5.5.5.5 255.255.255.0
 
int e5/0
  ip ad 195.1.1.5 255.255.255.0
 
int e6/0
  ip ad 196.1.1.5 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 area 0
 
router bgp 65001
  no syn
  neighbor 195.1.1.2 remote-as 200
  neighbor 196.1.1.3 remote-as 200
 
 
 
完成以上所有配置后,应看到1.0.0.0 - 5.0.0.0 所有网段都将出现在路由表内,通过PING测试后,全网全通才正确.具体show ip bgp 以及 show ip ro内容有空我会发上来.
 
这个实验最后一步,建议可以在R5上改变发往AS200的路由条目的METRIC值.发往r3的metric设置为50,观察对AS内部路由器的选路影响.
 
命令如下:
//// r5 ////
access-list 1 permit 5.0.0.0 0.255.255.255   //定义出路由条目
 
route-map MED permit 10
  match ip address 1
  set metric 50
route-map MED permit 10
 
router bgp 100
  neighbor 196.1.1.3 route-map MED out
[/img]..


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
[/img]..



本地优先级(local
pref)属性是分配给路由的一种优先级度量,用于和到同一目的地的其他路由相比较。这是BGP路由处理中的第二优先属性(WEIGHT是第一优先属
性)。Local Pref属性只在本AS内部有效,不会被传送到EBGP邻居上。本地优先级越高,路由优先级越高。
 
以上案例中,我们通过对R3的配置,设置从R1学到的1.0.0.0的本地优先级(Localpref)设置为200,由于缺省的值为100,AS200中所有的路由器都会选择R3到达1.0.0.0。
 
 
//// 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
 
 
 
//// 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
  neighbor 193.1.1.1 route-map localpref in
 

access-list 1 permit 1.0.0.0 0.255.255.255
 
route-map localpref permit 10
  match ip ad 1
  set local-pref 200
route-map localpref permit 20
  set local-pref 100
 
//// 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
 
 
 
 
验证:
//// r4 ////
r4#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*>i1.0.0.0          195.1.1.3                0    200      0 100 i
* i2.0.0.0          195.1.1.3                0    100      0 100 i
*>i                 194.1.1.2                0    100      0 100 i
*> 4.0.0.0          0.0.0.0                  0         32768 i
 
 
r4#sh ip ro
B    1.0.0.0/8 [200/0] via 195.1.1.3, 00:02:20
B    2.0.0.0/8 [200/0] via 194.1.1.2, 00:02:24
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
O    193.1.1.0/24 [110/128] via 195.1.1.3, 00:04:35, Serial5/0
O    192.1.1.0/24 [110/128] via 194.1.1.2, 00:04:35, Serial4/0
C    195.1.1.0/24 is directly connected, Serial5/0
C    194.1.1.0/24 is directly connected, Serial4/0
 
 
 
 
 
r2#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*>i1.0.0.0          193.1.1.1                0    200      0 100 i
*                   192.1.1.1                0             0 100 i
* i2.0.0.0          193.1.1.1                0    100      0 100 i
*>                  192.1.1.1                0             0 100 i
*>i4.0.0.0          194.1.1.4                0    100      0 i
 
 
r2#sh ip ro
B    1.0.0.0/8 [200/0] via 193.1.1.1, 00:06:00
B    2.0.0.0/8 [20/0] via 192.1.1.1, 00:06:04
     4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O       4.4.4.4/32 [110/65] via 194.1.1.4, 00:08:20, Serial4/0
B       4.0.0.0/8 [200/0] via 194.1.1.4, 00:06:55
O    193.1.1.0/24 [110/192] via 194.1.1.4, 00:08:20, Serial4/0
C    192.1.1.0/24 is directly connected, Serial2/0
O    195.1.1.0/24 [110/128] via 194.1.1.4, 00:08:20, Serial4/0
C    194.1.1.0/24 is directly connected, Serial4/0
[/img]..

Cisco提供一种方式强IGP路由优先于EBGP路由.这个概念也就是"后门链路"(backdoor link).EBGP路由可以标记为后门链路,它将设置这些路由的管理距离与BGP本地或200相同.因为这个管理距离要高于IGP,所以首选IGP路由.
 
以下是具体配置:
 
//// r1 ////
int lo0
  ip ad 1.1.1.1 255.255.255.0
 
int e1/0
  ip ad 192.1.1.1 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 a 0   //将所有接口宣告进OSPF
 
router bgp 200
  no syn  //关闭同步,同时也注定了全互连的拓扑
  neighbor 192.1.1.2 remote-as 200
  neighbor 192.1.1.2 update-source lo0  //以lo0接口IP作为更新源地址
 
 
//// r2 ////
int lo0
  ip ad 2.2.2.2 255.255.255.0
 
int e1/0
  ip ad 192.1.1.2 255.255.255.0
 
int e0/0
  ip ad 193.1.1.2 255.255.255.0
 
int e2/0
  ip ad 195.1.1.2 255.255.255.0
 
router os 1
  network 0.0.0.0 255.255.255.255 a 0  //宣告所有接口进OSPF
 
router bgp 200
  no syn
  neighbor 192.1.1.1 remote-as 200
  neighbor 192.1.1.1 update-source lo0
  neighbor 192.1.1.1 next-hop-self
  neighbor 195.1.1.5 remote-as 100
  network 192.1.1.0 mask 255.255.255.0
 
 
//// r3 ////
int lo0
  ip ad 3.3.3.3 255.255.255.0
 
int e0/0
  ip ad 193.1.1.3 255.255.255.0
 
int e1/0
  ip ad 194.1.1.3 255.255.255.0
 
int e3/0
  ip ad 196.1.1.3 255.255.255.0
 
router os 1
  netw 0.0.0.0 255.255.255.255 a 0
 
router bgp 300
  no syn
  neighbor 196.1.1.5 remote-as 100
  neighbor 194.1.1.4 remote-as 300
  neighbor 194.1.1.4 update-source lo0
  neighbor 194.1.1.4 next-hop-self
  network 194.1.1.0 mask 255.255.255.0
 
 
//// r4 ////
int lo0
  ip ad 4.4.4.4 255.255.255.0
 
int e0/0
  ip ad 194.1.1.3 255.255.255.0
router os 1
  network 0.0.0.0 255.255.255.255 a 0
 
router bgp 300
  no syn
  neighbor 194.1.1.3 remote-as 300
  neighbor 194.1.1.3 update-source lo0
  network 192.1.1.0 mask 255.255.255.0 backdoor
 
//// r5 ////
int lo0
  ip ad 5.5.5.5 255.255.255.0
int e2/0
  ip ad 195.1.1.5 255.255.255.0
int e3/0
  ip ad 196.1.1.5 255.255.255.0
router bgp 100
  no syn
  neighbor 195.1.1.2 remote-as 200
  neighbor 196.1.1.3 remote-as 300

 
验证:
//后门链路作用前
r2#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 192.1.1.0        0.0.0.0                  0         32768 i
*> 194.1.1.0        195.1.1.5                              0 100 300 i
r2#
r2#
r2#
r2#sh ip ro bgp
B    194.1.1.0/24 [20/0] via 195.1.1.5, 00:00:49
 
r3#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 192.1.1.0        196.1.1.5                              0 100 200 i
*> 194.1.1.0        0.0.0.0                  0         32768 i
r3#sh ip ro bgp
B    192.1.1.0/24 [20/0] via 196.1.1.5, 00:02:28
 
 
r3#sh ip ro             //后门链路作用前
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/21] via 193.1.1.2, 00:04:22, Ethernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 193.1.1.2, 00:04:22, Ethernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/11] via 194.1.1.4, 00:04:22, Ethernet1/0
C    196.1.1.0/24 is directly connected, Serial3/0
C    193.1.1.0/24 is directly connected, Ethernet0/0
B    192.1.1.0/24 [20/0] via 196.1.1.5, 00:00:06
O    195.1.1.0/24 [110/74] via 193.1.1.2, 00:04:22, Ethernet0/0
C    194.1.1.0/24 is directly connected, Ethernet1/0
 
 
 
//后门链路作用后
r3#sh ip ro
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/21] via 193.1.1.2, 00:06:38, Ethernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 193.1.1.2, 00:06:38, Ethernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/11] via 194.1.1.4, 00:06:38, Ethernet1/0
C    196.1.1.0/24 is directly connected, Serial3/0
C    193.1.1.0/24 is directly connected, Ethernet0/0
O    192.1.1.0/24 [110/20] via 193.1.1.2, 00:00:06, Ethernet0/0
O    195.1.1.0/24 [110/74] via 193.1.1.2, 00:06:38, Ethernet0/0
C    194.1.1.0/24 is directly connected, Ethernet1/0

[/img]..


这个案例通过在R3上配置与访问列表结合的正则表达式,以阻止通过BGP发送过来的网络能通过AS300传到R4。
 
当来自一个特定AS的所有路由都需要过滤时,基于AS路径信息的过滤路由是非常有效的。如果不使用基于AS路径的过滤,我们不得不一个接一个地
列出所有AS300相关的每个路由。就像上一篇distribute-list中的方法一样。而AS路径过滤提供了一种高效的替代方法。
 
 
//// 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
  neighbor 193.1.1.3 filter-list 1 out
 

access-list 1 permit 1.0.0.0 0.255.255.255   //这个acc 1与下边的不同
 
route-map aspath 10
  match ip ad 1
  set aspath prepend 300 400
route-map aspath 20
 
ip as-path access-list 1 deny _300_  //拒绝任何通过AS300的路由
ip as-path access-list 1 permit .*
 
 
//// 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
 
 
验证始终都是重头戏:
验证结果应该是300这条路由在R3上消失,被过滤。
[/img]..


路由能够基于网络号过滤到或来自于某个特定邻居的路由更新。由访问列表组成的过滤器被应用到所有发送到或来自于某个特定邻居的BGP更新上。
 
本案例中,我们在R1上配置一个distribute-list,防止1.0.0.0/8被通告入AS200中。
 
 
//// 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 distribute-list 1 out
 
access-list 1 deny 1.0.0.0 0.255.255.255
access-list 1 permit any
 
 
 
//// 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
 
 
 
验证:
r2#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.0.0.0          192.1.1.1                0             0 100 i
* i2.0.0.0          193.1.1.1                0    100      0 100 i
*>                  192.1.1.1                0             0 100 i
*>i4.0.0.0          194.1.1.4                0    100      0 i
 
由193.1.1.1学来的1.0.0.0/8路由条目已被过滤!
[/img]..
 <<   1   2   3   >>   页数 ( 1/3 )