通过前面的学习我们已经了解了OSPF的基本概念,今天我们主要以实验为主,来进行OSPF的最后一篇《OSPF三部曲(之)东方不败-OSPF的高级配置》。
实验一、 OSPF的辅助地址
使用辅助地址的两个规则
1、只有在主网络或子网(primary network or subnet)也运行OSPF协议的时候,OSPF才会通告一个辅助网络或辅助子网
2、辅助地址是末梢网络,不会发送Hello报文,在辅助网络上无法建立邻接关系
3、实验拓扑图
4、实验配置
hostname R1
interface e0/0
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
interface e0/1
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.1.0 0.0.0.255 area 1
network 192.168.2.0 0.0.0.255 area 1
exit
exit
write
!
hostname R2
interface e0/0
ip address 192.168.2.2 255.255.255.0
no shutdown
exit
interface e0/1
ip address 192.168.3.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.2.0 0.0.0.255 area 1
network 192.168.3.1 0.0.0.0 area 0
exit
exit
write
!
hostname R3
interface e0/0
ip address 192.168.3.2 255.255.255.0
no shutdown
exit
interface e0/1
ip address 192.168.4.1 255.255.255.0
ip address 172.16.1.1 255.255.0.0 secondary
no shutdown
exit
router ospf 100
redistribute rip
network 192.168.3.2 0.0.0.0 area 0
network 192.168.4.1 0.0.0.0 area 0
exit
router rip
redistribute ospf 100 metric 10
network 172.16.0.0
exit
exit
write
!
hostname R4
interface e0/0
ip address 172.16.1.2 255.255.0.0
no shutdown
exit
interface e0/1
ip address 192.168.5.1 255.255.255.0
no shutdown
exit
router rip
network 172.16.0.0
network 192.168.5.0
exit
exit
write
!
实验二、OSPF的地址汇总
1、地址汇总也是通过减少泛洪的LSA数量节省资源
2、可以通过屏蔽一些网络不稳定的细节来节省资源
3、在Cisco的路由器上可以执行两种类型的地址汇总
a、区域间路由汇总
b、外部路由汇总
4、实验拓扑图
5、实验配置
hostname R1
interface f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.1.0 0.0.0.255 area 1
exit
exit
write
!
hostname R2
interface f0/0
ip address 192.168.2.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.2.0 0.0.0.255 area 1
exit
exit
write
!
hostname R3
interface f0/0
ip address 192.168.3.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.3.0 0.0.0.255 area 1
exit
exit
write
!
hostname R4
interface f0/0
ip address 192.168.4.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.4.0 0.0.0.255 area 1
exit
exit
write
!
hostname R5
interface f0/0
ip address 192.168.5.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.5.0 0.0.0.255 area 1
exit
exit
write
!
hostname sw_3L
ip routing
interface f0/1
no switchport
ip address 192.168.1.2 255.255.255.0
no shutdown
interface f0/2
no switchport
ip address 192.168.2.2 255.255.255.0
no shutdown
interface f0/3
no switchport
ip address 192.168.3.2 255.255.255.0
no shutdown
interface f0/4
no switchport
ip address 192.168.4.2 255.255.255.0
no shutdown
interface f0/5
no switchport
ip address 192.168.5.2 255.255.255.0
no shutdown
interface f0/6
no switchport
ip address 192.168.100.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.0.0 0.0.7.255 area 1
network 192.168.100.0 0.0.0.255 area 0
area 1 range 192.168.0.0 255.255.248.0
ip route 192.168.0.0 255.255.248.0 Null0
exit
exit
write
!
hostnamr R6
interface f0/0
ip address 192.168.100.2 255.255.255.0
no shutdown
exit
interface f0/1
ip address 192.168.200.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.100.0 0.0.0.255 area 0
network 192.168.200.0 0.0.0.255 area 2
exit
exit
write
!
hostname R7
interface f0/0
ip address 192.168.200.2 255.255.255.0
no shutdown
interface f0/1
ip address 172.16.1.1 255.255.255.0
no shutdown
interface e1/0
ip address 172.16.2.1 255.255.255.0
no shutdown
interface e1/1
ip address 172.16.3.1 255.255.255.0
no shutdown
interface e1/2
ip address 172.16.4.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.200.0 0.0.0.255 area 2
network 172.16.0.0 0.0.7.255 area 2
area 2 range 172.16.0.0 255.255.248.0
ip route 172.16.0.0 255.255.248.0 Null0
exit
exit
write
!
hostname R8
interface f0/0
ip address 172.16.1.2 255.255.255.0
no shutdown
exit
router ospf 100
network 172.16.1.0 0.0.0.255 area 2
exit
exit
write
!
hostname R9
interface f0/0
ip address 172.16.2.2 255.255.255.0
no shutdown
exit
router ospf 100
network 172.16.2.0 0.0.0.255 area 2
exit
exit
write
!
hostname R10
interface f0/0
ip address 172.16.3.2 255.255.255.0
no shutdown
exit
router ospf 100
network 172.16.3.0 0.0.0.255 area 2
exit
exit
write
!
hostname R11
interface f0/0
ip address 172.16.4.2 255.255.255.0
no shutdown
exit
router ospf 100
network 172.16.4.0 0.0.0.255 area 2
exit
exit
write
!
实验三、OSPF的路由重分发
1、地址汇总也是通过减少泛洪的LSA数量节省资源
2、可以通过屏蔽一些网络不稳定的细节来节省资源
3、在Cisco的路由器上可以执行两种类型的地址汇总
4、区域间路由汇总
5、外部路由汇总
6、实验拓扑图
7、实验配置
hostname R1
int f0/0
ip add 192.168.1.1 255.255.255.0
no sh
int s0/0
clock rate 128000
ip add 192.168.2.1 255.255.255.0
no sh
int s0/1
clock rate 128000
ip add 192.168.6.2 255.255.255.0
no shut
exit
router rip
network 192.168.1.0
redistribute ospf 100 metric 10
router ospf 100
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 0
redistribute rip subnets
exit
exit
write
!
hostname R2
int f0/0
ip add 192.168.3.1 255.255.255.0
no sh
int s0/0
clock rate 128000
ip add 192.168.2.2 255.255.255.0
no sh
int s0/1
clock rate 128000
ip add 192.168.4.1 255.255.255.0
no shut
exit
router rip
network 192.168.3.0
redistribute ospf 100 metric 10
router ospf 100
network 192.168.2.0 0.0.0.255 area 0
network 192.168.4.0 0.0.0.255 area 0
redistribute rip subnets
exit
exit
write
!
hostname R3
int f0/0
ip add 192.168.5.1 255.255.255.0
no sh
int s0/0
clock rate 128000
ip add 192.168.6.1 255.255.255.0
no sh
int s0/1
clock rate 128000
ip add 192.168.4.2 255.255.255.0
no shut
exit
router rip
network 192.168.5.0
redistribute ospf 100 metric 10
router ospf 100
network 192.168.4.0 0.0.0.255 area 0
network 192.168.6.0 0.0.0.255 area 0
redistribute rip subnets
exit
exit
write
!
实验四、OSPF的虚链路
1、OSPF多域配置时的限制
a、骨干区域area 0必须存在
b、非骨干区域之间通信时都必须先连接到骨干区域
2、当OSPF网络已经设计好后,有新的区域添加进来,可能会产生这样的情况
a、不可能通过直连链路连接到骨干区域
b、为了符合上面的要求,虚链路被提了出来
3、配置虚链路的几条相关的规则:
a、虚链路必须配置在两台ABR路由器之间
b、配置了虚链路所经过的区域必须拥有全部的路由选择信息,这样的区域又被称为传送区域(Transit Area)
c、传送区域不能是一个末梢区域
4、实验拓扑图
5、实验配置
hostname R1
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
exit
interface e0/1
ip address 200.200.200.1 255.255.255.0
no shutdown
exit
interface e0/0
clock rate 128000
ip address 192.168.1.1 255.255.255.0
no shutdown
router ospf 100
network 200.200.200.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
exit
exit
write
!
hostname R2
no ip domain-lookup
line console 0
exec-timeout 00
logging synchronous
exit
interface loopback 0
ip address 192.168.100.100 255.255.255.0
exit
interface e0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
exit
interface e0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.1.0 0.0.0.255 area 0
network 192.168.100.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 1
area 1 virtual-link 192.168.100.101
exit
exit
write
!
hostname R3
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
exit
interface e0/0
clock rate 128000
ip address 192.168.2.2 255.255.255.0
no shutdown
exit
interface e0/1
clock rate 128000
ip address 192.168.3.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.2.0 0.0.0.255 area 1
network 192.168.3.0 0.0.0.255 area 1
exit
exit
write
!
hostname R4
no ip domain-lookup
line console 0
exec-timeout 00
logging synchronous
exit
interface loopback 0
ip address 192.168.100.101 255.255.255.0
exit
interface e0/0
clock rate 128000
ip address 192.168.3.2 255.255.255.0
no shutdown
exit
interface e0/1
clock rate 128000
ip address 192.168.4.1 255.255.255.0
no shutdown
exit
router ospf 100
network 192.168.3.0 0.0.0.255 area 1
network 192.168.100.0 0.0.0.255 area 0
network 192.168.4.0 0.0.0.255 area 0
area 1 virtual-link 192.168.100.100
exit
exit
write
!
hostname R5
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
exit
interface e0/0
clock rate 128000
ip address 192.168.4.2 255.255.255.0
no shutdown
exit
interface e0/1
ip address 222.222.222.1 255.255.255.0
no shutdown
router ospf 100
network 192.168.4.0 0.0.0.255 area 0
network 222.222.222.0 0.0.0.255 area 0
exit
exit
write
!
通过以上四个实验的完成,OSPF的三部曲系列也就告以段落了,希望能够给大家带来帮助,谢谢!
本文出自 “爆发吧,我的小宇宙!” 博客,谢绝转载!