OSPF配置常用命令知识总结
OSPF配置常用命令知识总结
1.display ospf abr-asbr 命令用来显示OSPF的区域边界路由器和自治系统边界路由器信息。
[R3]dis ospf abr-asbr
OSPF Process 1 with Router ID 20.1.3.0
Routing Table to ABR and ASBR
Rt Type Destination Area Cost Nexthop Type
Intra-area 30.3.6.0 0.0.0.0 3 192.168.34.4 ABR
2.display ospf lsdb 命令用来显示OSPF的链路状态数据库(LSDB)信息。
[R3]display ospf lsdb
OSPF Process 1 with Router ID 20.1.3.0
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 20.1.3.0 20.1.3.0 1264 36 80000004 1
Router 0.2.5.0 0.2.5.0 1257 48 80000007 1
Network 192.168.56.6 30.3.6.0 1259 32 80000001 0
Network 192.168.34.3 20.1.3.0 1264 32 80000001 0
3.display ospf peer brief //查看OSPF邻接表
[R3]display ospf peer brief
OSPF Process 1 with Router ID 20.1.3.0
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/2 0.2.4.0 Full
0.0.0.20 GigabitEthernet0/0/0 20.1.2.0 Full
0.0.0.20 GigabitEthernet0/0/1 20.1.1.0 Full
----------------------------------------------------------------------------
4.display ip routing-table protocol ospf //查看OSPF路由表
[R3]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 5 Routes : 6
OSPF routing table status : <Active>
Destinations : 5 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.12.0/24 OSPF 10 2 D 192.168.13.1 GigabitEthernet0/0/1
OSPF 10 2 D 192.168.23.2 GigabitEthernet0/0/0
192.168.20.0/24 OSPF 10 2 D 192.168.13.1 GigabitEthernet0/0/1
192.168.45.0/24 OSPF 10 2 D 192.168.34.4 GigabitEthernet0/0/2
192.168.56.0/24 OSPF 10 3 D 192.168.34.4 GigabitEthernet0/0/2
192.168.67.0/24 OSPF 10 4 D 192.168.34.4 GigabitEthernet0/0/2
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
5.配置网络接口类型,影响DR的选举
[R3] interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0] ospf network-type p2p
6.配置所在网段的接口,影响DR的选举
[R3] interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0] ospf dr-priority 0
7.配置路由器所在接口的cost,影响路由的选择
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ospf cost 45
8.配置路由器间的Hello计时器时长
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ospf timer hello 4
9.配置路由器之间的Dead计时器时长
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ospf timer dead 33