路由器单区域 OSPF 基本配置
实训三十三 路由器单区域 OSPF 基本配置
- 实验目的
1.掌握单区域 OSPF 的配置
2.理解链路状态路由协议的工作过程
3.掌握实验环境中虚拟接口的配置
- 应用环境
1.在大规模网络中,OSPF 作为链路状态路由协议的代表应用非常广泛
2.具有无自环,收敛快的特点
- 实验设备 1.DCR-2655 两台
- 网线 一条
六.实验步骤
第一步:路由器环回接口的配置
路由器 A:
Router-A>enable !进入特权模式 Router-A#config !进入全局模式
Router-A_config#interface g0/3 !进入接口模式
Router-A_config_g0/3#ip address 192.168.1.1 255.255.255.0 !配置 IP 地址 Router-A_config_g0/3#no shutdown !开启端口 Router-A_config_g0/3#exit !退出接口模式 Router-A_config#interface loopback0 !进入环回接口
Router-A_config_l0#ip address 10.10.10.1 255.255.255.0 !配置 IP 地址
Router -A_config_l0#no shutdown !开启环回接口路
路由器 B:
Router-B#config
Router-B_config#int g0/3
Router-B_config_g0/3#ip address 192.168.1.2 255.255.255.0
Router-B_config_g0/3#no shutdown
Router-B_config_g0/3#exit
Router-B_config#interface loopback0
Router-B_config_l0#ip address 10.10.11.1 255.255.255.0
Router -B_config_l0#no shutdown
第二步:验证接口配置
Router-B#show interface loopback0
Loopback0 is up, line protocol is up
Hardware is Loopback MTU 1514 bytes, BW 8000000 kbit, DLY 500 usec
Interface address is 10.10.11.1/24 !查看环回 IP 地址
Encapsulation LOOPBACK
第三步:路由器的 OSPF 配置
路由器 A 的配置:
Router-A_config#router ospf 2 !启动 OSPF 进程,进程号为 2 Router-A_config_ospf_2#network 10.10.10.0 255.255.255.0 area 0 !宣称 IP 地址到 0 区域 Router-A_config_ospf_2#network 192.168.1.0 255.255.255.0 area 0 !注意要写掩码和区域号 Router-A_config_ospf_2#^Z !按 ctrl+z,直接进入特权模式 路由器 B配置: Router-B_config#router ospf 1
Router-B_config_ospf_1#network 10.10.11.0 255.255.255.0 area 0 Router-B_config_ospf_1#network 192.168.1.0 255.255.255.0 area 0
第四步:查看路由表
路由器 A:
Router-A#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
C 10.10.10.0/24 is directly connected, Loopback0
O 10.10.11.1/32 [110,2] via192.168.1.2(on GigaEthernet0/3)
!注意到环回接口产生的是主机路由
C 192.168.1.0/24 is directly connected, GigaEthernet0/3
路由器 B:
Router-B#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
O 10.10.10.1/32 [110,2] via 192.168.1.1(on GigaEthernet0/3) !注意管理距离为 110
C 10.10.11.0/24 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, GigaEthernet0/3
第五步:其他验证命令
Router-B#show ip ospf 1 !显示该 OSPF 进程的信息
OSPF process: 1, Router ID: 10.10.11.1
Distance: intra-area 110, inter-area 110, external 150
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
SPFTV:0(0), TOs:6, SCHDs:5
All Rtrs support Demand-Circuit.
Number of areas is 1 AREA: 0 Number of interface in this area is 2(UP: 2)
Area authentication type: None All Rtrs in this area support Demand-Circuit.
Router-A#show ip ospf interface !显示 OSPF 接口状态和类型
GigaEthernet0/3 is up, line protocol is up
Internet Address: 192.168.1.1/24
Interface index: 5
Nettype: Broadcast
OSPF process is 2, AREA: 0, Router ID: 10.10.10.1
Cost: 1, Transmit Delay is 1 sec, Priority 1
Hello interval is 10, Dead timer is 40, Retransmit is 5
OSPF INTF State is IDr
Designated Router ID: 10.10.10.1, Interface address 192.168.1.1
Backup Designated Router ID: 10.10.11.1, Interface address 192.168.1.2
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.10.11.1 (Backup Designated Router)
Loopback0 is up, line protocol is up
Internet Address: 10.10.10.1/24
Interface index: 9 Nettype: Broadcast !环回接口的网络类型默认为广播 OSPF process is 2,
AREA: 0, Router ID: 10.10.10.1
Cost: 1, Transmit Delay is 1 sec, Priority 1
Hello interval is 10, Dead timer is 40, Retransmit is 5
OSPF INTF State is ILOOPBACK
Neighbor Count is 0, Adjacent neighbor count is 0
Router-A#show ip ospf neighbor !显示 OSPF 邻居 ---------------------------------------------------------------------------------------------------------------------- OSPF process: 2
AREA: 0 Neighbor ID Pri State DeadTime Neighbor Addr Interface 10.10.11.1 1 FULL/BDR 39 192.168.1.2 GigaEthernet0/3 ----------------------------------------------------------------------------------------------------------------------
第六步:修改环回接口的网络类型
Router-A#config
Router-A_config#interface loopback 0
Router-A_config_l0#ip ospf network point-to-point !将类型改为点到点
第七步:查看接口状态和路由器 A 的路由表
Router-A_config#show ip ospf
interface GigaEthernet0/3 is up, line protocol is up
Internet Address: 192.168.1.1/24
Interface index: 5
Nettype: Broadcast
OSPF process is 2,
AREA: 0, Router ID: 10.10.10.1
Cost: 1, Transmit Delay is 1 sec, Priority 1
Hello interval is 10, Dead timer is 40, Retransmit is 5
OSPF INTF State is IDr
Designated Router ID: 10.10.10.1, Interface address 192.168.1.1
Backup Designated Router ID: 10.10.11.1, Interface address 192.168.1.2
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.10.11.1 (Backup Designated Router)
Loopback0 is up, line protocol is up
Internet Address: 10.10.10.1/24
Interface index: 9 Nettype: Point-to-Point !环回接口的网络类型为 PPP OSPF process is 2, AREA: 0, Router ID: 10.10.10.1
Cost: 1, Transmit Delay is 1 sec, Priority 1
Hello interval is 10, Dead timer is 40, Retransmit is 5
OSPF INTF State is ILOOPBACK
Neighbor Count is 0, Adjacent neighbor count is 0
Router-B#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
O 10.10.10.1/32 [110,2] via 192.168.1.1(on GigaEthernet0/3)
C 10.10.11.0/24 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, GigaEthernet0/3