H3C设备之OSPF的配置

东坡下载 2012年02月06日 12:05:13

      一、基本信息配置

      二、链路配置及调测

      三、OSPF多区域及RIP配置

      四、OSPF重分布外部路由及下发缺省路由

      五、OSPF特殊区域配置及路由汇总

      六、OSPF虚链路

      七、OSPF认证

      八、OSPF调试命令

      一.基本信息配置

      system-view //进入系统视图

      [H3C]sysname RT3 //为设备命名

      [RT3]super password simple H3C //设置超级密码

      [RT3]local-user admin //添加用户

      [RT3-luser-admin]password simple admin //为用户设定密码

      [RT3-luser-admin]service-type telnet //指定用户的类型

      [RT3-luser-admin]quit //返回上一级

      [RT3]user-interface vty 0 4 //进入vty

      [RT3-ui-vty0-4]set authentication password simple telnet

      //设置远程登陆认证,密码为telnet

      [RT3-ui-vty0-4]idle-timeout 5 0 //配置超时退出时间

      其它略

      二、链路配置及调测

      interface Serial0/2/0

      ip address 10.1.13.2 255.255.255.252

      undo shutdown

      interface LoopBack0

      ip address 3.3.3.3 255.255.255.255

      undo shutdown

      interface Ethernet0/1/0

      ip address 10.1.3.1 255.255.255.0

      undo shutdown

      其它略

      三、OSPF多区域及RIP配置

      [RT3]

      ospf 1 router-id 3.3.3.3 //配置OSPF ROUTER-ID

      silent-interface all //配置所有端口为被动接口

      undo silent-interface Serial0/2/0 //关闭此接口的被动接口

      undo silent-interface Serial0/2/2

      area 1 //OSPF区域,可以写成点分十进制 0.0.0.1

      network 3.3.3.3 0.0.0.0 //宣告OSPF的网段

      network 10.1.13.0 0.0.0.3

      network 10.1.3.0 0.0.0.255

      [RT1]

      ospf 1 router-id 1.1.1.1

      silent-interface all

      undo silent-interface Serial0/2/0

      undo silent-interface Serial0/2/2

      area 0

      network 10.0.15.0 0.0.0.3

      network 1.1.1.1 0.0.0.0

      area 1

      network 10.1.13.0 0.0.0.3

      network 10.1.1.0 0.0.0.255

      [RT5]

      ospf 1 router-id 5.5.5.5

      silent-interface all

      undo silent-interface Serial0/2/0

      undo silent-interface Serial0/2/2

      area 0

      network 10.0.15.0 0.0.0.3

      network 5.5.5.5 0.0.0.0

      network 10.0.5.0 0.0.0.255

      network 10.0.56.0 0.0.0.3

      [RT6]

      ospf 1 router-id 6.6.6.6

      silent-interface all

      undo silent-interface Serial0/2/0

      undo silent-interface Serial0/2/2

      area 0

      network 10.0.56.0 0.0.0.3

      network 6.6.6.6 0.0.0.0

      area 2

      network 10.2.6.0 0.0.0.255

      network 10.2.26.0 0.0.0.3

      [RT2]

      ospf 1 router-id 2.2.2.2

      silent-interface all

      undo silent-interface Serial0/2/2

      area 2

      network 10.2.26.0 0.0.0.3

      network 2.2.2.2 0.0.0.0

      network 10.2.2.1 0.0.0.255

      rip //启动RIP

      undo summary //关闭自动汇总

      version 2 //RIPV2

      network 172.16.0.0 //宣告RIP的网段

      silent-interface all //配置所有接口为被动接口

      undo silent-interface Serial0/2/3 //将接口不设为被动接口

      [RT4]

      rip

      undo summary

      version 2

      network 172.16.0.0

      network 4.0.0.0

      silent-interface all

      undo silent-interface Serial0/2/1

      四、OSPF重分布外部路由及下发缺省路由

      [RT5]

      ospf 1

      area 0

      import-route direct cost 1000 type 2 //重分布直连路由

      default-route-advertise always //下发缺省路由

      default cost 2000 //指定缺省路由的COST为2000

      default type 1 //指定下发的缺省路由为类型1

      [RT2]

      ospf 1

      area 2

      import-route rip 1 cost 1000 //重分布RIP到OSPF

      rip

      import-route ospf 1 cost 5 //重分布OSPF到RIP

      五、OSPF特殊区域配置及路由汇总

      [RT3]ospf 1

      area 1

      stub //配置为STUB区域

      [RT1]ospf 1

      area 1

      stub no-summary //配置完全STUB区域

      abr-summary 10.1.0.0 255.255.0.0 //区域内汇总

      [RT6]ospf 1

      area 2

      nssa no-summary //配置完全NSSA区域

      abr-summary 10.2.0.0 255.255.0.0 //区域内汇总

      [RT2]ospf 1

      area 2

      nssa //配置NSSA区域

      asbr-summary 172.16.0.0 255.255.0.0 cost 1000 //外部路由汇总

      六、OSPF虚链路

      system-view

      [Sysname] ospf 100

      [Sysname-ospf-100] area 2

      [Sysname-ospf-100-area-0.0.0.2] vlink-peer 1.1.1.1 指定对方的ROUTER-ID

      [Sysname-ospf-100-area-0.0.0.2]vlink-peer 1.1.1.1 md5 10 cipher H3C 虚链路MD5认证

      vlink-peer 1.1.1.1 simple cipher H3C 虚链路明文认证

      虚链路的另一端也类似配置

      display ospf vlink //显示虚链路

      七、OSPF认证

      [RT1]ospf 1

      [RT1ospf-1]area 1

      [RT1-ospf-1-area-0.0.0.1]authentication-mode md5

      [RT1-ospf-1-area-0.0.0.1]quit

      [RT1-ospf-1]quit

      [RT1]int s0/2/0

      [RT1-Serial0/2/0]ospf authentication-mode md5 10 cipher H3C

      [RT3]ospf 1

      [RT3ospf-1]area 1

      [RT3-ospf-1-area-0.0.0.1]authentication-mode md5

      [RT3-ospf-1-area-0.0.0.1]quit

      [RT3-ospf-1]quit

      [RT3]int s0/2/0

      [RT3-Serial0/2/0]ospf authentication-mode md5 10 cipher H3C

      或是采用明文认证,配置方法与上类似

      authentication-mode simple

      ospf authentication-mode simple cipher H3C

      八、OSPF调测调试命令

      display ospf brief //显示OSPF的摘要信息

      display ospf cumulative //OSPF的统计信息

      display ospf interface //显示OSPF的接口信息

      display ospf peer //显示OSPF的邻居信息

      display ospf lsdb //显示OSPF的LSDB

      display ospf routing //显示OSPF的路由信息

      display ospf error //显示OSPF的错误信息

      reset ospf process //重启OSPF进程

      其它命令

      int e0/2/0

      ospf cost 1000 //修改OSPF的COST值 COST=10的8次方/带宽

      ospf network broadcast|nbma |p2mp |p2p //修改OSPF的网络类型

      ospf dr-priority 10 //修改接口的优先级,缺省为1

      关于本文中所涉及的理论及OSPF的相关细节分析,请参考OSPF多区域数据流分析http://tangfangxiao.blog.51cto.com/2116646/632997

      注意:如拓扑图中,在RT2上重分布RIP,H3C与CISCO是有区别的,在CISCO中,重分布RIP后能够学习到172.16.24.0/30的外部路由,而在H3C中需要重分布直连才能学习得到。

      H3C与CISCO的路由协议管理距离的区别:

      CISCO

      H3C