分享

OSPF协议配置

 liunffy 2007-05-05

全局设置 

注:(1)、OSPF路由进程process-id必须指定范围在1-65535,多个OSPF进程可以在同一个路由器上配置,但最好不这样做。多个OSPF进程需要多个OSPF数据库的副本,必须运行多个最短路径算法的副本。process-id只在路由器内部起作用,不同路由器的process-id可以不同。

( 2)、wildcard-mask 是子网掩码的反码, 网络区域ID area-id在0-4294967295内的十进制数,也可以是带有IP地址格式的x.x.x.x。当网络区域ID为0或0.0.0.0时为主干域。不同网络区域的路由器通过主干域学习路由信息。

2.基本配置举例:

interface ethernet 0 

ip address 192.1.0.129 255.255.255.192 



interface serial 0 

ip address 192.200.10.5 255.255.255.252 



router ospf 100 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.128 0.0.0.63 area 1 



Router2: 

interface ethernet 0 

ip address 192.1.0.65 255.255.255.192 



interface serial 0 

ip address 192.200.10.6 255.255.255.252 



router ospf 200 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.64 0.0.0.63 area 2 



Router3: 

interface ethernet 0 

ip address 192.1.0.130 255.255.255.192 



router ospf 300 

network 192.1.0.128 0.0.0.63 area 1 



Router4: 

interface ethernet 0 

ip address 192.1.0.66 255.255.255.192 



router ospf 400 

network 192.1.0.64 0.0.0.63 area 1 



相关调试命令: 

debug ip ospf events 

debug ip ospf packet 

show ip ospf 

show ip ospf database 

show ip ospf interface 

show ip ospf neighbor 

show ip route  

3. 使用身份验证 

为了安全的原因,我们可以在相同OSPF区域的路由器上启用身份验证的功能,只有经过身份验证的同一区域的路由器才能互相通告路由信息。 

在默认情况下OSPF不使用区域验证。通过两种方法可启用身份验证功能,纯文本身份验证和消息摘要(md5)身份验证。纯文本身份验证传送的身份验证口令为纯文本,它会被网络探测器确定,所以不安全,不建议使用。而消息摘要(md5)身份验证在传输身份验证口令前,要对口令进行加密,所以一般建议使用此种方法进行身份验证。

使用身份验证时,区域内所有的路由器接口必须使用相同的身份验证方法。为起用身份验证,必须在路由器接口配置模式下,为区域的每个路由器接口配置口令。

以下列举两种验证设置的示例,示例的网络分布及地址分配环境与以上基本配置举例相同,只是在Router1和Router2的区域0上使用了身份验证的功能。

 例1.使用纯文本身份验证  

Router1: 

interface ethernet 0 

ip address 192.1.0.129 255.255.255.192 



interface serial 0 

ip address 192.200.10.5 255.255.255.252 

ip ospf authentication-key cisco 



router ospf 100 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.128 0.0.0.63 area 1 

area 0 authentication 



Router2: 

interface ethernet 0 

ip address 192.1.0.65 255.255.255.192 



interface serial 0 

ip address 192.200.10.6 255.255.255.252 

ip ospf authentication-key cisco   



router ospf 200 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.64 0.0.0.63 area 2 

area 0 authentication 

!   

例2.消息摘要(md5)身份验证:   

Router1: 

interface ethernet 0 

ip address 192.1.0.129 255.255.255.192 



interface serial 0 

ip address 192.200.10.5 255.255.255.252 

ip ospf message-digest-key 1 md5 cisco 



router ospf 100 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.128 0.0.0.63 area 1 

area 0 authentication message-digest 



Router2: 

interface ethernet 0 

ip address 192.1.0.65 255.255.255.192 



interface serial 0 

ip address 192.200.10.6 255.255.255.252 

ip ospf message-digest-key 1 md5 cisco 



router ospf 200 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.64 0.0.0.63 area 2 

area 0 authentication message-digest 



相关调试命令: 

debug ip ospf adj 

debug ip ospf events 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多