拓扑说明 :
1.     IP 地址的规划
路由器号
端口号及 IP
 
R1
S1/0 :172.16.61.1
S2/0 :172.16.41.1
F0/0 :172.16.12.1
 
R2
 
F0/0 :172.16.12.2
S1/0 :172.16.23.2
Loopback:172.16.22.2
 
R3
S0/0 :172.16.23.3
S1/0 :172.16.35.3
R4
S0/1 :172.16.41.4
R5
S0/0 :172.16.35.5
R6
S0/0 :172.16.61.6
2.     区域说明
范围
区域号
区域类型
R6(S0/0) —— R1(S1/0)
30
totally stubby
R1(F0/0) —— R2(F0/0)
0
骨干区域
R4(S0/1) —— R1(S2/0)
10
stub
R2(S1/0) —— R3(S0/0)
20
nssa
R2 (Loopback)
40
标准区域
: R3(S1/0) ——R5(S0/0) RIP AS
 
实验步骤及说明
r1#show run
Building configuration...
Current configuration : 559 bytes
version 12.2
no service password-encryption
!
hostname r1
ip ssh version 1
!
interface FastEthernet0/0
 ip address 172.16.12.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 172.16.61.1 255.255.255.0
!
interface Serial2/0
 ip address 172.16.41.1 255.255.255.0
!
router ospf 8         // 开启ospf 进程
 log-adjacency-changes
 area 10 stub        // 宣告区域 10 stub 区域
 area 30 stub no-summary    // 宣告区域 30 totally stubby 区域
 network 172.16.12.0 0.0.0 .255 area 0  // 宣告 172.16.12.0 网段
 network 172.16.41.0 0.0.0 .255 area 10 // 宣告 172.16.41.0 网段
 network 172.16.61.0 0.0.0 .255 area 30  // 宣告 172.16.61.0 网段 ( 以下略同 )
!
ip classless
!
line con 0
line vty 0 4
 login
!
End
 
r2#show run
Building configuration...
 
Current configuration : 552 bytes
!
version 12.2
no service password-encryption
!
hostname r2
!
!
ip ssh version 1
!
!
interface Loopback0
 ip address 172.16.22.2 255.255.255.0
!
interface FastEthernet0/0
 ip address 172.16.12.2 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 172.16.23.2 255.255.255.0
 clock rate 64000  // 时钟速率
!
router ospf 8
 log-adjacency-changes
 area 20 nssa      // 宣告区域 20 nssa 区域
 network 172.16.12.0 0.0.0 .255 area 0
 network 172.16.23.0 0.0.0 .255 area 20
 network 172.16.22.0 0.0.0 .255 area 40
!
ip classless
!
line con 0
line vty 0 4
 login
!
end
r3#show run
Building configuration...
 
Current configuration : 594 bytes
!
version 12.2
no service password-encryption
!
hostname r3
!
ip ssh version 1
!
!
interface Serial0/0
 ip address 172.16.23.3 255.255.255.0
!
interface Serial1/0
 ip address 172.16.35.3 255.255.255.0
clock rate 64000  // 时钟速率
!
router ospf 8
 log-adjacency-changes
 area 20 nssa
 redistribute rip subnets  // RIP 注入到 OSPF
 network 172.16.23.0 0.0.0 .255 area 20
  default-information originate// OSPF 区域通告了一条永久的默认路由            
!
router rip
 version 2
 redistribute ospf 8    // OSPF 注入到 RIP
 network 172.16.0.0
 default-information originate
 no auto-summary
!
ip classless
ip route 0.0.0 .0 0.0.0.0 172.16.35.5
!
line con 0
line vty 0 4
 login
!
!
end
 
r4#show run
Building configuration...
 
Current configuration : 324 bytes
!
version 12.2
no service password-encryption
!
hostname r4
!
ip ssh version 1
!
interface Serial0/0
 ip address 172.16.41.4 255.255.255.0
 clock rate 64000
!
router ospf 8
 log-adjacency-changes
 area 10 stub
 network 172.16.41.0 0.0.0 .255 area 10
!
ip classless
!
line con 0
line vty 0 4
 login
!
!
End
 
r5#show run
Building configuration...
 
Current configuration : 313 bytes
!
version 12.2
no service password-encryption
!
hostname r5
!
ip ssh version 1
!
interface Serial0/0
 ip address 172.16.35.5 255.255.255.0
!
router rip
 version 2
 network 172.16.0.0
 no auto-summary
!
ip classless
ip route 0.0.0 .0 0.0.0.0 172.16.35.3 默认路由
!
line con 0
line vty 0 4
 login
!
End
 
r6#show run
Building configuration...
 
Current configuration : 335 bytes
!
version 12.2
no service password-encryption
!
hostname r6
!
ip ssh version 1
!
interface Serial0/0
 ip address 172.16.61.6 255.255.255.0
 clock rate 64000
!
router ospf 8
 log-adjacency-changes
 area 30 stub no-summary
 network 172.16.61.0 0.0.0 .255 area 30
!
ip classless
!
line con 0
line vty 0 4
 login
!
End