ospf配置命令_OSPF配置介绍

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-21 17:20   54   0

981c9205c0c100842268cd2e8f1f2279.png

b91ec9378b06545bda7dabc817936577.png

什么是反掩码

反掩码也叫做通配符

计算方式:反掩码=255.255.255.255-掩码

比如:192.168.1.1/24
反掩码=255.255.255.255-255.255.255.0=0.0.0.255

注意:

反掩码中的0表示的意思就是精确值

反掩码中的1表示的意思就是任意值

有的工程师可能会写反掩码为0.0.0.0(0.0.0.0表示精确匹配)

OSPF配置思路

在R1的area 1当中

network 192.168.12.0 0.0.0.255

或者

network 192.168.12.1 0.0.0.0

R1配置如下命令:

intterface loopback 0
ip address 1.1.1.1 32
[R1]ospf 10 router-id 1.1.1.1 推荐这种方式配置router id
[R1]ospf 10  进入ospf进程里面
[R1-ospf-10]area 1  进入ospf的区域1当中
[R1-ospf-10-area-0.0.0.1]network 192.168.12.0 0.0.0.255  是在我们区域1当中宣告我们的网段

R2配置如下命令:

intterface loopback 0
ip address 2.2.2.2 32
[R1]ospf 10 router-id 2.2.2.2 推荐
[R2]ospf 10  进入ospf进程里面
[R2-ospf-10]area 1  进入ospf的区域1当中
[R2-ospf-10-area-0.0.0.1]network 192.168.12.0 0.0.0.255  是在我们区域1当中宣告我们的网段

同理R3 R4 R5的OSPF配置类似于R1 R2的配置

查看如下三张表

邻居表

[R1]display ospf peer brief 
 
 OSPF Process 10 with Router ID 192.168.12.1
 Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id Interface Neighbor id State 
 0.0.0.0 GigabitEthernet0/0/0 192.168.12.2 Full 
 ----------------------------------------------------------------------------
[R1]

路由表

<R1>display ip routing-table protocol ospf  在R1查看ospf学习到的路由
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
 Destinations : 2 Routes : 2 
 
OSPF routing table status : <Active>
 Destinations : 2 Routes : 2
 
Destination/Mask Proto Pre Cost Flags NextHop Interface
 
 192.168.45.0/24 OSPF 10 3 D 192.168.12.2 GigabitEthernet0/0/0
 192.168.234.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet0/0/0
 
OSPF routing table status : <Inactive>
 Destinations : 0 Routes : 0
 
<R1>

总结:

ospf这边是基于接口划分区域的 在我们OSPF区域当中 其中area 0必须得有 area 0是骨干区域 其他的非区域0叫非骨干区域 非骨干区域必须连接到骨干区域周边

数据库表

<R2>display ospf lsdb  查看ospf当中LSDB
 
 OSPF Process 10 with Router ID 192.168.12.2
 Link State Database 
 
 Area: 0.0.0.0
 Type LinkState ID AdvRouter Age Len Sequence Metric
 Router 192.168.234.3 192.168.234.3 1462 36 80000005 1
 Router 192.168.234.4 192.168.234.4 1374 36 80000006 1
 Router 192.168.12.2 192.168.12.2 1459 36 80000007 1
 Network 192.168.234.4 192.168.234.4 1462 36 80000003 0
 Sum-Net 192.168.45.0 192.168.234.4 1362 28 80000001 1
 Sum-Net 192.168.12.0 192.168.12.2 1554 28  80000001 1
 Sum-Net 192.168.2.0 192.168.234.4 327 28 80000001 2
 Sum-Net 192.168.1.0 192.168.12.2 367 28 80000001 2
 
 Area: 0.0.0.1
 Type LinkState ID AdvRouter Age Len Sequence Metric
 Router 192.168.12.2 192.168.12.2 1572 36 80000004 1
 Router 192.168.12.1 192.168.12.1 325 48 80000007 1
 Network 192.168.12.1 192.168.12.1 80 32 80000003 0
 Sum-Net 192.168.45.0 192.168.12.2 1361 28 80000001 2
 Sum-Net 192.168.234.0 192.168.12.2 1554 28 80000001 1
 Sum-Net 192.168.2.0 192.168.12.2 326 28 80000001  3
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP