一、场景设置
说明:R1 Serial1/0 R2 Serial1/1 R3 Serial1/0 R4。需要在RB上配置路由再分配。
二、具体配置
1、RA的配置如下:
Router(config)#hostname RA
RA(config)#interface Loopback0
RA(config-if)#ip address 1.1.1.1 255.255.255.0
RA(config-if)#ip ospf network point-to-point
RA(config-if)#exit
RA(config)#interface Serial1/0
RA(config-if)#ip address 199.99.1.1 255.255.255.0
RA(config-if)#no shutdown
RA(config-if)#exit
RA(config)#router rip
RA(config-router)#version 2
RA(config-router)#network 1.0.0.0
RA(config-router)#network 199.99.1.0
RA(config-router)#exit
2、RB的配置如下:
Router(config)#hostname RB
RB(config)#interface Loopback0
RB(config-if)#ip address 2.2.2.2 255.255.255.0
RB(config-if)#ip ospf network point-to-point
RB(config-if)#exit
RB(config)#interface Serial1/0
RB(config-if)#ip address 199.99.1.2 255.255.255.0
RB(config-if)#no shutdown
RB(config-if)#exit
RB(config)#interface Serial1/1
RB(config-if)#ip address 199.99.2.1 255.255.255.0
RB(config-if)#no shutdown
RB(config-if)#exit
RB(config)#router ospf 1
RB(config-router)#redistribute rip subnets
RB(config-router)#network 199.99.2.0 0.0.0.255 area 0
RB(config-router)#network 2.2.2.0 0.0.0.255 area 0
RB(config-router)#exit
RB(config)#router rip
RB(config-router)#version 2
RB(config-router)#redistribute ospf 1 metric 2
RB(config-router)#network 199.99.1.0
RB(config-router)#no auto-summary
RB(config-router)#exit
3、RC的配置如下:
RC(config)#hostname RC
RC(config)#interface Loopback0
RC(config-if)#ip address 3.3.3.3 255.255.255.0
RC(config-if)#ip ospf network point-to-point
RC(config-if)#exit
RC(config)#interface Serial1/1
RC(config-if)#ip address 199.99.2.2 255.255.255.0
RC(config-if)#no shutdown
RC(config-if)#exit
RC(config)#interface Serial1/0
RC(config-if)#ip address 199.99.3.1 255.255.255.0
RC(config-if)#no shutdown
RC(config-if)#exit
RC(config)#router ospf 1
RC(config-router)#network 3.3.3.0 0.0.0.255 area 1
RC(config-router)#network 199.99.2.0 0.0.0.255 area 0
RC(config-router)#network 199.99.3.0 0.0.0.255 area 1
RC(config-router)#exit
4、RD的配置如下:
Router(config)#hostname RD
RD(config)#interface Loopback0
RD(config-if)#ip address 4.4.4.4 255.255.255.0
RD(config-if)#ip ospf network point-to-point
RD(config-if)#exit
RD(config)#interface Serial1/0
RD(config-if)#ip address 199.99.3.2 255.255.255.0
RD(config-if)#no shutdown
RD(config-if)#exit
RD(config)#router ospf 1
RD(config-router)#network 4.4.4.0 0.0.0.255 area 1
RD(config-router)#network 199.99.3.0 0.0.0.255 area 1
RD(config-router)#exit
三、验证配置
1、查看各路由器相关接口的开启状态:
RA#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial1/0 199.99.1.1 YES manual up up
Loopback0 1.1.1.1 YES manual up up
RB#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial1/0 199.99.1.2 YES manual up up
Serial1/1 199.99.2.1 YES manual up up
Loopback0 2.2.2.2 YES manual up up
RC#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial1/0 199.99.3.1 YES manual up up
Serial1/1 199.99.2.2 YES manual up up
Loopback0 3.3.3.3 YES manual up up
RD#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial1/0 199.99.3.2 YES manual up up
Loopback0 4.4.4.4 YES manual up up
可见相关的接口及链路协议已经处于开启状态!
2、查看各路由器的路由表:
RA#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/2] via 199.99.1.2, 00:00:17, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.3.0 [120/2] via 199.99.1.2, 00:00:17, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [120/2] via 199.99.1.2, 00:00:17, Serial1/0
R 199.99.3.0/24 [120/2] via 199.99.1.2, 00:00:17, Serial1/0
R 199.99.2.0/24 [120/2] via 199.99.1.2, 00:00:17, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
RB#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 1.0.0.0/8 [120/1] via 199.99.1.1, 00:00:01, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/65] via 199.99.2.2, 00:09:57, Serial1/1
4.0.0.0/24 is subnetted, 1 subnets
O IA 4.4.4.0 [110/129] via 199.99.2.2, 00:05:15, Serial1/1
O IA 199.99.3.0/24 [110/128] via 199.99.2.2, 00:06:06, Serial1/1
C 199.99.2.0/24 is directly connected, Serial1/1
C 199.99.1.0/24 is directly connected, Serial1/0
RC#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O E2 1.0.0.0/8 [110/20] via 199.99.2.1, 00:06:10, Serial1/1
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/65] via 199.99.2.1, 00:07:01, Serial1/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/65] via 199.99.3.2, 00:06:10, Serial1/0
C 199.99.3.0/24 is directly connected, Serial1/0
C 199.99.2.0/24 is directly connected, Serial1/1
O E2 199.99.1.0/24 [110/20] via 199.99.2.1, 00:06:10, Serial1/1
RD#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O E2 1.0.0.0/8 [110/20] via 199.99.3.1, 00:06:56, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/129] via 199.99.3.1, 00:06:56, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/65] via 199.99.3.1, 00:06:56, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
C 199.99.3.0/24 is directly connected, Serial1/0
O IA 199.99.2.0/24 [110/128] via 199.99.3.1, 00:06:56, Serial1/0
O E2 199.99.1.0/24 [110/20] via 199.99.3.1, 00:06:56, Serial1/0
3、在运行了OSPF协议的路由器查看邻居:
RB#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 0 FULL/ - 00:00:38 199.99.2.2 Serial1/1
RC#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:31 199.99.2.1 Serial1/1
4.4.4.4 0 FULL/ - 00:00:34 199.99.3.2 Serial1/0
RD#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 0 FULL/ - 00:00:33 199.99.3.1 Serial1/0
4、在运行了OSPF协议的路由器查看OSPF数据库:
RB#show ip ospf database
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 776 0x80000004 0x00D838 3
3.3.3.3 3.3.3.3 772 0x80000002 0x00DC49 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
3.3.3.0 3.3.3.3 780 0x80000001 0x00CC5A
4.4.4.0 3.3.3.3 481 0x80000001 0x002BB8
199.99.3.0 3.3.3.3 532 0x80000001 0x00C2FF
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.0.0.0 2.2.2.2 1328 0x80000001 0x009EF8 0
199.99.1.0 2.2.2.2 1328 0x80000001 0x00D299 0
RC#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 791 0x80000004 0x00D838 3
3.3.3.3 3.3.3.3 786 0x80000002 0x00DC49 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
3.3.3.0 3.3.3.3 794 0x80000001 0x00CC5A
4.4.4.0 3.3.3.3 494 0x80000001 0x002BB8
199.99.3.0 3.3.3.3 545 0x80000001 0x00C2FF
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
3.3.3.3 3.3.3.3 509 0x80000004 0x0010F0 3
4.4.4.4 4.4.4.4 508 0x80000003 0x000FEB 3
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
2.2.2.0 3.3.3.3 779 0x80000001 0x007376
199.99.2.0 3.3.3.3 809 0x80000001 0x00CDF5
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
2.2.2.2 3.3.3.3 799 0x80000001 0x0047A0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.0.0.0 2.2.2.2 1363 0x80000001 0x009EF8 0
199.99.1.0 2.2.2.2 1365 0x80000001 0x00D299 0
RD#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
3.3.3.3 3.3.3.3 523 0x80000004 0x0010F0 3
4.4.4.4 4.4.4.4 522 0x80000003 0x000FEB 3
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
2.2.2.0 3.3.3.3 793 0x80000001 0x007376
199.99.2.0 3.3.3.3 803 0x80000001 0x00CDF5
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
2.2.2.2 3.3.3.3 793 0x80000001 0x0047A0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.0.0.0 2.2.2.2 1357 0x80000001 0x009EF8 0
199.99.1.0 2.2.2.2 1359 0x80000001 0x00D299 0
本文出自 “ Uione” 博客,请务必保留此出处 http://weiqijun.blog.51cto.com/338163/74340