OSPF的配置

OSPF的配置

在这里插入图片描述
1.按照上图配好IP地址
2.R1的基本配置

Router>enable 
Router#configure 
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int s0/0/0
R1(config-if)#ip add 172.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown 
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
R1(config-if)#exit
R1(config)#

3.R2的基本配置

Router>enable 
Router#configure 
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#int f0/0
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int s0/0/0
R2(config-if)#ip add 172.168.1.2 255.255.255.0 
R2(config-if)#no sh
R2(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
R2(config-if)#

4.R1,R2,OSPF的配置命令

  • 启动ospf协议:router ospf 1
  • 定义一个区间的地址范围:network
  • 查看当前运行的路由协议:show ip protocols
R1(config)#router ospf 1
R1(config-router)#network 172.168.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.1.0 0.0.0.255 area 1
R1(config-router)#
R2(config)#router ospf 1
R2(config-router)#network 172.168.1.0 0.0.0.255 area 0
R2(config-router)#network 192.168.2.0 0.0.0.255 area 2
R2(config-router)#
R2#show ip protocols 

Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set 
  Incoming update filter list for all interfaces is not set 
  Router ID 192.168.2.1
  Number of areas in this router is 2. 2 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    172.168.1.0 0.0.0.255 area 0
    192.168.2.0 0.0.0.255 area 2
  Routing Information Sources:  
    Gateway         Distance      Last Update 
    192.168.1.1          110      00:04:56
    192.168.2.1          110      00:04:31
  Distance: (default is 110)

R2#

5.验证PC0和PC1能相互PING通
在这里插入图片描述在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

啊醒

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

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

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

打赏作者

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

抵扣说明:

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

余额充值