交换机和路由器技术-24-OSPF单区域配置

0SPF路由单区域配置

配置过程

1)创建一个 OSPF 进程,进程号的范围为1~65535。

 Router ( config )# router ospf [ process - id ]

2)配置当前路由的 ID ,相当于每台路由器在 OSPF 中的名称,同一区域内不能相同,格式和 P 地址相同,都是点分十进制,取值范围为0.0.0.0~255.255.255.255。如果不指定,默认选物理地址最大的那个

 Router ( config - router )# router - id [ id - number ]

3)将直连网络发布到 OSPF 中,这里和 RIP 协议不同的地方在于,发布时需要添加所对应网段的反掩码和区域编号。

Router ( config一router )# network network - address Wildcard - mask area -n umber

反掩码就是四个255减去掩码

配置实例

路由器R1

Router>enable 
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface g 0/0
Router(config-if)#ip address 192.168.10.254 255.255.255.0
Router(config-if)#no shutdown 
Router(config-if)#exit
Router(config)#interface g0/1
Router(config-if)#ip address 10.10.10.1 255.255.255.252
Router(config-if)#no shutdown 
Router(config-if)#exit 
Router(config)#router ospf 10
Router(config-router)#router-id 1.1.1.1
Router(config-router)#network 192.168.10.0 0.0.0.255 area 0
Router(config-router)#network 10.10.10.0 0.0.0.3 area 0

路由器R2

Router>enable

Router#configure t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#interface g0/0

Router(config-if)#ip address 10.10.10.2 255.255.255.252

Router(config-if)#no shutdown

Router(config-if)#exit

Router(config)#interface g0/1

Router(config-if)#ip address 20.20.20.1 255.255.255.252

Router(config-if)#no shutdown

Router(config-if)#exit

Router(config)#router ospf 10

Router(config-router)#router-id 2.2.2.2

Router(config-router)#network 10.10.10.0 0.0.0.3 area 0

Router(config-router)#network 20.20.20.0 0.0.0.3 area 0

路由器R3

Router>enable

Router#configure t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#interface g0/0

Router(config-if)#ip address 20.20.20.2 255.255.255.252

Router(config-if)#no shutdown

Router(config-if)#exit

Router(config)#interface g0/1

Router(config-if)#ip address 192.168.20.254 255.255.255.0

Router(config-if)#no shutdown

Router(config-if)#exit

Router(config)#router ospf 10

Router(config-router)#router-id 3.3.3.3

Router(config-router)#network 20.20.20.0 0.0.0.3 area 0

Router(config-router)#network 192.168.20.0 0.0.0.255 area 0

PC0

Pc1

PC0 ping PC1

 

查看命令

查看ospf配置信息

show ip ospf

查看邻居

show ip ospf neighbor

  • 4
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

w辣条小王子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值