关于华为路由器OSPF协议配置的一些命令

单区域:关于华为路由器OSPF协议配置的一些命令_第1张图片
配置OSPF的区域认证:

[R1]ospf 1 router-id 10.0.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.0.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 10.0.4.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]authentication-mode simple plain ***

查看路由器运行的OSPF信息:display ospf brief
查看运行的OSPF邻居情况:display ospf peer brief
查看路由器的OSPF数据库信息:display ospf lsdb
查看一类LSA信息:display ospf lsdb router self-originate
查看二类LSA信息:display ospf lsdb network self-originate
重置OSPF进程:在用户视图下:reset ospf process 会重新选举DR和BDR
查看OSPF进程在loopback0下的状态信息:display ospf interface loopback 0 verbose
修改loopback 0的网络类型:

[R1]interface loopback 0
[R1-LoopBack0]ospf network-type broadcast/p2p

修改OSPF接口代价值:

[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ospf cost **

配置静默接口:

[R1]ospf 1
[R1-ospf-1]silent-interface g0/0/0

静默接口不接收和发送hello报文,且loopback0接口配置为静默接口不会影响ospf的发布
多区域:
关于华为路由器OSPF协议配置的一些命令_第2张图片
R1:

#
interface LoopBack0
 ip address 10.0.1.1 255.255.255.0 
 ospf network-type broadcast
#
interface LoopBack1
 ip address 10.1.0.1 255.255.255.0 
#
interface LoopBack2
 ip address 10.1.1.1 255.255.255.0 
#
ospf 1 router-id 10.0.1.1 
 asbr-summary 10.1.0.0 255.255.254.0   //将直连路由汇总
 import-route direct                   //引入直连路由
 preference 20                         //改变域内和域间路由优先级,默认10
 preference ase 50                     //改变外部路由优先级,默认150 
 bandwidth-reference 10000             //改变参考带宽
 area 0.0.0.2 
  network 10.0.1.1 0.0.0.0 
  network 10.0.6.1 0.0.0.0 
#

R2:

#
interface LoopBack0
 ip address 10.0.2.2 255.255.255.0 
 ospf network-type broadcast         //改变loopback0的网络类型,以便发布真实的掩码信息
#
ospf 1 router-id 10.0.2.2 
 bandwidth-reference 10000          //改变参考带宽值,单位Mbps
 area 0.0.0.0 
  network 10.0.2.2 0.0.0.0 
  network 10.0.7.2 0.0.0.0 
 area 0.0.0.2 
  network 10.0.6.2 0.0.0.0 
#

R3:

#
interface LoopBack0
 ip address 10.0.3.3 255.255.255.0 
 ospf network-type broadcast
#
ospf 1 router-id 10.0.3.3 
 bandwidth-reference 10000
 area 0.0.0.0 
  network 10.0.3.3 0.0.0.0 
  network 10.0.7.3 0.0.0.0 
 area 0.0.0.1 
  abr-summary 10.2.0.0 255.255.254.0   //路由汇总
  network 10.0.8.3 0.0.0.0 
#

R4:

#
interface LoopBack0
 ip address 10.0.4.4 255.255.255.0 
 ospf network-type broadcast
#
ospf 1 router-id 10.0.4.4 
 default-route-advertise always type 1     //永久发布缺省路由,类型为1(外部路由有两种类型)
 preference 20 
 preference ase 50 
 bandwidth-reference 10000
 area 0.0.0.2 
  network 10.0.4.4 0.0.0.0 
  network 10.0.6.4 0.0.0.0 
#
ip route-static 0.0.0.0 0.0.0.0 LoopBack0   //缺省路由
#

R5:

#
ospf 1 router-id 10.0.5.5 
 bandwidth-reference 10000
 area 0.0.0.1 
  network 10.0.5.5 0.0.0.0 
  network 10.0.8.5 0.0.0.0 
  network 10.2.0.1 0.0.0.0 
  network 10.2.1.1 0.0.0.0 
#

配置虚电路和路由过滤
关于华为路由器OSPF协议配置的一些命令_第3张图片
非骨干区域area 3通过虚链路连接到骨干区域area 0:
R1:

ospf 1 router-id 10.0.1.1 
 area 0.0.0.2 
  network 10.0.1.1 0.0.0.0 
  network 10.0.8.1 0.0.0.0 
  vlink-peer 10.0.2.2        //配置虚链路

R2:

ospf 1 router-id 10.0.2.2 
 area 0.0.0.0 
  network 10.0.2.2 0.0.0.0 
  network 10.0.6.2 0.0.0.0 
 area 0.0.0.2 
  network 10.0.8.2 0.0.0.0 
  vlink-peer 10.0.1.1        //配置虚链路

将不连续的area 0通过虚链路连接起来:
R3:

ospf 1 router-id 10.0.3.3 
 area 0.0.0.0 
  network 10.0.3.3 0.0.0.0 
  network 10.0.6.3 0.0.0.0 
 area 0.0.0.1 
  network 10.0.7.3 0.0.0.0 
  vlink-peer 10.0.5.5        //配置虚链路

R5:

ospf 1 router-id 10.0.5.5 
 area 0.0.0.0 
  network 10.0.5.5 0.0.0.0 
 area 0.0.0.1 
  network 10.0.7.5 0.0.0.0 
  vlink-peer 10.0.3.3        //配置虚链路

配置路由过滤:R1上配置在区域3向其他区域发送更新时,过滤第三类LSA

#
acl number 2000  
 rule 5 deny source 10.0.4.0 0.0.0.255 
 rule 10 permit 
#
ospf 1 router-id 10.0.1.1
 area 0.0.0.3 
  filter 2000 export 

你可能感兴趣的:(路由交换)