ospf实验
Posted thin-fat
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ospf实验相关的知识,希望对你有一定的参考价值。
一、拓扑
二、地址规划(ipv4)
路由 |
接口 |
地址 |
Loopback0 |
R1
|
F0/0 |
10.102.10.1/24 |
10.102.1.2/24
|
F0/1 |
10.102.20.1/24 |
||
R2 |
F0/1 |
10.102.10.2/24 |
10.102.2.2/24 |
F0/0 |
10.102.30.2/24 |
||
R3 |
S1/2 |
10.102.40.3/24 |
10.102.3.2/24 |
F0/0 |
10.102.10.3/24 |
||
R4 |
|
|
10.102.4.2/24 |
R5 |
S1/0 |
10.102.40.2/24 |
10.102.5.2/24 |
R6 |
S1/1 |
10.102.40.1/24 |
10.102.6.2/24 |
R7 |
F2/0 |
10.102.30.1/24 |
10.102.7.2/24 |
F0/1 |
10.102.20.2/24 |
||
F0/0 |
10.102.50.2/24 |
||
R8 |
F0/0 |
10.102.50.1/24 |
10.102.8.2/24 |
三、配置步骤
采用帧中继连接,R4作为帧中继交换机
R4#configure terminal
R4(config)#frame-relay switching
R4(config)#interface serial 1/0
R4(config-if)# encapsulation frame-relay
R4(config-if)#no arp frame-relay 关闭动态dicl
R4(config-if)# frame-relay lmi-type cisco
R4(config-if)# frame-relay intf-type dce
R4(config-if)# frame-relay route 201 interface Serial1/1 101 配置帧中继路由表
R4(config-if)#frame-relay route 202 interface Serial1/2 402
R4(config-if)#exit
R4(config)#interface serial 1/1
R4(config-if)# encapsulation frame-relay
R4(config-if)# frame-relay lmi-type cisco
R4(config-if)# frame-relay intf-type dce
R4(config-if)# frame-relay route 101 interface Serial1/0 201 配置帧中继路由表
R4(config-if)#frame-relay route 102 interface Serial1/2 401
R4(config-if)#exit
R4(config)#interface serial 1/2
R4(config-if)# encapsulation frame-relay
R4(config-if)# frame-relay lmi-type cisco
R4(config-if)# frame-relay intf-type dce
R4(config-if)# frame-relay route 401 interface Serial1/1 102 配置帧中继路由表
R4(config-if)#frame-relay route 402 interface Serial1/2 202
R4(config-if)#exit
R5 R6配置静态dlci
R5#configure terminal
R5(config)interface Serial1/0
R5(config-if)# encapsulation frame-relay
R5(config-if)#no arp frame-relay 关闭动态dicl
R5(config-if)# frame-relay map ip 10.102.40.1 201 broadcast
R5(config-if)# frame-relay map ip 10.102.40.3 202 broadcast
R5(config-if)#exit
R6#configure terminal
R6(config)#interface Serial4/1
R6(config-if)# encapsulation frame-relay
R6(config-if)#no arp frame-relay 关闭动态dicl
R6(config-if)# frame-relay map ip 10.102.40.3 102 broadcast
R6(config-if)# frame-relay map ip 10.102.40.2 101 broadcast
R6(config-if)#exit
测试连通性:
R5#ping 10.102.40.3
R6#ping 10.102.40.3
四、配置ospf
R2配置以R1为例:
R1#conf terminal
R1(config)#router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)#area 1 nssa 定义区域1为nssa区域
R1(config-router)#network 10.102.1.0 0.0.0.255 area 0 宣告直连网段
R1(config-router)# network 10.102.10.0 0.0.0.255 area 0
R1(config-router)# network 10.102.20.0 0.0.0.255 area 1
R1(config-router)#exit
五、 帧中继配置Ospf
R5参照R6配置
R6#configure terminal
R6(config)#router ospf 1
R6(config-router)#router-id 6.6.6.6
R6(config-router)# network 10.102.40.0 0.0.0.255 area 2
R6(config-router)#exit
R6(config)interface Serial1/1
R6(config-if)# ip ospf priority 0 设置端口优先级为0,不参于选举。
R6(config-if)# exit
R3#conf terminal
R3(config)#router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)#network 10.102.3.0 0.0.0.255 area 0 宣告直连网段
R3(config-router)#network 10.102.10.0 0.0.0.255 area 0
R3(config-router)#network 10.102.40.0 0.0.0.255 area 2
R3(config-router)#neighbor 10.102.40.2 手动配置R5,R6为邻居
R3(config-router)# neighbor 10.102.40.1
R3(config-router)# area 0 range 10.102.0.0 255.255.0.0
R3(config-router)#exit
查看邻居状态
R3#show ip ospf neighbor
六、配置rip 重发布到ospf
R7#configure terminal
R7(config)router ospf 1
R7(config-router)#router-id 7.7.7.7
R7(config-router)#area 1 nssa
R7(config-router)# network 10.102.20.0 0.0.0.255 area 1 宣告直连网段
R7(config-router)# network 10.102.30.0 0.0.0.255 area 1
R7(config-router)#redistribute rip metric 25 subnets 将RIP重发布到ospf
R7(config-router)#exit
R7(config)#router rip
R7(config-router)#version 2
R7(config-router)# network 10.0.0.0
R7(config-router)#no auto-summary
R7(config-router)#redistribute ospf 1 metric 4 将ospf重发布到Rip
测试连通性:R8 ping R6
R8#ping 10.102.40.1
R8 ping R5
R8#ping 10.102.40.2
R1#ping 10.102.40.3
完成ping测试,则ospf配置已经成功。
OSPFV3配置
一、ipv6地址规划
路由 |
接口 |
地址 |
Loopback0 |
R1
|
F0/0 |
2001:db8:102:3::1/64 |
2001:cf:102:1::1/64 |
F0/1 |
2001:db8:102:4::1/64 |
|
|
R2 |
F0/1 |
2001:db8:102:3::2/64 |
2001:cf:102:2::1/64 |
F0/0 |
2001:db8:102:5::1/64 |
|
|
R3 |
S1/2 |
2001:db8:102:1::3/64 |
2001:cf:102:3::1/64 |
F0/0 |
2001:db8:102:3::3/64 |
|
|
R4 |
|
|
2001:cf:102:4::1/64 |
R5 |
S1/0 |
2001:db8:102:1::1/64 |
2001:cf:102:5::1/64 |
R6 |
S1/1 |
2001:db8:102:1::2/64 |
2001:cf:102:6::1/64 |
R7 |
F2/0 |
2001:db8:102:5::2/64 |
|
F0/1 |
2001:db8:102:4::2/64 |
2001:cf:102:7::1/64 |
|
F0/0 |
2001:db8:102:2::2/64 |
|
|
R8 |
F0/0 |
2001:db8:102:2::1/64 |
2001:cf:102:8::1/64 |
二、配置步骤
采用帧中继连接,R4作为帧中继交换机,帧中继路由R3,R5,R6静态配置dlci
R3#configure terminal
R3(config)#ipv6 unicast-routing
R3(config)#interface Serial4/2
R3(config-if)# frame-relay map ipv6 2001:DB8:102:1::1 402 broadcast
R3(config-if)# frame-relay map ipv6 2001:DB8:102:1::2 401 broadcast
R3(config-if)#frame-relay map ipv6 FE80::CE01:1EFF:FE28:0 401 broadcast
R3(config-if)# frame-relay map ipv6 FE80::CE02:EFF:FE60:0 402 broadcast
R3(config-if)#exit
R5#configure terminal
R5(config)#ipv6 unicast-routing
R5(config)interface Serial1/0
R5(config-if)#frame-relay map ipv6 2001:DB8:102:1::3 202 broadcast
R5(config-if)#frame-relay map ipv6 2001:DB8:102:1::2 201 broadcast
R5(config-if)# frame-relay map ipv6 FE80::CE01:1EFF:FE28:0 201 broadcast
R5(config-if)# frame-relay map ipv6 FE80::CE04:19FF:FE18:0 202 broadcast
R5(config-if)#exit
R6#configure terminal
R6(config)#ipv6 unicast-routing
R6(config)interface Serial1/1
R6(config-if)# frame-relay map ipv6 2001:DB8:102:1::3 102 broadcast
R6(config-if)# frame-relay map ipv6 2001:DB8:102:1::1 101 broadcast
R6(config-if)#frame-relay map ipv6 FE80::CE04:19FF:FE18:0 102 broadcast
R6(config-if)#frame-relay map ipv6 FE80::CE02:EFF:FE60:0 101 broadcast
R6(config-if)#exit
测试连通性:
R6 ping R3
R6#ping 2001:db8:102:1::3
帧中继环境下配置ospf
R3#configure terminal
R3(config)#ipv6 router ospf 1
R3(config-rtr)#router-id 3.3.3.3 配置路由id
R3(config-rtr)# area 0 range 2001:DB8::/32
R3(config-rtr)# exit
R3(config)#interface Serial1/2
R3(config-if)#ipv6 ospf 1 area 2
R3(config-if)# ipv6 enable
R3(config-if)# ipv6 ospf neighbor FE80::CE02:EFF:FE60:0 priority 1 手动配置邻居
R3(config-if)# ipv6 ospf neighbor FE80::CE01:1EFF:FE28:0 priority 1
R3(config-if)#exit
R3(config)#interface fastEthernet 0/0
R3(config-if)#ipv6 ospf 1 area 0
R6配置参考下面R5配置
R5#configure terminal
R5(config)#ipv6 router ospf 1
R5(config-rtr)#router-id 5.5.5.5 路由id
R5(config-rtr)# exit
R5(config)#interface Serial1/0
R5(config-if)# ipv6 ospf 1 area 2
R5(config-if)# ipv6 enable
R5(config-if)#exit
配置其他区域的OSPFV3
R2参考R1配置
R1#configure terminal
R1(config)#ipv6 unicast-routing
R1(config)#ipv6 router ospf 1
R1(config-rtr)#router-id 1.1.1.1
R1(config-rtr)#area 1 nssa 定义区域1为nssa区域
R1(config-rtr)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ipv6 enable
R1(config-if)#ipv6 ospf 1 area 0
R1(config-if)#exit
R1(config)#interface fastEthernet 0/1
R1(config-if)#ipv6 enable
R1(config-if)# ipv6 ospf 1 area 1
R1(config-if)#exit
配置路由重发布
R7#configure terminal
R7(config)#ipv6 unicast-routing
R7(config)#ipv6 router rip ys
R7(config-rtr)#redistribute ospf 1 metric 4 将ospfv3重发布到RIP中 R7(config-rtr)# redistribute connected
R7(config-rtr)#exit
R7(config)#ipv6 router ospf 1
R7(config-rtr)# router-id 7.7.7.7
R7(config-rtr)#area 1 nssa
R7(config-rtr)# redistribute rip 将rip重发布到ospfv3中
R7(config-rtr)# redistribute connected 把连接 R8 的网段重分布到 OSPFv3
R7(config-rtr)# exit
测试连通性
R8 ping R3
R8#ping 2001:db8:102:1::3
查看R5的邻居:
R5#show ipv6 ospf neighbor
实验总结:
通过此次作业,让我对于上学期学的ospf知识有了更深的理解,同时结合帧中继等,动手操作让目前学习的内容了解有了更深的层次。这作业做了两天半时间,从一开始配置错误导致无法ping通,到后面地址配置错误,算错导致后期排错排了很久。相信这次作业能对于实操有非常重要的意义。
以上是关于ospf实验的主要内容,如果未能解决你的问题,请参考以下文章