OSPF+RIP实验
拓扑图OSPF命令:配置命令R1上配置命令如下:R2上配置命令如下:R3上配置命令如下:R4上配置命令如下:R5上配置命令如下:R6上配置命令如下:
拓扑图
OSPF命令:
dis ospf pee b ##查看邻居关系 dis ip routing-table pro ospf
ospf 1 route 1.1.1.1 ####OSPF指定个route-id、1是表示,只在本区域有效 route id 1.1.1.1 ###全局模式下配置 这个router-id所有协议生效
reset ospf 1 process ###1是进程号 重启ospf
ospf 配置方法 ospf 1 route 1.1.1.1 ###配置route-id ospf 10 ##启动ospf 它的进程号是10 area 0 ###进入区域0 骨干区域 network 20.0.0.0 0.0.0.3 ###宣告网段 20.0.0.0 反掩码 0.0.0.3 (32位)
引入路由 ospf 1 import-route rip 1 type 1 cost 5 ###默认引入type 2 度量值是不累加的 这种是不科学的,一般引入type 1,要累加 cost 5 是花销
引路由 rip 1 import-route ospf 1
末梢区域 stub ###末梢 2变都要加 完全末梢在abr上 加入 stub no-summary nssa区域 ###ASBR主要是靠5类的LSA来通告链路状态信息,可以用7类LSA优化,通告外部路由信息
配置命令
R1上配置命令如下:
interface GigabitEthernet 0
/0
/0
ip address 16
.0
.0
.1 24
interface GigabitEthernet 0
/0
/1
ip address 12
.0
.0
.1 24
interface LoopBack 0
ip address 1
.1
.1
.1 32
ospf 1 router
-id 1
.1
.1
.1
area 1
network 12
.0
.0
.0 0
.0
.0
.255
network 1
.1
.1
.1 0
.0
.0
.0
rip 1
version 2
undo summary
network 16
.0
.0
.0
import
-route ospf 1
ospf 1
import
-route rip 1
type 1 cost 5
ospf 1 router
-id 1
.1
.1
.1
area 1
nssa
R2上配置命令如下:
interface GigabitEthernet 0
/0
/1
ip address 12
.0
.0
.2 24
interface GigabitEthernet 0
/0
/2
ip address 23
.0
.0
.2 24
interface LoopBack 0
ip address 2
.2
.2
.2 32
ospf 1 router
-id 2
.2
.2
.2
area 1
network 2
.2
.2
.2 0
.0
.0
.0
network 12
.0
.0
.0 0
.0
.0
.255
network 23
.0
.0
.0 0
.0
.0
.255
ospf 1 router
-id 2
.2
.2
.2
area 1
nssa
R3上配置命令如下:
interface GigabitEthernet 0
/0
/2
ip address 23
.0
.0
.3 24
interface GigabitEthernet 0
/0
/3
ip address 34
.0
.0
.3 24
interface LoopBack 0
ip address 3
.3
.3
.3 32
ospf 1 router
-id 3
.3
.3
.3
area 1
network 23
.0
.0
.0 0
.0
.0
.255
area 0
network 3
.3
.3
.3 0
.0
.0
.0
network 34
.0
.0
.0 0
.0
.0
.255
ospf 1 router
-id 3
.3
.3
.3
area 1
nssa
R4上配置命令如下:
interface GigabitEthernet 0
/0
/3
ip address 34
.0
.0
.4 24
interface GigabitEthernet 0
/0
/0
ip address 45
.0
.0
.4 24
interface LoopBack 0
ip address 4
.4
.4
.4 32
ospf 1 router
-id 4
.4
.4
.4
area 0
network 34
.0
.0
.0 0
.0
.0
.255
network 4
.4
.4
.4 0
.0
.0
.0
area 2
network 45
.0
.0
.0 0
.0
.0
.255
ospf 1 router
-id 4
.4
.4
.4
area 2
stub no
-summary
R5上配置命令如下:
interface GigabitEthernet 0
/0
/0
ip address 45
.0
.0
.5 24
interface LoopBack 0
ip address 5
.5
.5
.5 32
ospf 1 router
-id 5
.5
.5
.5
area 2
network 45
.0
.0
.0 0
.0
.0
.255
network 5
.5
.5
.5 0
.0
.0
.0
ospf 1 router
-id 5
.5
.5
.5
area 2
stub
R6上配置命令如下:
interface GigabitEthernet 0
/0
/0
ip address 16
.0
.0
.6 24
interface LoopBack 0
ip address 6
.6
.6
.6 32
rip 1
version 2
undo summary
network 16
.0
.0
.0
network 6
.0
.0
.0
rip 1
import
-route ospf 1 cost 4