OSPF其它特性
只要有5类 LSA或7类 LSA产生就会产生LSA
静默接口/被动接口
启用找接口,PC机不会收到hello包了,不收到LSA报文了
[R2]ospf
[R2-ospf-1]silent-interface g0/0/1
引入默认路由
一般都是在和运营商连接的路由器上配置
这条命令,会产生一个5类 LSA,他的角色就会变成ASBR
//总是下发默认路由
[R1-ospf-1]default-route-advertise always
配置不加always,要想下发默认路由的前提是本身自己要有一条默认路由
[R1]ip route-static 0.0.0.0 0.0.0.0 xx外部ip地址 //下发默认路由 [R1-ospf-1]default-route-advertise
路由汇总
作用:通过汇总LSA,达到减少路由表的条目,减轻路由器负担
区域内的路由由ABR做汇总
区域外的路由由ASBR做汇总
汇总遵循的原则:
- 谁产生的LSA 由谁汇总
练习把R7设备上的3跳路由进行汇总
做好模拟
[R7]dis ip int bri
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 22.1.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 7.7.7.7/32 up up(s)
LoopBack1 7.7.7.8/32 up up(s)
LoopBack2 7.7.7.9/32 up up(s)
NULL0 unassigned up up(s)
[R7-ospf-1-area-0.0.0.2]dis this
[V200R003C00]
#
area 0.0.0.2
network 7.7.7.0 0.0.0.255
network 22.1.1.0 0.0.0.255
#
查看LSB的LSA路由表,发现每条3类 LSA都会占用area 0区域的数据库
现在汇总起来,ABR上操作
[R2]ospf
[R2-ospf-1]area 2
[R2-ospf-1-area-0.0.0.2]abr-summary 7.7.7.0 255.255.255.0
ABE再次查看一下
如果是ASBR汇总,汇总命令
[R7]ospf
[R7-ospf-1]asbr-summary 7.7.7.0 255.255.255.0
注意事项:
- 路由汇总的时候如果存在默认路由就会产生环路,所以要加一条null0路由
//在R7上配置,不在ABR上
[R7]ip route-static 7.7.7.0 24 NULL 0
OSPF认证
认证方式
- 区域认证:就是批量的接口认证
- 接口认证:在接口视图下配置,对本接口所有报文进行认证
认证类型
- 空认证:不进行认证
- 简单认证:这是一种简单的加密方式,将配置的密码直接加入报文中,这种加密方式安全性不高
- 密文认证:通过将配置的密码进行MD5等加密算法之后再加入报文中,这样提高了密码的安全性
启用认证,只有通过OSPF认证的路由器才可以正常建立邻居关系
接口认证练习
明文认证
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf authentication-mode ?
hmac-md5 Use HMAC-MD5 algorithm
keychain Keychain authentication mode //秘钥串
md5 Use MD5 algorithm //密文认证
null Use null authentication //不认证
simple Simple authentication mode //明文认证
配置明文认证,这里的加密不加密指的是dis this看到的密码是否加密了,不是封包的时候加密
[R1-GigabitEthernet0/0/0]ospf authentication-mode simple ? STRING<1-8>/<32> The password (key) cipher Encryption type (Cryptogram) //加密 plain Encryption type (Plain text) //不加密 <cr> Please press ENTER to execute command
密文认证
两端设备的 Key ID要一样,密码的ID号码
[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 ?
INTEGER<1-255> Key ID
<cr> Please press ENTER to execute command
//密码想不想被 dis this命令看到,默认是看不到 [R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 ? STRING<1-255>/<20-392> The password (key) cipher Encryption type (Cryptogram) plain Encryption type (Plain text)
[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher xx
[R1-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
ospf authentication-mode md5 1 cipher %$%$/48^&M-ty~[$^\."TdL@U[YB%$%$
#
return
区域认证练习
认证指定区域里设备的所有接口,区域里的所有设备都要做认证
[R1]ospf [R1-ospf-1]area 0 [R1-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher xx //R2 area 0区域 [R2]ospf [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher xx //R3 area 0区域 [R3]ospf [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher xx
查看邻居状态
[R3-ospf-1-area-0.0.0.0]dis ospf peer bri OSPF Process 1 with Router ID 12.1.1.3 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/0 12.1.1.1 Full 0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full 0.0.0.1 GigabitEthernet0/0/1 24.1.1.2 Full ----------------------------------------------------------------------------
OSPF路由表为空的第二种原因
等两边OSPF认证类型不一致的时候会导致路由表为空
先查看邻居状态
[R1]dis ospf peer bri OSPF Process 1 with Router ID 12.1.1.1 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full 0.0.0.0 GigabitEthernet0/0/0 12.1.1.3 Full ----------------------------------------------------------------------------
只在一边的接口做了OSPF认证,查看邻居状态
[R1-GigabitEthernet0/0/0]dis ospf peer bri
OSPF Process 1 with Router ID 12.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
----------------------------------------------------------------------------
继续阅读

我的微信
这是我的微信扫一扫
评论