拓撲說明:
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