• HCIP实验1-4:OSPF Stub区域与NSSA区域


    实验 1-4 OSPF Stub区域与NSSA区域

    学习目的

    1. 掌握OSPF的Stub区域的配置
    2. 掌握OSPF的NSSA区域的配置
    3. 观察LSA Type7的内容
    4. 理解LSA Type7与Type5之间的转化关系

    拓扑图

    在这里插入图片描述

    场景

    你是公司的网络管理员。现在公司的网络中有五台AR G3路由器,其中R2、R3和R4在公司总部。R5在公司分部。R5通过专线与公司总部的R3相连。R1在公司的另外一个分部,通过专线与公司总部的R2相连。
    网段10.0.23.0/24、10.0.2.0/24、10.0.3.0/24属于区域0。
    网段10.0.35.0/24属于区域1,区域1为NSSA区域。R5的Loopback0接口不属于OSPF区域。
    网段10.0.24.0/24属于区域3。R4的Loopback0接口连接到Internet,需要配置一条缺省路由。
    网段10.0.12.0/24、10.0.1.0/24属于区域2,区域2为Stub区域。
    同时为了明确设备的Router-ID,你配置设备使用固定的地址作为Router-ID。

    配置

    给所有路由器配置IP地址和掩码。配置时注意所有的Loopback接口配置掩码均为24位,模拟成一个单独的网段

    system-view 
    Enter system view, return user view with Ctrl+Z.
    [R1]interface Serial 1/0/0
    [R1-Serial1/0/0]ip address 10.0.12.1 24
    [R1-Serial1/0/0]quit
    [R1]interface LoopBack 0
    [R1-LoopBack0]ip address 10.0.1.1 24
    [R1-LoopBack0]quit
    
    system-view 
    Enter system view, return user view with Ctrl+Z.
    [R2]interface Serial 1/0/0
    [R2-Serial1/0/0]ip address 10.0.12.2 24
    [R2-Serial1/0/0]quit
    [R2]interface Serial 2/0/0
    [R2-Serial2/0/0]ip address 10.0.23.2 24
    [R2-Serial2/0/0]quit
    [R2]interface GigabitEthernet 0/0/0
    [R2-GigabitEthernet0/0/0]ip address 10.0.24.2 24
    [R2-GigabitEthernet0/0/0]quit
    [R2]interface LoopBack 0
    [R2-LoopBack0]ip address 10.0.2.2 24
    [R2-LoopBack0]quit
    
    system-view 
    Enter system view, return user view with Ctrl+Z.
    [R3]interface Serial 2/0/0
    [R3-Serial2/0/0]ip address 10.0.23.3 24
    [R3-Serial2/0/0]quit
    [R3]interface Serial 3/0/0
    [R3-Serial3/0/0]ip address 10.0.35.3 24
    [R3-Serial3/0/0]quit
    [R3]interface LoopBack 0
    [R3-LoopBack0]ip address 10.0.3.3 24
    [R3-LoopBack0]quit
    
    system-view 
    Enter system view, return user view with Ctrl+Z.
    [R4]interface GigabitEthernet 0/0/0
    [R4-GigabitEthernet0/0/0]ip address 10.0.24.4 24
    [R4-GigabitEthernet0/0/0]quit
    [R4]interface LoopBack 0
    [R4-LoopBack0]ip address 10.0.4.4 24
    [R4-LoopBack0]quit
    
    system-view 
    Enter system view, return user view with Ctrl+Z.
    [R5]interface Serial 1/0/0
    [R5-Serial1/0/0]ip address 10.0.35.5 24
    [R5-Serial1/0/0]quit
    [R5]interface LoopBack 0
    [R5-LoopBack0]ip address 10.0.5.5 24
    [R5-LoopBack0]quit
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53

    配置多区域的OSPF,所有的路由器使用Loopback 0的IP地址作为Router ID

    [R1]ospf 1 router-id 10.0.1.1
    [R1-ospf-1]area 2
    [R1-ospf-1-area-0.0.0.2]network 10.0.12.1 0.0.0.0
    [R1-ospf-1-area-0.0.0.2]network 10.0.1.1 0.0.0.0
    [R1-ospf-1-area-0.0.0.2]quit
    [R1-ospf-1]quit
    [R1]interface LoopBack 0
    [R1-LoopBack0]ospf network-type broadcast 
    [R1-LoopBack0]quit
    
    [R2]ospf 1 router-id 10.0.2.2
    [R2-ospf-1]area 0
    [R2-ospf-1-area-0.0.0.0]network 10.0.23.2 0.0.0.0
    [R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0
    [R2-ospf-1-area-0.0.0.0]quit
    [R2-ospf-1]area 2
    [R2-ospf-1-area-0.0.0.2]network 10.0.12.2 0.0.0.0
    [R2-ospf-1-area-0.0.0.2]quit
    [R2-ospf-1]area 3
    [R2-ospf-1-area-0.0.0.3]network 10.0.24.2 0.0.0.0
    [R2-ospf-1-area-0.0.0.3]qui
    [R2-ospf-1]quit
    [R2]interface  LoopBack 0
    [R2-LoopBack0]ospf network-type broadcast 
    [R2-LoopBack0]quit
    
    [R3]ospf 1 router-id 10.0.3.3
    [R3-ospf-1]area 0
    [R3-ospf-1-area-0.0.0.0]network 10.0.23.3 0.0.0.0
    [R3-ospf-1-area-0.0.0.0]network 10.0.3.3 0.0.0.0  
    [R3-ospf-1-area-0.0.0.0]quit
    [R3-ospf-1]area 1
    [R3-ospf-1-area-0.0.0.1]network 10.0.35.3 0.0.0.0
    [R3-ospf-1-area-0.0.0.1]quit
    [R3-ospf-1]quit
    [R3]interface LoopBack 0
    [R3-LoopBack0]ospf network-type broadcast 
    [R3-LoopBack0]quit
    
    [R4]ospf 1 router-id 10.0.4.4 
    [R4-ospf-1]area 3
    [R4-ospf-1-area-0.0.0.3]network 10.0.24.4  0.0.0.0
    [R4-ospf-1-area-0.0.0.3]quit
    [R4-ospf-1]quit
    
    [R5]ospf 1 router-id 10.0.5.5
    [R5-ospf-1]area 1
    [R5-ospf-1-area-0.0.0.1]network 10.0.35.5 0.0.0.0
    [R5-ospf-1-area-0.0.0.1]quit
    [R5-ospf-1]quit
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50

    将R5的Loopback0接口网段10.0.5.0/24引入到OSPF区域。使用默认配置进行路由引入

    [R5]ospf 1
    [R5-ospf-1]import-route direct
    
    • 1
    • 2

    在R4上配置缺省路由,下一跳为Loopback0接口。并将该缺省路由引入到OSPF区域,定义为类型1,代价值为20,不使用永久发布。

    [R4]ip route-static 0.0.0.0 0.0.0.0 LoopBack 0
    [R4]ospf 1
    [R4-ospf-1]default-route-advertise type 1 cost 20
    [R4-ospf-1]quit
    
    • 1
    • 2
    • 3
    • 4

    接着配置区域2为Stub区域

    [R1]ospf 1
    [R1-ospf-1]area 2
    [R1-ospf-1-area-0.0.0.2]stub 
    [R1-ospf-1-area-0.0.0.2]quit
    [R1-ospf-1]quit
    
    [R2]ospf 1
    [R2-ospf-1]area 2
    [R2-ospf-1-area-0.0.0.2]stub 
    [R2-ospf-1-area-0.0.0.2]quit
    [R2-ospf-1]quit
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    接着在R2上将区域2配置为no-summary的完全Stub区域

    [R2]ospf 1
    [R2-ospf-1]area 2
    [R2-ospf-1-area-0.0.0.2]stub no-summary
    [R2-ospf-1-area-0.0.0.2]quit
    [R2-ospf-1]quit
    
    • 1
    • 2
    • 3
    • 4
    • 5

    配置区域1为NSSA区域

    [R3]ospf 1
    [R3-ospf-1]area 1
    [R3-ospf-1-area-0.0.0.1]nssa
    [R3-ospf-1-area-0.0.0.1]quit
    [R3-ospf-1]quit
    
    [R5]ospf 1
    [R5-ospf-1]area 1
    [R5-ospf-1-area-0.0.0.1]nssa
    [R5-ospf-1-area-0.0.0.1]quit
    [R5-ospf-1]quit
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
  • 相关阅读:
    【Python 零基础入门】列表 & 字典
    c# 把 json 字符串解析成 json 对象(小例子)
    linux为所有用户安装conda
    SpringBoot整合原理解析
    python-(4-3)数据类型的应用(元组、集合)
    HTML中<a>标签和target=“_blank“属性的使用方法及作用(清晰易懂,带例子)
    Java集合Map接口详解——含源码分析
    SpringBoot项目整合Vue做一个完整的用户注册功能
    Git版本控制管理——补丁
    TFT-LCD屏幕显示图片
  • 原文地址:https://blog.csdn.net/weixin_41656968/article/details/127703753