实验拓扑:

 

OSPF特殊区域之stub和totally stub配置(一)_第1张图片

实验过程:

 

1.R1的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R1

R1(config)#int lo0

R1(config-if)#ip add 172.16.1.1 255.255.255.0

R1(config-if)#exit

R1(config)#int s0/0

R1(config-if)#no shut

R1(config-if)#ip add 172.16.255.1 255.255.255.252

R1(config-if)#exit

2.R2的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R2

R2(config)#int s0/0

R2(config-if)#no shut

R2(config-if)#ip add 172.16.255.2 255.255.255.252

R2(config-if)#exit

R2(config)#int s0/1

R2(config-if)#no shut

R2(config-if)#ip add 172.16.255.5 255.255.255.252

R2(config-if)#exit

3.R3的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R3

R3(config)#int s0/1

R3(config-if)#no shut

R3(config-if)#ip add 172.16.255.6 255.255.255.252

R3(config-if)#exit

R3(config)#int s0/2

R3(config-if)#no shut

R3(config-if)#ip add 172.16.255.9 255.255.255.252

R3(config-if)#exit

R3(config)#int f1/0

R3(config-if)#no shut

R3(config-if)#ip add 192.168.1.1 255.255.255.0

R3(config-if)#exit

4.R4的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R4

R4(config)#int s0/2

R4(config-if)#no shut

R4(config-if)#ip add 172.16.255.10 255.255.255.0

R4(config-if)#exit

R4(config)#int lo0

R4(config-if)#ip add 172.16.2.1 255.255.255.0

R4(config-if)#exit

5.R5的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R5

R5(config)#int f1/0

R5(config-if)#no shut

R5(config-if)#ip add 192.168.1.2 255.255.255.0

R5(config-if)#exit

R5(config)#int lo0

R5(config-if)#ip add 10.1.1.1 255.0.0.0

R5(config-if)#exit

6.配置R1OSPF

R1(config)#router ospf 1

R1(config-router)#net 172.16.1.1 0.0.0.0 area 1

R1(config-router)#net 172.16.255.1 0.0.0.0 area 1

R1(config-router)#end

7.配置R2OSPF

R2(config)#router ospf 1

R2(config-router)#net 172.16.255.2 0.0.0.0 area 1

R2(config-router)#net 172.16.255.5 0.0.0.0 area 0

R2(config-router)#end

8.配置R3OSPFRIP

R3(config)#router ospf 1

R3(config-router)#net 172.16.255.6 0.0.0.0  area 0

R3(config-router)#net 172.16.255.9 0.0.0.0 area 0

R3(config-router)#exit

R3(config)#router rip

R3(config-router)#version 2

R3(config-router)#no auto

R3(config-router)#net 192.168.1.0

R3(config-router)#exit

R3(config)#router ospf 1

R3(config-router)#redistribute rip subnets metric 200  //rip重发布到OSPF网络中

R3(config-router)#exit

R3(config)#router rip

R3(config-router)#redistribute ospf 1 metric 10  //OSPF重发布到rip网络中

R3(config-router)#exit

R3(config)#end

9.配置R4OSPF

R4(config)#router ospf 1

R4(config-router)#net 172.16.255.10 0.0.0.0 area 0

R4(config-router)#net 172.16.2.1 0.0.0.0 area 2

R4(config-router)#end

10.配置R5RIP

R5(config)#router rip

R5(config-router)#version 2

R5(config-router)#no auto

R5(config-router)#net 192.168.1.0

R5(config-router)#net 10.0.0.0

R5(config-router)#end

11.查看R1的链路状态数据库

R1#show ip ospf da

 

            OSPF Router with ID (172.16.1.1) (Process ID 1)

 

                Router Link States (Area 1)  //1型的LSA

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

172.16.1.1      172.16.1.1      607         0x80000002 0x005FBD 3

172.16.255.5    172.16.255.5    608         0x80000001 0x0039AF 2

 

                Summary Net Link States (Area 1)  //3型的LSA

 

Link ID         ADV Router      Age         Seq#       Checksum

172.16.2.1      172.16.255.5    516         0x80000001 0x0042F7

172.16.255.0    172.16.255.5    519         0x80000001 0x00DA23

172.16.255.4    172.16.255.5    603         0x80000001 0x009BE1

172.16.255.8    172.16.255.5    529         0x80000001 0x00F543

 

                Summary ASB Link States (Area 1)  //4型的LSA

 

Link ID         ADV Router      Age         Seq#       Checksum

192.168.1.1     172.16.255.5    437         0x80000001 0x008648

 

                Type-5 AS External Link States  //5型的LSA

         

Link ID         ADV Router      Age         Seq#       Checksum Tag

10.0.0.0        192.168.1.1     442         0x80000001 0x005B1B 0

192.168.1.0     192.168.1.1     444         0x80000001 0x0021F4 0

12.查看R1的路由表

R1#show ip route ospf

     172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks

O IA    172.16.255.0/24 [110/256] via 172.16.255.2, 00:10:21, Serial0/0

O IA    172.16.255.4/30 [110/128] via 172.16.255.2, 00:11:45, Serial0/0

O IA    172.16.255.8/30 [110/192] via 172.16.255.2, 00:10:31, Serial0/0

O IA    172.16.2.1/32 [110/193] via 172.16.255.2, 00:10:18, Serial0/0

O E2 10.0.0.0/8 [110/200] via 172.16.255.2, 00:08:54, Serial0/0

O E2 192.168.1.0/24 [110/200] via 172.16.255.2, 00:08:54, Serial0/0

说明:O IA是区域间路由,O E2 是重发布的路由。

 

13.测试连通性

R1#ping 10.1.1.1

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 28/55/104 ms

R1#ping 172.16.2.1

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 32/74/120 ms