zoukankan      html  css  js  c++  java
  • 1.7-BGP⑥

    BGP中的路由控制/过滤:
    LAB1:Distribute-list调用ACL(较落后)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        
    Step1:通过ACL定义BGP路由:
    如果不打算建立route-map
    那么Access-list里面的
    (Deny:不允许)
    (permit:允许)
    R1(config)#access-list 1 permit 110.0.1.0 (0.0.0.0)
    (ACL的最后,有隐患的Deny Any.)
    Step2:通过distribute-list/分布列表
    R1(config)#router bgp 120
    R1(config-router)#neighbor 13.0.0.3 distribute-list 1 out
    Step3:使用ACL的反掩码,定义有一定特征的路由:
    3-1:定义有偶数特征的路由:
    R2(config)#access-list 2 permit 110.0.0.0 0.0.254.0 (偶数)
    R2(config-router)#neighbor 1.1.1.1 distribute-list 2 in
    R1(config)# access-list 1 permit 110.0.1.0 0.0.254.0 (奇数)
    Redistrubute:重分布,将一种路由注入到另外的一种路由中.
    软清:
    R3#clear ip bgp * soft out (使用在:出方向的策略发生改变时)
    Step3:观察R3对R1发送了哪些BGP路由:
    R3#show ip bgp neighbor 13.0.0.1 advertised-routes
    提醒:在更新的IOS版本中,出现了“Distribute-list+prefix-list”
    LAB2:通过neighbor命令,直接调用prefix-list(较先进,简洁)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Step1:通过前缀列表/prefix-list,定义需要控制的BGP路由:
    (Deny:不允许)
    (Permit:允许)
    R1(config)#ip prefix-list T-R3 seq 5 permit 110.0.1.0/24
    R1(config)#ip prefix-list T-R3 seq 10 permit 110.0.3.0/24
    (IP prefix-list 的最后,有隐含的Deny Any)
    如果Prefix-list直接被BGP进程调用,则应该严格匹配路由表的路由长度!!
    IP prefix-list的最后,有隐患的Deny Any.
    Stet2:在R1对R3的出方向,调用prefix-list T-R3,进行路由过滤:
    R1(config-router)#neighbor 13.0.0.3 prefix-list T-R3 out
    在BGP进程中,不能对同一个邻居同时调用access-list和prefix-list
    如果只打上:
    neighbor 13.0.0.1 prefix-list maple out
    而没有建立一个名为maple的prefix-list,则全部的路由都放行,即邻居把所有的路由都可以收到!!
    LAB3:neighbor+route-map+ACL
    (使用route-map,功能强大,实现复杂功能)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Step1:通过ACL定义BGP路由:
    (permit:匹配)
    R1(config)#access-list 1 permit 110.1.0.0
    R1(config)#access-list 3 permit 110.3.0.0
    Step2:通过route-map,调用ACL,
    让Route-map决定是否允许这些定义好的路由穿过本AS:
    (permit:允许),(Deny:不允许)!!!
    R1#
    route-map Send-R3 permit 10
    match ip address 1 (ACL 1)
    后面 没有空的Route-map:Deny Any
    Step3:
    neighbor 13.0.0.3 route-map Send-R3 out
    假如增加:
    route-map Send-R3 permit 20
    (Match any,set nothing!)
    (是否有这一句空的route-map,决定了:
    route-map中,没有明细定义的路由,将是否可以传到别的AS中)
    (115.3.3.0/24)
    LAB4:neighbor+Route-map+Prefix-list 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Step1:通过前缀列表/prefix-list,定义需要控制的BGP路由:
    (permit:匹配)
    ip prefix-list B-130 seq 5 permit 110.0.1.0/24
    ip prefix-list B-130 seq 10 permit 110.0.3.0/24
    Step2:通过Route-map,决定是否允许特定路由传递给对方:
    (permit:允许),(Deny:不允许)!~!!!
    route-map SEND-R2 permit 10
    match ip address prefix-list B-130
    Step3:R1对邻居R3调用Route-map:
    R1(config-router)#neighbor 13.0.0.3 route-map SEND-R3 out
    如果写错了ROUTE-MAP的名字则不会发送任何路由出去
    对于上述4个实验,如果在R3上做in方向的路由过滤,则需要硬清除.
    Clear ip bgp * (会Reset TCP 的连接)
    LAB5:BGP BackDoor/后门
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    用于EBGP与IGP之间的AD竞选时,人为的让IGP优先进入路由表的一种操作.
        20    120 
    人为的让IGP优先进入路由表的一种BGP路由操纵
        
    R4/R5之间运行IGP:EIGRP
    R4#做后门之前的路由
    B   105.0.0.0/8 [20/0] via 24.0.0.2, 
    后门的操作:
    R4(config-router)#network 105.0.0.0 mask 255.0.0.0 backdoor
    R4做后门的路由
    D    105.0.0.0/8 [90/409600] via 45.0.0.5
    LAB6:通过As-path List 控制穿越特定AS的BGP路由.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    6-1:
    ^ (shift+6)               $  (shift+4)
    开始标识符,                结束标识符
    Step1:
    只接收起源自AS150的BGP路由:
    ip as-path access-list 1 permit _150$ (起源自AS150)
    _:表示任意一个字符
    Step2:通过filter-list,调用as-path list 150
    R4(config)#router bgp 240
    R4(config-router)#neighbor 2.2.2.2 filter-list 1 in
    6-2:只接收与本AS直接相连的,那个AS110所发来的BGP路由:
    R4(config)#ip as-path access-list 130 permit ^110$
    6-3:只接收穿越了AS110的BGP路由:
    ip as-path access-list 130 permit _110_
    (与Access-list,prefix-list一样的,
    As-path-list在列表的最后,都有隐含的Deny Any.)
    6-4:接收所有Any路由:
    R2(config)#ip as-path access-list 130 permit .* (permit any)
    6-5:在一个AS-Path-list,中的多个匹配条件:(允许AS130t AS150)
    ip as-path access-list 130 permit _130$
    ip as-path access-list 130 permit ^150$
    6-6:拒绝起源于AS110,但允许所有的BGP路由:
    R4(config)#ip as-path access-list 130 deny ^110$
    R4(config)#ip as-path access-list 130 permit .*
    LAB7:BGP Damping
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    背景知识:
    BGP dampening:牺牲收敛性,强调稳定性。
    Damp的惩罚值:1000(固定值)
    15:(分钟) half-life   /半衰期  half-life time for the penalty
    750:reusing          /重新启用路由的阀值  penalty to start reusing a route
    2000:suppressing     /开始进行抑制的阀值  penalty to start suppressing a route
    60:(分钟)  Maximum duration to suppress (设置为半衰期的4倍)
    Maximum duration to suppress a stable route
        
        
    Step1:通过前缀列表,定义需要进行Damp的BGP路由:
    R3(config)#ip prefix-list B-105 permit 105.0.0.0/8
    Step2:创建Route-map,对特定路由进行Damping,并且可以设定Damping的参数.
    route-map DAMP permit 10
    match ip address prefix-list B-10
    set dampening 15 750 2000 60
    Step3:在BGP进程中调用Route-map,进行BGP dampening
    router bgp 130
    Bgp dampening route-map DAMP
    旧版本:
    R3#show ip bgp flap-statistics
    R3#show ip bgp dampened-paths
    新版本:
    R3#show ip bgp dampening flap-statistices
    R3#show ip bgp dampening dampened-paths
    clear ip bgp dampening (恢复正常)




  • 相关阅读:
    attributeError:'module' object has no attribute ** 解决办法
    Pyqt+QRcode 生成 识别 二维码
    Pyqt 打包资源文件
    Pyqt 设置 背景颜色和背景图片、 QPalette 调色板 与QPainter 画板区别 、 不规则图片
    Pyqt清空Win回收站
    【转载】pyqt QTableWidget的使用
    Pyqt QComboBox 省市区县联动效果
    pyinstaller打包pyqt文件
    Qt Designer怎样加入资源文件
    【转载】 JQuery.Gantt(甘特图) 开发指南
  • 原文地址:https://www.cnblogs.com/sanyuanempire/p/6155056.html
Copyright © 2011-2022 走看看