目录
扫描二维码关注公众号,回复:
17030480 查看本文章
基于第二张图片配置
R1:
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/0/0
ip address 192.168.1.1 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
area 1 nssa
redistribute connected subnets
network 192.168.1.0 0.0.0.255 area 1
!
R2:
!
interface Serial0/0/0
ip address 192.168.1.2 255.255.255.0
!
interface Serial0/0/1
ip address 10.1.1.1 255.255.255.252
clock rate 2000000
!
interface Serial0/1/0
ip address 10.1.4.1 255.255.255.252
clock rate 2000000
!
router ospf 1
log-adjacency-changes
area 1 nssa
network 192.168.1.0 0.0.0.255 area 1
network 10.1.4.0 0.0.0.3 area 0
network 10.1.1.0 0.0.0.3 area 0
!
R3:
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 192.168.2.2 255.255.255.0
!
interface Serial0/0/1
ip address 10.1.3.1 255.255.255.252
!
interface Serial0/1/0
ip address 10.1.4.2 255.255.255.252
!
router ospf 1
log-adjacency-changes
area 2 nssa no-summary
network 10.1.4.0 0.0.0.3 area 0
network 10.1.3.0 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 2
!
R4:
!
interface Serial0/0/0
ip address 10.1.2.2 255.255.255.252
!
interface Serial0/0/1
ip address 10.1.3.2 255.255.255.252
clock rate 2000000
!
interface Serial0/1/0
ip address 192.168.3.2 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
area 3 stub no-summary
network 10.1.2.0 0.0.0.3 area 0
network 10.1.3.0 0.0.0.3 area 0
network 192.168.3.0 0.0.0.255 area 3
!
R5:
!
interface Serial0/0/0
ip address 10.1.1.2 255.255.255.252
!
interface Serial0/0/1
ip address 10.1.2.1 255.255.255.252
clock rate 2000000
!
interface Serial0/1/0
ip address 192.168.4.2 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
area 4 stub
network 10.1.1.0 0.0.0.3 area 0
network 10.1.2.0 0.0.0.3 area 0
network 192.168.4.0 0.0.0.255 area 4
!
R6:
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial0/0/0
ip address 192.168.2.1 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
area 2 nssa
redistribute connected subnets
network 192.168.2.0 0.0.0.255 area 2
!
R7:
!
interface Serial0/0/0
ip address 192.168.4.1 255.255.255.0
!
router ospf 1
log-adjacency-changes
area 4 stub
network 192.168.4.0 0.0.0.255 area 4
!
R8:
!
interface Serial0/0/0
ip address 192.168.3.1 255.255.255.0
!
router ospf 1
log-adjacency-changes
area 3 stub
network 192.168.3.0 0.0.0.255 area 3
!
了解LSA
LSA类型代码 |
描述 |
1 |
路由器LSA |
2 |
网络LSA |
3 |
网络汇总LSA |
4 |
ASBR汇总LSA |
5 |
AS外部LSA |
6 |
组成员LSA |
7 |
NSSA外部LSA |
lsa_百度百科 (baidu.com)https://baike.baidu.com/item/lsa/8860267?fr=aladdin
查看路由表: show ip route ospf
路由指示符 | 路由类型 |
O | OSPF区域内路由 |
O IA | OSPF区域间路由 |
O E1 | 1类外部路由 |
O E2 | 2类外部路由 |
OSPF区域内可能存在的LSA类型
骨干区域 | 1、2、3、4、5 |
标准区域 | 1、2、3、4、5 |
stub区域 | 1、2、3、3类默认 |
完全stub区域 | 1、2、3类默认 |
nssa区域 | 1、2、3、7 |
完全nssa区域 | 1、2、7、3类默认 |
Virtual-link配置
R0:
router ospf 1
log-adjacency-changes
network 192.168.1.0 0.0.0.255 area 2
R1:
router ospf 1
log-adjacency-changes
area 1 virtual-link 3.3.3.3
network 192.168.1.0 0.0.0.255 area 2
network 192.168.2.0 0.0.0.255 area 1
R2:
router ospf 1
log-adjacency-changes
area 1 virtual-link 2.2.2.2
network 192.168.2.0 0.0.0.255 area 1
network 192.168.3.0 0.0.0.255 area 0
R3:
router ospf 1
log-adjacency-changes
network 192.168.3.0 0.0.0.255 area 0
//R1路由表
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1/32 is directly connected, Loopback0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/0
L 192.168.1.1/32 is directly connected, GigabitEthernet0/0
O IA 192.168.2.0/24 [110/2] via 192.168.1.2, 00:16:49, GigabitEthernet0/0 //2.0、3.0都来了
O IA 192.168.3.0/24 [110/3] via 192.168.1.2, 00:03:08, GigabitEthernet0/0
身份验证
-
接口验证
明文:
Router(config-if)#ip ospf authentication-key password
Router(config-if)#ip ospf authentication
密文:
Router(config-if)#ip ospf message-digest-key keyID md5 password
Router(config-if)#ip ospf authentication message-digest
-
区域验证
路由汇总
R0:
router ospf 1
log-adjacency-changes
redistribute connected subnets
network 192.168.1.0 0.0.0.255 area 1
R1:
router ospf 1
log-adjacency-changes
network 192.168.1.0 0.0.0.255 area 1
network 192.168.2.0 0.0.0.255 area 0
R2:
router ospf 1
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 2
R3:
router ospf 1
log-adjacency-changes
network 192.168.3.0 0.0.0.255 area 2
//可以看到R3的路由表太多了
O E2 10.1.1.0/24 [110/20] via 192.168.3.1, 00:00:59, GigabitEthernet0/0
O E2 10.1.2.0/24 [110/20] via 192.168.3.1, 00:00:59, GigabitEthernet0/0
O E2 10.1.3.0/24 [110/20] via 192.168.3.1, 00:00:39, GigabitEthernet0/0
//汇总一下
R0:
router ospf 1
summary-address 10.1.0.0 255.255.0.0
********************************************
********************************************
//还有一种ABR汇总
R0:
Router(config-router)#net 10.1.1.0 0.0.0.255 a 1
Router(config-router)#net 10.1.2.0 0.0.0.255 a 1
Router(config-router)#net 10.1.3.0 0.0.0.255 a 1
//R3可以看到
O IA 10.1.1.1/32 [110/4] via 192.168.3.1, 00:01:23, GigabitEthernet0/0
O IA 10.1.2.1/32 [110/4] via 192.168.3.1, 00:01:23, GigabitEthernet0/0
O IA 10.1.3.1/32 [110/4] via 192.168.3.1, 00:01:23, GigabitEthernet0/0
//汇总一下
R1:
Router(config-router)#area 1 range 10.1.0.0 255.255.0.0
//R3上可以看到
O IA 10.1.0.0/16 [110/4] via 192.168.3.1, 00:01:03, GigabitEthernet0/0