• HCIP之重发布


    目录

    重发布

    作用

    条件

    规则

    重发布配置

    R1基本配置

    R2(ASBR)基本配置

    R3基本配置

    R4基本配置

     R1配置rip协议

    R2(ASBR)配置RIP协议以及ospf

    R3配置ospf协议

    R4配置ospf协议

     RIP协议

            A - >B:将一种动态协议发布到另一种动态的路由协议

            静态 - >B:将静态路由导入到动态路由协议中直连

            直连 - >B:将直连路由导入到动态路由协议中

    ospf与rip类似

    双点重发布引发的路由回馈

    解决方法:路由策略

    定义

    执行步骤

    路由策略的匹配规则

    ROYTE-POLICY的配置指南


    重发布

    作用

            在一个网络中,若运行多种路由协议或者相同路由协议的不同进程;协议之间不能直接沟通计算把偶偶进程之间也是独立转发和运算;所以需要重发布实现陆游的共享

    条件

            1.必须存在ASBR设备 --- 同时连接两种协议或者两个进程;可以同时学到两边的路由信息,之后完成路由共享。

            2.必须关注种子度量值 --- A协议和B协议之间的度量计算逻辑不通,无法直接使用。故在将A协议发布到B协议时,ASBR将不懈怠A协议的度量值到B协议,而是在共享到B协议时,有ASBR设备在路由这能怪添加一个起始度量值。

    规则

            1.将A协议导入到B协议时,需要在ASBR的B协议上配置重发布

            2.将A协议发布到B协议时,是将ASBR上所有通过A协议学习到的及ASBR上宣告在A协议的所有直连路由全部共享到B协议中

            单点 --- 两个协议或者两个进程之间存在1个ASBR设备

            双点 --- 两个协议或者两个进程之间存在2个ASBR设备

            多点 --- 两个协议或者两个进程之间存在多个ASBR设备

            单向 --- 仅将A协议发布到B协议当中

            双向 --- A/B协议的路由均共享

    重发布配置

    R1基本配置

    1. Interface IP Address/Mask Physical Protocol
    2. GigabitEthernet0/0/0 12.0.0.1/24 up up
    3. GigabitEthernet0/0/1 unassigned down down
    4. GigabitEthernet0/0/2 unassigned down down
    5. LoopBack0 1.1.1.1/24 up up(s)
    6. NULL0 unassigned up up(s)

    R2(ASBR)基本配置

    1. Interface IP Address/Mask Physical Protocol
    2. GigabitEthernet0/0/0 12.0.0.2/24 up up
    3. GigabitEthernet0/0/1 23.0.0.2/24 up up
    4. GigabitEthernet0/0/2 24.0.0.2/24 up up
    5. LoopBack0 2.2.2.2/24 up up(s)
    6. NULL0 unassigned up up(s)

    R3基本配置

    1. Interface IP Address/Mask Physical Protocol
    2. GigabitEthernet0/0/0 23.0.0.1/24 up up
    3. GigabitEthernet0/0/1 unassigned down down
    4. GigabitEthernet0/0/2 unassigned down down
    5. LoopBack0 3.3.3.3/24 up up(s)
    6. NULL0 unassigned up up(s)

    R4基本配置

    1. Interface IP Address/Mask Physical Protocol
    2. GigabitEthernet0/0/0 24.0.0.1/24 up up
    3. GigabitEthernet0/0/1 unassigned down down
    4. GigabitEthernet0/0/2 unassigned down down
    5. LoopBack0 4.4.4.4/24 up up(s)
    6. NULL0 unassigned up up(s)

     R1配置rip协议

    1. 1.启动rip协议
    2. [R1]rip 1
    3. [R1-rip-1]ve
    4. [R1-rip-1]verify-source
    5. 2.选择版本号
    6. [R1-rip-1]version 2
    7. 3.宣告网段
    8. [R1-rip-1]net
    9. [R1-rip-1]network 12.0.0.0
    10. [R1-rip-1]q

    R2(ASBR)配置RIP协议以及ospf

    1. 1.配置rip
    2. [R2]rip
    3. [R2-rip-1]ve
    4. [R2-rip-1]version 2
    5. [R2-rip-1]ne
    6. [R2-rip-1]network 12.0.0.0
    7. [R2-rip-1]ne
    8. [R2-rip-1]network 2.0.0.0
    9. 2.配置ospf1
    10. [R2]ospf 1
    11. [R2-ospf-1]area 0
    12. [R2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
    13. 3.配置ospf2
    14. [R2]ospf 2 r
    15. [R2]ospf 2 router-id 2.2.2.2
    16. [R2-ospf-2]ar
    17. [R2-ospf-2]area 0
    18. [R2-ospf-2-area-0.0.0.0]ne
    19. [R2-ospf-2-area-0.0.0.0]network 24.0.0.0 0.0.0.255

    R3配置ospf协议

    1. [R3]ospf 1 r
    2. [R3]ospf 1 router-id 3.3.3.3
    3. [R3-ospf-1]are
    4. [R3-ospf-1]area 0
    5. [R3-ospf-1-area-0.0.0.0]ne
    6. [R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
    7. [R3-ospf-1-area-0.0.0.0]ne
    8. [R3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255

    R4配置ospf协议

    1. [R4]ospf 2 router-id 4.4.4.4
    2. [R4-ospf-2]area 0
    3. [R4-ospf-2-area-0.0.0.0]network 4.4.4.4 0.0.0.0
    4. [R4-ospf-2-area-0.0.0.0]ne
    5. [R4-ospf-2-area-0.0.0.0]network 24.0.0.0 0.0.0.255

     A -> B : 一种动态路由协议发布到另一种动态路由协议

    静态 - >B:将静态路由导入到动态路由协议中

    直连 - >B:将直连路由导入到动态路由协议中

     RIP协议

            A - >B:将一种动态协议发布到另一种动态的路由协议

                    [R2-rip-1]import-route ospf 1

            测试:

    1. 1.插入前
    2. [R1]display ip routing-table protocol rip
    3. Route Flags: R - relay, D - download to fib
    4. ------------------------------------------------------------------------------
    5. Public routing table : RIP
    6. Destinations : 1 Routes : 1
    7. RIP routing table status : <Active>
    8. Destinations : 1 Routes : 1
    9. Destination/Mask Proto Pre Cost Flags NextHop Interface
    10. 2.2.2.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    11. 0/0/0
    12. RIP routing table status : <Inactive>
    13. Destinations : 0 Routes : 0
    14. 2.插入后
    15. [R1]display ip routing-table protocol rip
    16. Route Flags: R - relay, D - download to fib
    17. ------------------------------------------------------------------------------
    18. Public routing table : RIP
    19. Destinations : 3 Routes : 3
    20. RIP routing table status : <Active>
    21. Destinations : 3 Routes : 3
    22. Destination/Mask Proto Pre Cost Flags NextHop Interface
    23. 2.2.2.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    24. 0/0/0
    25. 3.3.3.3/32 RIP 100 1 D 12.0.0.2 GigabitEthernet
    26. 0/0/0
    27. 23.0.0.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    28. 0/0/0
    29. RIP routing table status : <Inactive>
    30. Destinations : 0 Routes : 0

            结论:

                    通过重发布技术将其它协议的路由信息导入到RIP中,其赋予的默认种子度量值为0.

            修改种子度量值的方法:

                    1.在进程中对全局进行修改 --- [R2-rip-1]default-cost 2

                    2.针对本次重发布进行修改 --- [R2-rip-1]import-route ospf 1 cost 3

            测试:

    1. 1.在进程中对全局进行修改 --- [R2-rip-1]default-cost 2
    2. [R1]display ip routing-table protocol rip
    3. Route Flags: R - relay, D - download to fib
    4. ------------------------------------------------------------------------------
    5. Public routing table : RIP
    6. Destinations : 3 Routes : 3
    7. RIP routing table status : <Active>
    8. Destinations : 3 Routes : 3
    9. Destination/Mask Proto Pre Cost Flags NextHop Interface
    10. 2.2.2.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    11. 0/0/0
    12. 3.3.3.3/32 RIP 100 3 D 12.0.0.2 GigabitEthernet
    13. 0/0/0
    14. 23.0.0.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    15. 0/0/0
    16. RIP routing table status : <Inactive>
    17. Destinations : 0 Routes : 0
    18. 2.针对本次重发布进行修改 --- [R2-rip-1]import-route ospf 1 cost 3
    19. [R1]display ip routing-table protocol rip
    20. Route Flags: R - relay, D - download to fib
    21. ------------------------------------------------------------------------------
    22. Public routing table : RIP
    23. Destinations : 3 Routes : 3
    24. RIP routing table status : <Active>
    25. Destinations : 3 Routes : 3
    26. Destination/Mask Proto Pre Cost Flags NextHop Interface
    27. 2.2.2.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    28. 0/0/0
    29. 3.3.3.3/32 RIP 100 4 D 12.0.0.2 GigabitEthernet
    30. 0/0/0
    31. 23.0.0.0/24 RIP 100 4 D 12.0.0.2 GigabitEthernet
    32. 0/0/0
    33. RIP routing table status : <Inactive>
    34. Destinations : 0 Routes : 0
    35. [R1]

    注意:

            当以上两条命令同时执行时,将按照第2条,匹配更精确的命令来执行

            静态 - >B:将静态路由导入到动态路由协议中直连

                    [R2-rip-1]import-route static

             测试:

    1. 1.向R2中导入静态路由
    2. [R2]ip route-static 0.0.0.0 0 LoopBack 0
    3. [R2]ip route-static 192.168.1.0 24 LoopBack 0
    4. [R2]ip route-static 192.168.68.0 24 LoopBack 0
    5. 2.将静态导入动态路由rip中
    6. [R2-rip-1]import-route static
    7. 3.查看R1中rip接受到的路由
    8. [R1]display ip routing-table protocol rip
    9. Route Flags: R - relay, D - download to fib
    10. ------------------------------------------------------------------------------
    11. Public routing table : RIP
    12. Destinations : 5 Routes : 5
    13. RIP routing table status : <Active>
    14. Destinations : 5 Routes : 5
    15. Destination/Mask Proto Pre Cost Flags NextHop Interface
    16. 2.2.2.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    17. 0/0/0
    18. 3.3.3.3/32 RIP 100 4 D 12.0.0.2 GigabitEthernet
    19. 0/0/0
    20. 23.0.0.0/24 RIP 100 4 D 12.0.0.2 GigabitEthernet
    21. 0/0/0
    22. 192.168.1.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    23. 0/0/0
    24. 192.168.68.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    25. 0/0/0
    26. RIP routing table status : <Inactive>
    27. Destinations : 0 Routes : 0

     结论:

            重发发布过程中不会讲缺省路由重发布到动态路由协议中

            直连 - >B:将直连路由导入到动态路由协议中

                    [R2-rip-1]import-route direct

             测试:

    1. [R1]display ip routing-table protocol rip
    2. Route Flags: R - relay, D - download to fib
    3. ------------------------------------------------------------------------------
    4. Public routing table : RIP
    5. Destinations : 6 Routes : 6
    6. RIP routing table status : <Active>
    7. Destinations : 6 Routes : 6
    8. Destination/Mask Proto Pre Cost Flags NextHop Interface
    9. 2.2.2.0/24 RIP 100 1 D 12.0.0.2 GigabitEthernet
    10. 0/0/0
    11. 3.3.3.3/32 RIP 100 4 D 12.0.0.2 GigabitEthernet
    12. 0/0/0
    13. 23.0.0.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    14. 0/0/0
    15. 24.0.0.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    16. 0/0/0
    17. 192.168.1.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    18. 0/0/0
    19. 192.168.68.0/24 RIP 100 3 D 12.0.0.2 GigabitEthernet
    20. 0/0/0
    21. RIP routing table status : <Inactive>
    22. Destinations : 0 Routes : 0

    结论:

            1.除了R1的直连网段之外,所有直连都会导入

            2.若ASBR(R2)进行了A - >B的重发布以及 直连 - > B的重发布,并且两次包含相同的路由信息,则会有限学习 直连 - >B 的涌发布信息

    ospf与rip类似

            种子度量值修改

                    [R2-ospf-1]default type ?
                      INTEGER<1-2>  Type value

            开销值修改 

                    [R2-ospf-1]default cost ?
                      INTEGER<0-16777214>  Cost value

    双点重发布引发的路由回馈

            默认RIP和OSPF协议若进行双点重发布,优于两者的优先级不同,故第一台ASBR设备重发布动作结束后,将影响其他ASBR设备的路由表。使得路由可能被回传到源协议当中,发生路由回馈 --- A协议的路由冲发布到B协议中后,又被重新发布回到A协议。路由回馈会导致选路不佳甚至出现路由环路。

            华为设备为了消除路由回馈现象,他讲OSPF内部产生的路由的优先级定义为10,而将域外导入的路由默认优先级定义为150.(150的优先级大于所有华为体系下IGP协议的默认优先级)。通过这种方式消除路由回馈

    解决方法:路由策略

            由于冲发布技术的种子度量值问题,将必然导致选路不佳;只能以来路由策略来认为干涉选路

    定义

            路由策略 --- 在控制层流量流动过程中,截取流量,之后修改流量再转发或者不转发;最终试下影响路由器路由表生成,干涉选录的效果

            控制层流量 --- 路由协议传递路由信息产生的流量

            数据层流量 --- 设备访问目标网段时,产生的数据流量

     

    执行步骤

    1.抓取流量

            1.ACL列表 --- 因为ACL列表本身设计就是为了抓取数据层流量的,所以,因为通配符的存在它可以灵活的匹配数字特征,但是,没有办法匹配路由信息中的掩码特征。所以并不擅长控制层流量的抓取

            2.IP - prefix --- 前值列表

    1. [R1]ip ip-prefix aa(自定义前缀列表的名称) permit(允许和拒绝,仅抓取流量则可以选择permit) 192.168.1.0 24 --- 抓取的控制层流量中目标网络的信息
    2. [R1]display ip ip-prefix aa --- 查看前缀列表信息

                    前缀列表的匹配规则 --- 自上而下,主义匹配,一旦匹配上则将按照对应的规则来执行动作,不再向下匹配。末尾隐含拒绝所有的规则

                    注意:前缀列表中的规则默认为以10位步调自动添加序号,便于插入和删除规则

    1. [R1]ip ip-prefix aa index 15 permit 192.168.3.0 24
    2. --- 根据序号插入规则
    3. [R1]undo ip ip-prefix aa index 15
    4. --- 删除插入规则
    5. [R1]ip ip-prefix aa permit 192.168.3.0 24 less-equal 28
    6. --- 抓取掩码长度24-28之间的路由信息
    7. [R1]ip ip-prefix aa permit 192.168.3.0 24 greater-equal 28
    8. --- 当前后矛盾时,将以后面的为主,前面的24变为前24为固定不变,匹配为掩码长度大于等于28的路由信息
    9. [R1]ip ip-prefix aa permit 192.168.3.0 24 greater-equal 28 less-equal 30
    10. --- 前24位固定,匹配掩码长度为28-30的网段信息
    11. [R1]ip ip-prefix aa permit 192.168.3.0 24 greater-equal 28 less-equal 28
    12. --- 前24位固定,匹配掩码长度为28的网段信息
    13. [R1]ip ip-prefix aa permit 0.0.0.0 0 greater-equal 32
    14. --- 匹配所有主机路由
    15. [R1]ip ip-prefix aa permit 0.0.0.0 0
    16. --- 匹配缺省

    2.路由策略

            1.RIP的merticin和merticout --- 偏移列表 --- 只针对距离矢量型协议设计应用

                    1.抓取流量

    [R1]ip ip-prefix aa permit 34.0.0.0 24

                    2.在接口上调用

    [R1-GigabitEthernet0/0/0]rip metricin ip-prefix aa 10

            2.filter-policy --- 过滤策略

                    1.抓取流量

    1. [R1]ip ip-prefix bb deny 34.0.0.0 24
    2. [R1]ip ip-prefix bb permit 0.0.0.0 0 less-equal 32

                    2.在进程中调用

    [R1-rip-1]filter-policy ip-prefix bb import GigabitEthernet 0/0/0

    注意:

            过滤策略本身是可以在ospf中使用的,但是,在ospf区域内使用时,因为区域内部传递的是拓扑信息,所以,无法在出方向调用,只能在入方向调用,影响自己,也不是说将LSA信息过滤掉,只是在路由信息表加表时过滤,不让其加表。在区域之间传递路由信息时可以出方向调用

    3.roture - policy --- 路由策略

            1.抓取流量

    1. [R2-acl-basic-2000]rule permit source 1.1.1.0 0
    2. [R2-acl-basic-2001]rule permit source 2.2.2.0 0
    3. [R2]ip ip-prefix aa permit 3.3.3.0 24
    4. [R2]ip ip-prefix aa permit 4.4.4.0 24

            2.配置路由策略

    1. [R2]route-policy aa deny node 10
    2. Info: New Sequence of this List.
    3. [R2-route-policy]if-match acl 2000
    4. [R2]route-policy aa deny node 20
    5. Info: New Sequence of this List.
    6. [R2-route-policy]if-match acl 2001
    7. [R2-route-policy]apply cost 10
    8. [R2]route-policy aa deny node 30
    9. Info: New Sequence of this List.
    10. [R2-route-policy]if-match ip-prefix aa
    11. [R2-route-policy]apply cost-type type-1
    12. [R2]route-policy aa deny node 40
    13. Info: New Sequence of this List.
    14. [R2-route-policy]if-match ip-prefix bb
    15. [R2-route-policy]apply cost-type type-1
    16. [R2-route-policy]apply tag 666

    注意:

            一条规则当中,如果存在多个apply或if-match,则这些需要同时满足,满足 “与” 关系

            [R2]route-policy aa deny node 50 --- 允许所有

                    1.没有if-match --- 匹配所有

                    2.没有appl --- 只需要按照大动作来执行

    3.再重发不工程中调用路由策略

            [R2-ospf-1]import-route rip route-policy aa

    路由策略的匹配规则

            自上而下,主义匹配,一旦匹配上则将按照对应的规则来执行动作,不再向下匹配。末尾隐含拒绝所有的规则

    ROYTE-POLICY的配置指南

    1. 即便一个流量需要拒绝,在抓取流量的时候,也必须使用允许,之后在路由策略中进行拒绝
    2. 在一条规则中,若没有流量匹配,则代表匹配所有;做没有APPLY(小动作),则只按照大动作来执行。因此,大动作为允许的空表代表允许所有。
  • 相关阅读:
    Implement a customized pin code input control
    天天写业务代码,我给撸了一个业务处理框架
    股神(dp或贪心)
    Anaconda常用命令
    uniapp 小程序实现图片宽度100%、高度自适应的效果
    Leetcode 剑指 Offer II 003. 前 n 个数字二进制中 1 的个数
    学习 [Spring MVC] 的JSR 303和拦截器,提高开发效率
    Python练手算法
    (四)笔记.net core学习之应用配置、多环境配置、日志与路由
    mysql 使用idb文件恢复数据
  • 原文地址:https://blog.csdn.net/qq_57289939/article/details/127192445