OSPF 知识汇总

OSPF

  • 全称:open shortest path first 开放最短路径优先路由协议

  • 单区域基本配置

    • 思科OSPF单区域的配置
      • 拓扑图:
      • 1、配置节点IP地址
        • R0:
          • enable
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.168.10.1 255.255.255.0
          • interface f0/1
          • no shutdown
          • ip address 192.168.20.1 255.255.255.0
          • (其他节点相同)
      • 2、配置路由协议OSPF
        • R0:
          • Router(config)#router ospf 1
          • Router(config-router)#network 192.168.10.0 0.0.0.255 area 0
          • Router(config-router)#network 192.168.20.0 0.0.0.255 area 0
          • (其他同理)
      • 3、给PC配置IP
    • 华为OSPF单区域的配置
      • 拓扑图
      • 单区域配置
        • OSPF router-id,每个路由器都有一个router-id,router-id其实就是一个IP地址,并且所有router-id不能重复。其实就是一个身份证
        • R4:
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.10.1 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.20.1 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]ospf 1 router-id 11.1.1.1
          • [Huawei-ospf-1]area 0
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
        • R5:
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.20.2 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.30.1 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]ospf 1 router-id 11.1.1.2
          • [Huawei-ospf-1]area 0
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
        • R6:
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.40.1 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.30.2 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]ospf 1 router-id 11.1.1.3
          • [Huawei-ospf-1]area 0
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
  • 多区域配置

    • OSPF多区域
      • 区域分类:
        • Area 0:骨干区域
        • Area 非0:非骨干区域
      • 区域架构:所有的非骨干区域必须与骨干区域相邻
      • 骨干区域的角色:就相当于交通枢纽。负责不同非骨干区域之间的流量转发。
      • 注意:区域与区域之间是由路由器做分隔的
    • 思科OSPF多区域的配置
      • 拓扑图:
      • 区域10配置(绿色)
        • 1、配置节点IP
          • 与单区域相同
        • 2、配置路由协议OSPF
          • R5:
            • Router#conf t
            • Router(config)#router ospf 1
            • Router(config-router)#network192.168.60.0 0.0.0.255 area 10
            • Router(config-router)#network192.168.70.0 0.0.0.255 area 10
          • R6:(与R5同理)
          • R1:
            • Router(config)#router ospf 1
            • Router(config-router)#network192.168.50.0 0.0.0.255 area 10
    • 华为OSPF多区域的配置
      • 拓扑图
      • 单区域配置
        • OSPF router-id,每个路由器都有一个router-id,router-id其实就是一个IP地址,并且所有router-id不能重复。其实就是一个身份证
        • R4:
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.10.1 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.20.1 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]ospf 1 router-id 11.1.1.1
          • [Huawei-ospf-1]area 0
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
        • R5:
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.20.2 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.30.1 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]ospf 1 router-id 11.1.1.2
          • [Huawei-ospf-1]area 0
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
        • R6:
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.40.1 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.30.2 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]ospf 1 router-id 11.1.1.3
          • [Huawei-ospf-1]area 0
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
      • 多区域配置
        • R5:
          • [Huawei]interface GigabitEthernet0/0/0
          • [Huawei-GigabitEthernet0/0/0]ip add 192168.50.1 255.255.255.0
          • [Huawei]ospf 1 router-id 11.1.1.4
          • [Huawei-ospf-1]area 10
          • [Huawei-ospf-1-area-0.0.0.10]network 192.168.50.0 0.0.0.255
        • R7:
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.50.2 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.60.1 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]ospf 1 router-id 11.1.1.5
          • [Huawei-ospf-1]area 10
          • [Huawei-ospf-1-area-0.0.0.10]network 192.168.50.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.10]network 192.168.60.0 0.0.0.255
        • R8:
          • [Huawei]int e0/0/1
          • [Huawei-Ethernet0/0/1]ip add 192.168.60.2 24
          • [Huawei-Ethernet0/0/1]quit
          • [Huawei]int e0/0/0
          • [Huawei-Ethernet0/0/0]ip add 192.168.70.1 24
          • [Huawei-Ethernet0/0/0]quit
          • [Huawei]ospf 1 router-id 11.1.1.6
          • [Huawei-ospf-1]area 10
          • [Huawei-ospf-1-area-0.0.0.10]network 192.168.60.0 0.0.0.255
          • [Huawei-ospf-1-area-0.0.0.10]network 192.168.70.0 0.0.0.255
  • 虚链路技术

    • OSPF架构:所有非骨干区域必须骨干区域相邻,如果不相邻必须有虚链路技术
    • 配置的位置:区域边界路由器
    • 注意:每个OSPF路由器都有一个router-id(标识符)
      • 相当于人的身份证
      • 默认路由器会自动选择本路由器接口的一个IP地址作为router-id.并且每台路由器的router-id必须是唯一
    • 思科OSPF虚链路的配置:
      • 拓扑图:
      • 配置思路:
        • 1、规划网断
        • 2、配置每个节点IP地址
          • R0:
            • enable
            • conf t
            • interface f0/0
            • no shutdown
            • ip address 192.168.10.1 255.255.255.0
            • exit
          • R1:
            • enable
            • conf t
            • interface f0/0
            • no shutdown
            • ip address 192.168.10.2 255.255.255.0
            • exit
            • interface f0/1
            • no shutdown
            • ip address 192.168.20.1 255.255.255.0
            • exit
          • R2:
            • enable
            • conf t
            • interface f0/0
            • no shutdown
            • ip address 192.168.20.2 255.255.255.0
            • exit
            • interface f0/1
            • no shutdown
            • ip address 192.168.30.1 255.255.255.0
            • exit
          • R3:
            • enable
            • conf t
            • interface f0/0
            • no shutdown
            • ip address 192.168.30.2 255.255.255.0
            • exit
            • interface f0/1
            • no shutdown
            • ip address 192.168.40.1 255.255.255.0
            • exit
          • R4:
            • enable
            • conf t
            • interface f0/0
            • no shutdown
            • ip address 192.168.40.2 255.255.255.0
            • exit
            • interface f0/1
            • no shutdown
            • ip address 192.168.50.1 255.255.255.0
            • exit
        • 3、配置OSPF多区域
          • R0:
            • Router(config)#router ospf 1
            • Router(config-router)#network 192.168.10.0 0.0.0.255 area 0
          • R1:
            • Router(config)#router ospf 1
            • Router(config-router)#network 192.168.10.0 0.0.0.255 area 0
            • Router(config-router)#network 192.168.20.0 0.0.0.255 area 1
          • R2:
            • Router(config)#router ospf 1
            • Router(config-router)#network 192.168.20.0 0.0.0.255 area 1
            • Router(config-router)#network 192.168.30.0 0.0.0.255 area 1
          • R3:
            • Router(config)#router ospf 1
            • Router(config-router)#network 192.168.30.0 0.0.0.255 area 1
            • Router(config-router)#network 192.168.40.0 0.0.0.255 area 2
          • R4:
            • Router(config)#router ospf 1
            • Router(config-router)#network 192.168.40.0 0.0.0.255 area 2
            • Router(config-router)#network 192.168.50.0 0.0.0.255 area 2
        • 4、配置虚链路
          • 方法①
            • 修改身份证router-id(标识符)
              • Router(config)#router ospf 1
              • Router(config-router)#router-id 1.1.1.1(这个地址可以不存在,但是必须唯一)
              • Router#clear ip ospf process #重启ospf进程让身份证生效。
              • Reset ALL OSPF processes? [no]: yes
            • R1:
              • 注意:查看身份证一定保证身份证的router-id(ip),这个Ip一定要是两个区域之间的区域的接口IP地址
              • Router ospf 1
              • Router-id 192.168.20.1
              • End
              • Clear ip ospf processs 
              • yes
              • Router(config)#router ospf 1
              • Router(config-router)#area 1 virtual-link 192.168.30.2
              • 注意:area 区域号(两个区域之间的区域号)virtual-link 身份证(对方的router-id)
              •  
            • R3:
              • Router ospf 1
              • Router-id 192.168.30.2
              • End
              • Clear ip ospf processs 
              • yes
              • Router(config)#router ospf 1
              • Router(config-router)#area 1 virtual-link 192.168.20.1
              • 注意:area 区域号(两个区域之间的区域号)virtual-link 身份证(对方的router-id)
          • 方法②
            • 在两台区域边界路由器上进行做虚链路技术。
            • R4---------R6
              • 1:创建一个回环口
                • Router(config)#interfaceloopback 1
                • Router(config-if)#IP address 4.4.4.4 255.255.255.0
              • 2:将回环口NETWORK在两台边界路由器之间的区域
                • Router(config)#routerospf 1
                • Router(config-router)#network 4.4.4.0 0.0.0.255 area 1
              • 3:将回环口配置成ROUTER-ID
                • Router(config)#routerospf 1
                • Router(config-router)#router-id4.4.4.4
                • Router(config-router)#end
                • Router#clearip ospf process
                • Reset ALL OSPF processes? [no]: yes
              • 4:创建虚链路
                • Router(config)#routerospf 1
                • Router(config-router)#area 1(两个边界路由器之间的区域)virtual-link 6.6.6.6(对方的ID)
            • R6:
              • 1:创建一个回环口
                • Router(config)#interface loopback 1
                • Router(config-if)#ip address 6.6.6.6255.255.255.0
                • Router(config-if)#exit
              • 2:将回环口NETWORK在两台边界路由器之间的区域
                • Router(config)#router ospf 1
                • Router(config-router)#network 6.6.6.00.0.0.255 area 1
                • Router(config-router)#exit
              • 3:将回环口配置成ROUTER-ID
                • Router(config)#router ospf 1
                • Router(config-router)#router-id 6.6.6.6
                • Router(config-router)#end
                • Router#clear ip ospf process
                • Reset ALL OSPF processes? [no]: yes
              • 4:创建虚链路
                • Router(config)#ROUTEROSPF 1
                • Router(config-router)#AREA 1 virtual-link 4.4.4.4
    • 华为OSPF虚链路的配置:
      • 拓扑图:
      • 配置思路:
        • 1、规划网断
        • 2、配置节点IP地址
          • R1:
            • <Huawei>system-view 
            • [Huawei]int g0/0/1
            • [Huawei-GigabitEthernet0/0/1]ip add 10.1.12.1 24
            • [Huawei-GigabitEthernet0/0/1]q 
            • [Huawei]int LoopBack 0
            • [Huawei-LoopBack0]ip add 1.1.1.1 32
            • [Huawei-LoopBack0]q
          • R2:
            • <Huawei>system-view 
            • [Huawei]int g0/0/0
            • [Huawei-GigabitEthernet0/0/0]ip add 10.1.12.2 24
            • [Huawei-GigabitEthernet0/0/0]int g0/0/1
            • [Huawei-GigabitEthernet0/0/1]ip add 10.1.23.1 24
            • [Huawei-GigabitEthernet0/0/1]q
            • [Huawei]int LoopBack 0
            • [Huawei-LoopBack0]ip add 2.2.2.2 32
            • [Huawei-LoopBack0]q 
          • R3:
            • <Huawei>system-view 
            • [Huawei]int g0/0/0
            • [Huawei-GigabitEthernet0/0/0]ip add 10.1.23.2 24
            • [Huawei-GigabitEthernet0/0/0]int g0/0/1
            • [Huawei-GigabitEthernet0/0/1]ip add 10.1.34.1 24
            • [Huawei-GigabitEthernet0/0/1]q
            • [Huawei]int LoopBack 0
            • [Huawei-LoopBack0]ip add 3.3.3.3 32
          • R4:
            • <Huawei>system-view 
            • [Huawei]int g0/0/1
            • [Huawei-GigabitEthernet0/0/1]ip add 10.1.34.2 24
            • [Huawei-GigabitEthernet0/0/1]q 
            • [Huawei]int LoopBack 0
            • [Huawei-LoopBack0]ip add 4.4.4.4 32
        • 3、配置OSPF多区域
          • R1:
            • [Huawei]ospf 1 router-id 1.1.1.1
            • [Huawei-ospf-1]area 0
            • [Huawei-ospf-1-area-0.0.0.0]network 10.1.12.0 0.0.0.255
            • [Huawei-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.0
          • R2:
            • [Huawei]ospf 1 router-id 2.2.2.2 
            • [Huawei-ospf-1]area 0
            • [Huawei-ospf-1-area-0.0.0.0]network 10.1.12.0 0.0.0.255
            • [Huawei-ospf-1-area-0.0.0.0]q
            • [Huawei-ospf-1]area 1 
            • [Huawei-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255
            • [Huawei-ospf-1-area-0.0.0.1]network 2.2.2.0 0.0.0.0
          • R3:
            • [Huawei]ospf 1 router-id 3.3.3.3
            • [Huawei-ospf-1]area 1
            • [Huawei-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255
            • [Huawei-ospf-1-area-0.0.0.1]network 3.3.3.0 0.0.0.0
            • [Huawei-ospf-1-area-0.0.0.1]q
            • [Huawei-ospf-1]area 2
            • [Huawei-ospf-1-area-0.0.0.2]network 10.1.34.0 0.0.0.255
            • [Huawei-ospf-1-area-0.0.0.2]q
          • R4:
            • [Huawei]ospf 1 router-id 4.4.4.4
            • [Huawei-ospf-1]area 2
            • [Huawei-ospf-1-area-0.0.0.2]network 10.1.34.2 0.0.0.255
            • [Huawei-ospf-1-area-0.0.0.2]network 4.4.4.0 0.0.0.0
        • 4、配置虚链路
          • R2:
            • [Huawei-ospf-1]area 1
            • [Huawei-ospf-1-area-0.0.0.1]vlink-peer3.3.3.3
          • R3:
            • [Huawei-ospf-1]area 1 
            • [Huawei-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2
          • 如需引入外部路由在边缘路由执行:
            • [Huawei-ospf-1]default-route-advertisealways (路由的注入)
  • OSPF项目(单区域、多区域、虚链路集合)

    • 拓扑图:
    • 配置:
      • 1、规划网段
      • 2、配置节点IP地址
        • R0:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.168.10.1 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.10.1 255.255.255.0
          • end
          • wr
        • R1:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.168.10.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.168.20.1 255.255.255.0
          • exit
          • interface e1/0
          • no shutdown
          • ip address 192.178.40.1 255.255.255.0
          • end
          • wr
        • R2:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.168.20.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.168.30.1 255.255.255.0
          • exit
          • int e1/0
          • ip address 192.178.70.1 255.255.255.0
          • end
          • wr
        • R3:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.168.30.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.188.10.1 255.255.255.0
          • end
          • wr
        • R4:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.178.10.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.20.1 255.255.255.0
          • end
          • wr
        • R5:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.178.20.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.30.1 255.255.255.0
          • exit
        • R6:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.178.40.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.50.1 255.255.255.0
          • exit
        • R7:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.178.50.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.60.1 255.255.255.0
          • exit
        • R8:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.178.70.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.80.1 255.255.255.0
          • exit
        • R9:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.178.80.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.178.90.1 255.255.255.0
          • exit
        • R10:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.188.10.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.188.20.1 255.255.255.0
          • exit
        • R11:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.188.20.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.188.30.1 255.255.255.0
          • exit
        • R12:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.188.30.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.188.40.1 255.255.255.0
          • exit
        • R13:
          • en
          • conf t
          • interface f0/0
          • no shutdown
          • ip address 192.188.40.2 255.255.255.0
          • exit
          • interface f0/1
          • no shutdown
          • ip address 192.188.50.1 255.255.255.0
          • exit
      • 3、配置OSPF协议
        • R0:
          • conf t
          • router ospf 1
          • network 192.168.10.0 0.0.0.255 area 0
          • network 192.178.10.0 0.0.0.255 area 10
          • end
          • wr
        • R1:
          • conf t
          • router ospf 1
          • network 192.168.10.0 0.0.0.255 area 0
          • network 192.168.20.0 0.0.0.255 area 0
          • network 192.178.40.0 0.0.0.255 area 20
          • end
          • wr
        • R2:
          • conf t
          • router ospf 1
          • network 192.168.20.0 0.0.0.255 area 0
          • network 192.168.30.0 0.0.0.255 area 0
          • network 192.178.70.0 0.0.0.255 area 30
          • end
          • wr
        • R3:
          • conf t
          • router ospf 1
          • network 192.168.30.0 0.0.0.255 area 0
          • network 192.188.10.0 0.0.0.255 area 40
          • end
          • wr
        • R4:
          • conf t
          • router ospf 1
          • network 192.178.10.0 0.0.0.255 area 10
          • network 192.178.20.0 0.0.0.255 area 10
          • end
          • wr
        • R5:
          • router ospf 1
          • network 192.178.20.0 0.0.0.255 area 10
          • network 192.178.30.0 0.0.0.255 area 10
          • end
          • wr
        • R6:
          • router ospf 1
          • network 192.178.40.0 0.0.0.255 area 20
          • network 192.178.50.0 0.0.0.255 area 20
          • end
          • wr
        • R7:
          • router ospf 1
          • network 192.178.50.0 0.0.0.255 area 20
          • network 192.178.60.0 0.0.0.255 area 20
          • end
          • wr
        • R8:
          • router ospf 1
          • network 192.178.70.0 0.0.0.255 area 30
          • network 192.178.80.0 0.0.0.255 area 30
          • end
          • wr
        • R9:
          • router ospf 1
          • network 192.178.80.0 0.0.0.255 area 30
          • network 192.178.90.0 0.0.0.255 area 30
          • end
          • wr
        • R10:
          • router ospf 1
          • network 192.188.10.0 0.0.0.255 area 40
          • network 192.188.20.0 0.0.0.255 area 40
          • end
          • wr
        • R11:
          • router ospf 1
          • network 192.188.20.0 0.0.0.255 area 40
          • network 192.188.30.0 0.0.0.255 area 50
          • end
          • wr
        • R12:
          • router ospf 1
          • network 192.188.30.0 0.0.0.255 area 50
          • network 192.188.40.0 0.0.0.255 area 50
          • end
          • wr
        • R13:
          • router ospf 1
          • network 192.188.40.0 0.0.0.255 area 50
          • network 192.188.50.0 0.0.0.255 area 50
          • end
          • wr
      • 4、配置虚链路
        • R11:
          • interface loopback 1
          • ip address 1.1.1.1 255.255.255.0
          • exit
          • router ospf 1
          • network 1.1.1.0 0.0.0.255 area 40
          • exit
          • router ospf 1
          • router-id 1.1.1.1
          • end
          • clear ip ospf process
          • yes
          • router ospf 1
          • area 40 virtual-link 2.2.2.2
        • R3:
          • en
          • conf t
          • interface loopback 1
          • ip address 2.2.2.2 255.255.255.0
          • exit
          • router ospf 1
          • network 2.2.2.0 0.0.0.255 area 40
          • exit
          • router ospf 1
          • router-id 2.2.2.2
          • end
          • clear ip ospf process
          • yes
          • conf t
          • router ospf 1
          • area 40 virtual-link 1.1.1.1
      • 5、在area50配置默认路由
        • R12:
          • Router(config)#iproute 0.0.0.0 0.0.0.0 192.188.30.1

        • R13:
          • Router(config)#iproute 0.0.0.0 0.0.0.0 192.188.40.1
      • 测试
  • 邻居表

    • R1#show ip ospf neighbor
    • Down state:未检测到活动邻居
    • Init state:接收HELLO报文
    • Two-way:接收到HELLO.并且其中包含本路由器的ROUTER-ID
    • Exstart state:确认Master(DR)/slave(BDR)的角色。 (HUB-SPOKE)
    • Exchange state:发送数据库描述报文。
    • Loading:交换LSR和LSU
    • Full:邻居达到完全邻接关系
    • 开启OSPF adj 邻居关系状态
      • R1#debug ip  ospf adj
      • 关闭debug功能
        • R1#undebug all
  • 邻居关系

    • 邻居关系是为了传输路由条目.邻居关系统的维持.(邻居关系状态)--------hello包
    • Hello包其实就是维护邻居关系统
    • Down state:未检测到活动邻居
    • Init state:接收HELLO报文
    • Two-way:接收到HELLO.并且其中包含本路由器的ROUTER-ID
    • Exstart state:确认Master(DR)/slave(BDR)的角色。 (HUB-SPOKE)
    • Exchange state:发送数据库描述报文。
    • Loading:交换LSR和LSU
    • Full:邻居达到完全邻接关系。
  • OSPF的ROUTER-ID(标识符)

    • 运行了OSPF路由协议的路由器要与其它运行OSPF路由协议的路由器之间要通行首要拥有标识符(身份证)。
    • 标识符(身份证):就是一个IP地址,因为一个网络里面地址没有冲突。
    • 标识符的选举:1:如果一台路由器有回环口,选则回环口最大的IP地址作为标识符。2:如果没有回环口则选则物理端口最大的IP地址作为本路由器的标识符。
    • 手工配置标识符:
      • R1#show ip ospf
      • Routing Process "ospf1" with ID 1.1.1.1
      • R1(config)#router ospf 1
      • R1(config-router)#router-id 3.3.3.3
      • Reload or use "clear ip ospf process" command, for this totake effect
      • R1#clear ip ospf process
      • Reset ALL OSPF processes? [no]: yes
  • OSPF的五种报文

    • Hello:第10S发送一次。 40S这是dead interval.建立与维持邻居关系
    • DBDescription:链路状态数据库描述数据包-------DBD编号为2的OSPF数据包对ospf的网络拓扑进行描述
    • 数据包在链路状态数据库交换期间产生,主要作用有三个:
      • ①选举交换链路状态数据库过程中的主从关系
      • ②确定交换链路状态数据库过程中的初始序列号
      • ③交换所有的LSA数据包头部
    • LSRequest:编号为3的OSPF数据包用于请求在DBD交换过程中发现的本路由器中没有的或已过时的LSA包细节
    • LSUpdate:编号为4的OSPF数据包功能:用于存储和传递路径信息用于将多个LSA泛洪,也用于对接收到的链路状态更新进行应答
    • LSACKnowledge:  编号为5的数据包用于对接收到的LSU进行确认。如果发送确认的路由器的状态是DR或者BDR,确认数据包发送到OSPF的组播地址224.0.0.5如果发送确认的路由器状态不是DR或BDR,确认将被发送到OSPF路由器组播地址224.0.0.6
    • 注意:OSPF是一种链路状态型路由协议,路由与路由不会传输路由条目。只会传输LSA(共有11种)。路由器收到LSA通过OSPF路由协议的算法计算得出路由表
    • 抓包来找这五种报文:
      • 例图:
      • hello ---确认邻居关系包 查看命令:show ip ospf neighbor
      • dbd()-----链路状态描述包 查看命令:show ip ospf database
      • lsr(link-state-request):链路状态请求包
      • lsu(link-state-update):链路状态更新包
      • lsack(link-state-ack):链路状态确认包
    • 五种报文的整个过程(面试题)

  • 路由重发布

    • 解决问题:解决不同路由协议之间相互同步路由条目。
    • 静态路由  RIP  EIGRP   OSPF 。
    • 重发布配置的位置:在不同路由协议之间相交的三层路由设备上进行配置
    • 实战:
      • 拓扑图:
      • 配置:
        • 1、规划网段
        • 2、设置每个节点IP地址
          • R4:
            • R4(config)#interface e0/0
            • R4(config-if)#no shutdown
            • R4(config-if)#ip address 192.168.10.1 255.255.255.0
          • R5:
            • R5(config)#interface e0/0
            • R5(config-if)#no shutdown
            • R5(config-if)#ip address 192.168.10.2 255.255.255.0
            • R5(config-if)#exit
            • R5(config)#interface e0/1
            • R5(config-if)#no shutdown
            • R5(config-if)#ip address 192.168.20.1 255.255.255.0
          • R6:
            • R6(config)#interface e0/1
            • R6(config-if)#no shutdown
            • R6(config-if)#ip address 192.168.20.2 255.255.255.0
            • R6(config-if)#exit
            • R6(config)#interface e0/0
            • R6(config-if)#no shutdown
            • R6(config-if)#ip address 192.168.30.1 255.255.255.0
            • R6(config-if)#exit
            • R6(config)#interface e0/2
            • R6(config-if)#no shutdown
            • R6(config-if)#ip address 192.168.70.1 255.255.255.0
            • R6(config-if)#exit
            • R6(config)#interface e0/3
            • R6(config-if)#no shutdown
            • R6(config-if)#ip address 192.168.50.1 255.255.255.0
          • R7:
            • R7(config)#interface e0/0
            • R7(config-if)#no shutdown
            • R7(config-if)#ip address 192.168.30.2 255.255.255.0
            • R7(config-if)#exit
            • R7(config)#interface e0/1
            • R7(config-if)#no shutdown
            • R7(config-if)#ip address 192.168.40.1 255.255.255.0
          • R8:
            • R8(config)#interface e0/1
            • R8(config-if)#no shutdown
            • R8(config-if)#ip address 192.168.40.2 255.255.255.0
          • R9:
            • R9(config)#interface e0/3
            • R9(config-if)#no shutdown
            • R9(config-if)#ip address 192.168.50.2 255.255.255.0
            • R9(config-if)#exit
            • R9(config)#interface e0/0
            • R9(config-if)#no shutdown
            • R9(config-if)#ip address 192.168.60.2 255.255.255.0
          • R10:
            • R10(config)#interface e0/0
            • R10(config-if)#no shutdown
            • R10(config-if)#ip address 192.168.60.1 255.255.255.0
          • R11:
            • R11(config)#interface e0/2
            • R11(config-if)#no shutdown
            • R11(config-if)#ip address 192.168.70.2 255.255.255.0
            • R11(config-if)#exit
            • R11(config)#interface e0/0
            • R11(config-if)#no shutdown
            • R11(config-if)#ip address 192.168.80.1 255.255.255.0
          • R12:
            • R12(config)#interface e0/0
            • R12(config-if)#no shutdown
            • R12(config-if)#ip address 192.168.80.2 255.255.255.0
        • 3、配置路由区域(area0、rip、eigrp、静态路由static)
          • OSPF:
            • R4:
              • R4(config)#routerospf 1
              • R4(config-router)#network0.0.0.0 0.0.0.0area 0
            • R5:
              • R5(config)#routerospf 1
              • R5(config-router)#network0.0.0.0 0.0.0.0area 0
            • R6:
              • R6(config)#routerospf 1
              • R6(config-router)#network192.168.20.0 0.0.0.255 area 0
          • RIP:
            • R7:
              • R7(config)#routerrip
              • R7(config-router)#network192.168.30.0
              • R7(config-router)#network192.168.40.0
            • R8:
              • R8(config)#routerrip
              • R8(config-router)#network192.168.40.0
            • R6:
              • R6(config)#routerrip
              • R6(config-router)#network192.168.30.0
          • 静态路由
            • R10:
              • R5(config)#iproute  192.168.50.0 255.255.255.0 192.168.60.2
            • R6:
              • R5(config)#iproute  192.168.60.0 255.255.255.0 192.168.50.2
          • EIGRP
            • R11:
              • R11(config)#routereigrp 1
              • R11(config-router)#network192.168.70.0 0.0.0.255
              • R11(config-router)#network192.168.80.0 0.0.0.255
            • R12:
              • R12(config)#routereigrp 1
              • R12(config-router)#network192.168.80.0 0.0.0.255
            • R6:
              • R6(config)#routereigrp 1
              • R6(config-router)#network192.168.70.0 0.0.0.255
        • 4、路由重发布
          • 将OSPF路由条目导入到rip
            • R6(config)#routerrip
            • R6(config-router)#redistributeospf 1metric 1
            • 只要向rip中导入路由条目都metric 1
          • 将rip路由条目导入到OSPF
            • R6(config)#routerospf 1
            • R6(config-router)#redistributerip subnets
            • 只要向OSPF中导入路由条目都subnets
          • 将RIP路由条目导入到EIGRP中
            • R6(config)#routereigrp 1
            • R6(config-router)#redistributerip metric100 100 100 100 100
            • 只要向EIGRP中导入路由条目都metric 100 100 100 100 100
          • 将EIGRP路由条目导入到RIP中
          • 将OSPF路由条目导入到EIGRP中
          • 将EIGRP路由条目导入到OSPF中
          • 将静态路由协议导入到OSPF
            • R6(config)#routerospf 1
            • R6(config-router)#redistributestaticsubnets
            • R6(config-router)#redistributeconnected  subnets
          • 将静态路由协议导入到rip
            • R6(config)#routerrip
            • R3(config-router)#redistribute static metric1
            • R3(config-router)#redistribute connected metric1
          • 将静态路由协议导入到EIGRP
            • R6(config)#routereigrp
            • R3(config-router)#redistribute static metric100 100 100 100 100
            • R3(config-router)#redistributeconnected metric100 100 100 100 100 (connected直连)
          • 将动态路由协议导入静态路由协议
            • 在运行静态路由协议的路由器上配置一条默认路由
            • R9(config)#iproute 0.0.0.0 0.0.0.0192.168.50.1
            • R10(config)#iproute 0.0.0.0 0.0.0.0 192.168.60.2
        • 5、实现不同协议之间相互通信
  • 链路状态数据库表

    • R1#show ip ospf database
    • OSPF Router with ID (1.1.1.1)(Process ID 1)
    • Router LinkStates (Area 0)
    • 路由表
      • R1#show ip route
        • 1.0.0.0/24 is subnetted, 1subnets
      • C       1.1.1.0is directly connected, Loopback1
        • 2.0.0.0/32 is subnetted, 1subnets
      • O       2.2.2.2[110/65] via 12.1.1.2, 00:03:03, Serial0/0
        • 12.0.0.0/24 is subnetted, 1subnets
      • C       12.1.1.0 isdirectly connected, Serial0/0
  • OSPF的DR/BDR

    • 1、DR/BDR产生条件

      • ethernet fastethernet gibitethernet (以太网接口类型广播)
      • 例图:
    • 2、NBMA多路访问网络(才会产生DR/DBR的选举)

      • Router#show ip ospf neighbor
      • Neighbor ID PriState Dead Time Address Interface
      • 2.2.2.2 1 FULL/DR00:00:33 1.1.1.2 FastEthernet0/0
      • 串口(不会产生DR/BDR的选举)
      • Router#show ipospf nei
      • Neighbor ID PriState Dead Time Address Interface
      • 1.1.1.2 0 FULL/ -00:00:38 1.1.1.2 Serial0/3/0
    • 3、DR/BDR的作用:

      • 当以上情况下随着路由器增加。它的邻居数量会越来越多。为了减少邻居关系统数量。出现了DR/BDR/DROTHER.。在以上这个网络里面,会选择一个DR。再选择一个BDR.其它路由器都成为DROTHER.  DROTHER与DR建立邻居关系统。而DROTHER与DROTHER之间不会建立邻居关系统。 而BDR只是DR一个备份。当DR损坏。BDR接管DR的工作。成为DR
      • DR和BDR之间是full
      • DR和DRother之间是full
      • BDR和DRother之间是full
      • DRother之间是two-way
    • 4、DR/BDR的选举规则

      • 默认情况下:
        • 1:如果有回环口,选择回环口最大的IP地址的路由器作为本网的DR。
        • 2:如果没有回环口,会选择物理端口最大的IP的路由器作为本网的DR.
        • 3: 端口优先级。(优先级越大越优先。改为0则不参与DR和BDR选举.
          • 修改优先级的命令:
            • Router(config)#interfacef0/0
            • Router(config-if)#ip ospf priority 0
  • OSPF认证

    • 解决问题:保证OSPF路由学习的安全性
    • A:区域认证(在哪些设备上去配置:XXX)
    • 1.  明文认证:
      • R2(config)# router ospf 1
      • R2(config-router)# area 1authentication
      • R2(config-router)# exit
      • R2(config)# interface serial  1/0
      • R2(config-if)# ip ospf authentication- - key cisco
    • 2.  密文认证:MD5
      • R1(config)# router ospf 1
      • R1(config-router)# area 1 authentication message-digest
      • R1(config-router)# exit
      • R1(config)# interface serial  1/1
      • R1(config-if)# ip ospf message-digest-key 1 md5 cisco
    • B:接口认证(在哪些接口上去配置:XXX)
    • 1.  明文认证:
      • R1(config)# interface s erial  1/1
      • R1(config-if)# ip ospf authentication
      • R1(config-if)# ip ospf authentication-key cisco
    • 2.密文认证:MD5
      • R1(config)# interface serial  1/1
      • R1(config-if)# ip ospf authentication message-digest
      • R1(config-if)# ip ospf message-digest-key 1 md5 cisco
  • OSPF的METRIC计算

    • 接口COST的查看
      • Router#show ipospf interface loopback 1
      • Loopback1 is up,line protocol is up
      • Internet addressis 3.3.3.3/24, Area 0
      • Process ID 1,Router ID 3.3.3.3, Network Type LOOPBACK, Cost:1
      • Loopback interface is treated as a stub Host
    • 计算规则:METRIC是路由条目传递方向,经过所有路由器的入接口的COST总和。
    • COST的计算
      • cost计算公式:10^8/接口带宽
        • f0/0  cost 1
        • 100000000/100M
        • 100M=100000Kbit=100000000bit
        • S0/0  cost 64
      • 常用接口的COST值
        • S0/0 -----64
        • F0/0-------1
        • G0/0--------100000000/1000000000=?
    • COST的修改:
      • Router(config)#interfaceloopback 1
      • Router(config-if)#ip ospf cost 122
    • 链路状态协议:在传输路由条目的时候不是直接传输的网络,而是直接输的lsa1 lsa2 lsa3 lsa4 lsa5 lsa7
    • rip抓包可以抓到网段 ospf抓包只能抓到路由条目(LSA)
    • Ospf收到lsa会采用spf将这些lsa利用算法生成路由条目
    • 每种接口类型的COST值不一样:
    •  
  • OSPF利用METRIC的负载均衡

    • 如果两条或多条路径metric一样。会进行负载均衡
    • 查看负载均衡 show ip route
      • 如果有两条或多个下一条 就是负载均衡
      • traceroute+IP地址 可以查看路由条目走向
  • OSPF默认路由引入

    • ROUTER10上进配置OSPF默认路由
      • Router(config)#ip route 0.0.0.0 0.0.0.0 loopback 1
      • Router(config)#routerospf 1
      • Router(config-router)#default-information originate
      • 然后ROUTER10会自动向OSPF路由器区域下发默认路由
    • 注意:
      • R1(config)#interface loopback 1
      • R1(config-if)#ipospf  network point-to-point
  • OSPF路由器的种类

    • IR:区域内部路由器
    • ABR:区域边界路由器
    • ASBR:自治系统边界路由器
    • BR:骨干路由器(区域0里面的所有路由器)
  • LSA的类型

    • 全称:Link state advertisement
    • 例图:
    • Loading:交换LSR和LSU(lsa 1 lsa2 lsa3 lsa4 lsa5lsa7)
    • LSA:link state acknowledge
    • OSPF 的三张表
      • show ip route(路由表就是通过databases表优化出来)
      • show ip ospf database(记录的所有源到目的所有路径信息的可能)(查看LSA)
      • show ip ospf neighbor(建立邻居关系)
    • Lsa1L:(router-lsa1)
      • Router-link state (lsa1) (不需要DR与BDR选举)
      • 它负责单个区域内的路由。它不能跨区域传递。LSA1列出了路由器的链路和接口,链路的出站COST值以及接口状态(DOWN-INIT----FULL).它只在本AREA内进行flooding.本AREA内其它路由器收到LSA1形成的路由条目以“0”表示,LSA1描述自身的直连信息。(本AREA区域所有路由器始发)  
      • 侧重点:链路ID和链路的数量,会对不同链路类型有不同内容。
    • LSA2通告内容:
      • Net link state (lsa2)
      • 该LAN内所有和DR形成FULL邻接关系统的路由器的ROUTER-ID以及DR本的ROUTER-ID.再就是该LAN的网络掩码(LAN中的各接口掩码是一样的,否则无法形成OSPF邻居)。它负责单个区域内的路由,它只在本AREA内进行flooding.(由AREA内的DR始发)。
      • 侧重点:LSA2本身是广播型链路的产物。重点在于和DR相连的路由器ID以及该广播型链路的网络掩码。
    • LSA1------LSA2
      • 例图:
      • 以上每个区域都会产生各自区域内部lsa1  lsa2以维护区域内部路由,但是lsa1与lsa2只能同一个区域内部进行泛洪。Lsa1与lsa2不能跨区域进行转输
      • 总结:lsa1 与lsa2都是负责单区域的所有路由,在以太网链路会有lsa2.
    • LSA3:负责域间(OIA)的路由。是由ABR始发
      • (Summary Net Link States)
      • 例图:
      • Lsa3:在区域边界路由器上将各自区域的lsa1 lsa2进行转化变成lsa3 因为lsa3才能跨区域进行转输。以维护区域间的路由
      • LSA3通告的内容:通告的是area相连的链路信息。具体来讲就是将自已AREA内的链路告诉AREA0,也将其它的AREA(包括AREA 0)的信息传到自已的AREA.其通告的链路是所有链路中COST最小的,在路由表中以”OIA”表示,如果LSA3通告的是一条默认路由,那么链路状ID和网络掩码字段中都将设0.0.0.0。(OSPF只能在ABR路由器做区域的汇总,没有办法做接口的手工汇总)
    • LSA4----LSA5 (共同负责到达除了OSPF区域的路由)
      • 例图:
        • ASBR:连接外部路由协议的路由器
        • IR:区域内部的路由器
        • ABR:区域边界路由器
        • BR:骨干路由器(区域0里面的所有路由器)(backbone router)
      • LSA4:
        • Summary ASB Link States. 是由ABR始发。(抓包)
        • lsa4标记asbr的位置
        • 通告了ASBR的具体位置,是一条到达ASBR的主机路由
      • LSA5:
        • Type-5 AS External Link States
        • 负责将其它几种路由协议(rip)在导入ospf协议之间把其它协议的路由条目转化为lsa5
        • 就是用来传输外部路由协议导入到OSPF路由
      • lSA4----LSA5 (共同负责到达重分布到OSPF区域里面的路由)
    • LSA7:
      • 负责将其它路由协议(eigrp)重分布到ospf中的nssa区域外部路由。转换成LSA7进行转输
      • 例图:
    • 注意:
      • 1:一台ROUTER成为ABR前提是必须运行OSPF进程接口与AREA 0直连。否则不会产生LSA3和LSA4,也就无法完成ABR的任务,解决办法一般是通过虚链路。
      • 2:LSA3和LSA4都只能在单个AREA内flooding,具体来看,LSA4就是在AREA0内FLOODING让ABR都知道ASBR的位置。
      • 3: LSA3和LSA4都是由ABR始发,报文格式是相同的,只不过有几处字段内容不一样。在“链路状态ID”这个字段中,LSA3通告的是网络或子网的IP地址,而LSA4通告是ASBR的路由器ID;而“网络掩码字段”对LSA4没有什么意义。设置为0.0.0.0
      • LSA5:AS-External-lsa,是由ASBR始发。
      • Lsa5:通告了与ASBR直连的其它AS的路由信息。LSA5被FLOODING至除(stub,T-stub,nssa,T-nssa)以外的所有AREA.
      • LSA5形成的路由条目以E1或E2表示(默认是E2)。E1与E2的区别。
      • 当OSPF路由器获得一条LSA5,在装进路由表之彰会检查“转发地址”是否可以通过AREA或AREA间路由到达。若不可达,不会装进路由表
      • LSA7: AS External Link States. 由NSSA区域的ASBR.负责的是NSSA区域外部路由。
      • LSA7与LSA5基本一样(只有转发地址字段不同),关键是LSA7只在始发该LSA的NSSA区域FLOODING.并在ABR转换成LSA5,LSA7形成的路由条目以N1或N2表示
  • OSPF的四大特殊区域

    • stub area 末节
    • totally stub area ------T-stub 完全末节
    • nssa area 次末节
    • nssa totally area ------T-nssa 完全次末节
    • 这四大区域作用都是优化路由表
    • 优化路由表的好处
      • 如果一台路由器的它路由表条目非常非常多有什么影响,数据包到本路由要去查表,那么数据包查表的过程是需要时间的,如果时间越长会造成网络延迟比较大,所以就需要优化路由表来减小影响
      •  
    • 默认路由:0.0.0.0 0.0.0.0 下一跳(静态默认路由) 0代表的的任意网段
    • OIA的路由表示:这条路由是由OSPF区域之间经过的路由
    • STUB
      • 作用:优化路由表
      • 优化区域:只优化stub区域内的所有路由器:将到达外部路由协议(rip)优先成默认路由。
      • 优化条目:是将非OSPF区域路由条目优化成O*IA的默认路由
      • 就是与骨干区域相邻的区域
        • 1相邻后面没有接其它区域
          • 例图:

        • 2.如果相邻后面接了其的OSPF区域,先择最后一个区域作为stub区域.
          • 例图:

      • STUB的配置:
        • 拓扑图:
        • 1、规划网段
        • 2、配置每个节点的IP地址
          • R0:
            • en
            • conf t
            • int s0/3/0
            • no shutdown
            • ip address 172.16.255.1 255.255.255.252
            • exit
            • interface loopback0
            • ip address 172.16.1.1 255.255.255.0
            • end
            • wr
          • R1:
            • enable
            • conf t
            • interface s0/3/0
            • no shutdown
            • ip address 172.16.255.2 255.255.255.252
            • exit
            • interface s0/3/1
            • no shutdown
            • ip address 172.16.255.5 255.255.255.252
            • exit
          • R2:
            • enable
            • conf t
            • interface s0/3/1
            • no shutdown
            • ip address 172.16.255.6 255.255.255.252
            • exit
            • interface s0/3/0
            • no shutdown
            • ip address 172.16.255.9 255.255.255.252
            • exit
            • interface s0/1/0
            • no shutdown
            • ip address 192.168.1.1 255.255.255.0
            • exit
          • R3:
            • enable
            • conf t
            • interface loopback0
            • ip address 172.16.2.1 255.255.255.0
            • exit
            • interface s0/3/0
            • no shutdown
            • ip address 172.16.255.10 255.255.255.252
            • exit
          • R4:
            • enable
            • conf t
            • interface loopback0
            • ip address 10.1.1.1  255.0.0.0
            • exit
            • interface s0/3/0
            • no shutdown
            • ip address 192.168.1.2 255.255.255.0
            • exit
        • 3、配置路由协议
          • R0:
            • Router(config)#routerospf 1
            • Router(config-router)#network172.16.1.0 0.0.0.255 area 1
            • Router(config-router)#network172.16.255.0 0.0.0.3 area 1
          • R1:
            • Router(config)#router ospf1
            • Router(config-router)#network172.16.255.0 0.0.0.3 area 1
            • Router(config-router)#network172.16.255.4 0.0.0.3 area 0
          • R2:
            • Router(config)#routerospf 1
            • Router(config-router)#network172.16.255.4 0.0.0.3 area 0
            • Router(config-router)#network172.16.255.8 0.0.0.3 area 0
            • Router(config)#routerrip
            • Router(config-router)#network192.168.1.0
          • R3:
            • Router(config)#routerospf 1
            • Router(config-router)#network172.16.2.0 0.0.0.255 area 2
            • Router(config-router)#network172.16.255.8 0.0.0.3 area 0
          • R4:
            • Router(config)#routerrip
            • Router(config-router)#network10.0.0.0
            • Router(config-router)#network192.168.1.0
        • 4、路由重发布(R2)
          • 将OSPF路由条目导入到RIP路由表.
          • Router(config)#routerrip
          • Router(config-router)#redistributeospf 1 metric 1
          • 将RIP路由条目导入到OSPF路由表.
          • Router(config)#routerospf 1
          • Router(config-router)#redistributerip subnets
        • 5、设置Stub区域(area1)
          • R1:
            • Router(config)#routerospf 1
            • Router(config-router)#area1 stub
          • R0:
            • Router(config)#routerospf 1
            • Router(config-router)#area1 stub
    • T-STUB
      • 优化区域:外部路由协议(RIP)和OIA(OSPF区域间的所有路由)优化成一条默认路由
      • 优化条目:是将非OSPF区域路由条目以及区域间的路由(OIA路由条目)优化成O*IA的默认路由。
      • T-STUB的配置
        • 在stub的基础上
        • 添加T-stub
          • R1:
            • R1(config)# router ospf 1
            • R1(config-router)# area 1 stub  no- summary
            • R1(config-router)# exit
          • R0:
            • R0(config)# router ospf 1
            • R0(config-router)# area 1 stub
            • R0(config-router)# exit
            • R0(config)# ex
    • NSSA
      • 拓扑图:
      • NSSA区域就是接其它路由协议的区域.(但是前提这个区域不是area 0)
      • 优化区域:NSSA区域路由器以及NSSA相连的其它协议的路由器
      • 优化条目:是将与AREA0相连的非OSPF区域路由条目优化成O*N2的默认路由
      • NSSA的配置
        • 拓扑图:
        • NSSA区域所有的路由器都要进行配置
        • 1、规划网段
        • 2、配置每个节点IP地址
        • 3、配置路由协议
        • 4、路由重发布
        • 5、添加NSSSA
          • R8:
            • R8(config)# router ospf 1
            • R8(config-router)# area 1 nssa default- - information- - originate
            • R8(config-router)#exit
          • R7:
            • R8(config)# route r ospf 1
            • R8(config-router)# area 1 nssa
            • R7(config-router)# exit
    • T-NSSA
      • 优化区域:
        • NSSA区域路由器以及NSSA相连的其它协议的路由器
        • 将OSPF区域间的路由条目和将骨干区域相连的外部路由协议的条目.并且将:t-NSSA连接其它路由协议的路由器上将除了NSSA区域的路由和本路由协议内部路由条目其它全部优化成一条默认路由
      • 优化条目:是将与AREA0相连的非OSPF区域路由条目以及区域间的路由(OIA)优化成O*IA的默认路由
      • T-NSSA的配置
        • 在NSSSA的基础上
        • 添加T-NSSA(进一步简化NSSA区域的路由表)
          • R8:(只需要在R8添加)
            • R8(config)# router ospf 1
            • R8(config-router)# area  1 nssa no- - summary
            • R8(config-router)#exit
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值