OSPF配置命令

一)常用:
router ospf 1 
router-id 1.1.1.1
network 1.1.1.1 0.0.0.0 area 0

二)配置特殊区域
area 1 stub
area 1 default-cost 5                 ///将下发的默认路由的cost设置为5,默认是1
area 1 stub no-summary           ///totally stub
area 1 nssa
area 1 nssa default-information-originate     //NSSA下发默认路由
area 1 nssa default-information-originate metric6 metric-type 1           Metric-type 1的作用是将N2类型的路由改为N1类型的路由
area 2 nssa no-redistribution         在ABR上做,阻止ABR上所直连的其它外部区域的路由进入nssa区域
area 1 nssa no-summary               ///totally NSSA

三)配置认证:
1)接口 认证:
  明文认证:
      interface f0/0
      ip ospf authentication-key password 
       ip ospf authentication
  密文认证:
       interface f0/0
       ip ospf message-digest-key 1 md5 passwork 
          ip ospf authentication message-digest
2)区域认证:
  明文认证:
       interface f0/0
       ip ospf authentication-key password
       router ospf 1
       area 1 authentication
  密文认证:
       interface f0/0
       ip ospf message-digest-key 1 md5 password
       router ospf 1
       area 0 authentication message-digest

四)配置被动接口
1)单个配置:
 Router(config-router)#passive-interface f0/0
2)被动接口较多时配置:--先将所有接口设置为被动接口,在设置特定接口为非被动接口
 Router(config-router)#passive-interface default 
 Router(config-router)#no passive-interface f0/0

五)汇总路由
1)外部路由汇总:---在ASBR上配置
 router ospf 1
 summary-address 10.1.0.0 255.255.0.0
2)区域间路由汇总:---在ABR上配置
 router ospf 1
 area 2 range 172.16.0.0 255.255.0.0 cost 1

六)修改ospf 优先级、Hello时间、失效时间、带宽、开销
 interface f0/0
 ip ospf priority 0
 ip ospf hello-interval 10
 ip ospf dead-interval 40
 bandwidth 5000
 ip ospf cost 30

七)下发默认路由
1)在有默认路由的情况下--只有存在默认路由才会下发,默认路由失效,下发的默认路由也会失效
  router ospf 1
  default-information originate
2)在没有默认路由的情况下--无论是否存在默认路由,都会下发,且当默认路由失效后,也不会消失
  router ospf 1
  default-information originate always

八)Tunnel
R2(config)#int tunnel 23
R2(config-if)#tunnel source 2.2.2.2  
R2(config-if)#tunnel destination 3.3.3.3
R2(config-if)#ip address 23.1.1.2 255.255.255.0  
R2(config-if)#ip ospf 100 area 2

九)Virtual Link
在配置虚链路的两端配置如下命令
area 2 virtual-link 4.4.4.4

十)修改路由AD值
router ospf 1
///100为修改的AD值,4.4.4.4 是源IP,0.0.0.0是反掩码,66是ACL--ACL匹配的收到的路由才会生效(该命令对所有协议都适用,但AD值只在本地有效)
distance 100 4.4.4.4 0.0.0.0 66
十一)排错常用命令
debug ip ospf adj  ///查看ospf邻接形成过程
debug ip ospf events   //调试所有ospf事件
show ip ospf neighbor   ///查看ospf邻居
show ip ospf interface   ///查看接口OSPF相关信息
show interface    ///查看接口
show ip ospf database   ///查看OSPF的LSDB
show ip route     ///查看路由表
show ip route ospf   ///查看ospf的路由表
show ip protocols    ///查看当前正在运行的路由协议的详细信息
show ip ospf border-routers    ///可以看到ASBR和ABR,但不能看到自已的角色,只能看到其它路由器的角色
show ip ospf virtual-link   //查看virtual-link

十二)其他
clear ip ospf process       重新启动OSPF路由选择进程


欢迎补充!!

  • 5
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值