详解单区域 OSPF 协议配置实验

配置:OSPF协议
环境:两台路由器串口相连,IP地址如图所示
要求:1、在R1R2上配置OSPF协议,使不同网段间能够连通。
      2、使用show ip route查看路由协议。
      3、最后在PC1上能pingPC2
第一步:给两个路由器和PC配好IP地址。

 

  R1配置:
    R1(config)#interface s0/0
R1(config-if)#ip address 192.168.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface s0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#clock rate 64000        ——配置时钟频率
R1(config-if)#no shutdown

 

R2配置:
 R2(config)#interface s0/1
 R2(config-if)#ip address 192.168.2.2 255.255.255.0
  R2(config-if)#no shutdown
 R2(config)#interface s0/0
  R2(config-if)#ip address 192.168.3.1 255.255.255.0
 R2(config-if)#no shutdown
第二步:配置路由协议
 
   R1配置:
   R1(config)#router ospf 1        ——配置OSPF协议
   R1(config-router)#network 192.168.1.0 0.0.0.255 area 1  
   R1(config-router)#network 192.168.2.0 0.0.0.255 area 1
 
 R2配置:
   R2(config)#router ospf 1
   R2(config-router)#network 192.168.2.0 0.0.0.255 area 1
   R2(config-router)#network 192.168.3.0 0.0.0.255 area 1

 

第三步:使用show ip route查看路由协议如下图所示:
  R1学到的路由
R2学到的路由
第四步:我是拿路由模拟PC机的做的,现在PC1PC2可以ping通。