Cisco实验中ospf协议区域及虚电路结构基本配置

    xiaoxiao2021-04-15  220

    ospf基本配置

    ospf实验例图

    ==R1:虚拟地址lo0:1.1.1.1 s0/0:12.1.1.1 R2:虚拟地址lo0:2.2.2.2 lo1:22.22.22.22 s0/0:12.1.1.2 s0/1:23.1.1.2 R3:虚拟地址lo0:3.3.3.3 lo1:33.33.33.33 s0/1:23.1.1.3 s0/2:34.1.1.3 R4:虚拟地址lo0:4.4.4.4 s0/2:34.1.1.4 ==

    对R1进行配置 R1#conf t R1(config)#int lo0 R1(config-if)#ip add R1(config-if)#ip add 1.1.1.1 255.255.255.0 R1(config-if)#no sh R1(config)#int s0/0 R1(config-if)#ip add 12.1.1.1 255.255.255.0 R1(config-if)#no sh

    R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 1.1.1.1 0.0.0.0 area 0 R1(config-router)#network 12.1.1.1 0.0.0.0 area 0

    对R2进行基本配置 R2#conf t R2(config)#int lo0 R2(config-if)#ip add 2.2.2.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int s0/0 R2(config-if)#ip add 12.1.1.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int s0/1 R2(config-if)#ip add 23.1.1.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int lo1 R2(config-if)#ip add 22.22.22.22 255.255.255.0 R2(config-if)#no sh R2(config-if)#end

    R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 2.2.2.2 0.0.0.0 area 0 R2(config-router)#network 22.22.22.22 0.0.0.0 area 1 R2(config-router)#network 12.1.1.2 0.0.0.0 area 0 R2(config-router)#network 23.1.1.2 0.0.0.0 area 1

    对R3进行配置 R3#conf t R3(config)#int lo0 R3(config-if)#ip add 3.3.3.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#int lo1 R3(config-if)#ip add 33.33.33.33 255.255.255.0 R3(config-if)#no sh R3(config-if)#int s0/1 R3(config-if)#ip add 23.1.1.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#int s0/2 R3(config-if)#ip add 34.1.1.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#end

    R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 3.3.3.3 0.0.0.0 area 1 R3(config-router)#network 33.33.33.33 0.0.0.0 area 2 R3(config-router)#network 23.1.1.3 0.0.0.0 area 1 R3(config-router)#network 34.1.1.3 0.0.0.0 area 2

    对R4进行配置 R4#conf t R4(config)#int lo0 R4(config-if)#ip add 4.4.4.4 255.255.255.0 R4(config-if)#no sh R4(config-if)#int s0/2 R4(config-if)#ip add 34.1.1.4 255.255.255.0 R4(config-if)#no sh R4(config-if)#end

    R4(config)#route R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 R4(config-router)#network 4.4.4.4 0.0.0.0 area 2 R4(config-router)#network 34.1.1.4 0.0.0.0 area 2 R4(config-router)#end

    配置完成后观察各路由器路由条目 R1 R2 R3 R4 此时ospf区域配置实现,并发现R4、R1各自路由表中没有对方地址,因为R1在区域0,R4在区域2,中间多一个区域1,且0区域才为核心区域,所以此时可以使用虚电路将R2、R3实现虚电路,则R1、R4可实现通信,虚电路配置如下

    R2 R3

    之后再观察各路由表,会发现R1、R4之间会连通 注意,因为OSPF非核心区域的之间传递路由必须要通过区域0(核心区域),所以才会用到虚电路技术。


    最新回复(0)