A-A+

路由器ospf动态路由配置的技术原理和实验步骤

2015年11月24日 站长资讯 暂无评论

技术原理:ospf是开放式最短路径优先协议,是目前通信、互联网络中应用最广泛的路由协议之一。属于内部网络路由协议。能够适应各种规模的网络环境,是典型的链路状态协议。OSPF路由协议通过向全网扩散本设备的链路状态信息,使网络中每台设备最终同步一个具有全网链路状态的数据库,然后路由器采用spf算法。以自己为根,计算到达网络的最短路径,最终形成全网路由信息。

实验步骤:

1.在本实验中的三层交换机上划分vlan10和vlan20,其中vlan10用于连接主机,vlan20用于连接R1。

2.路由器之间通过v35电缆通过串口连接,DCE端连接在R1上,配置其时钟频率64000。

3.主机和交换机通过直连线,主机与路由器通过交叉线连接。

4.在S3560上配置ospf路由协议。

5.在路由器R1、R2上配置ospf路由协议。

6.将pc1、pc2主机默认网关设置为与直连网络设备接口IP地址。

7.验证pc1、pc2主机之间可以互相通。

实验图:

S3650配置:

  1. Switch>en  
  2. Switch>enable  
  3. Switch#config t  
  4. Enter configuration commands, one perline.  End with CNTL/Z.  
  5. Switch(config)#host s3650  
  6. s3650(config)#vlan 10  
  7. s3650(config-vlan)#name v10  
  8. s3650(config-vlan)#exit  
  9. s3650(config)#vlan 20  
  10. s3650(config-vlan)#name v20  
  11. s3650(config-vlan)#exit  
  12. s3650(config)#int fa0/10  
  13. s3650(config-if)#switchport access vlan 10  
  14. s3650(config-if)#exit  
  15. s3650(config)#int fa0/20  
  16. s3650(config-if)#switchport access vlan 20  
  17. s3650(config-if)#exit  
  18. s3650(config)#int vlan 10  
  19.   
  20. %LINK-5-CHANGED: Interface Vlan10, changedstate to up  
  21.   
  22. %LINEPROTO-5-UPDOWN: Line protocol onInterface Vlan10, changed state to up  
  23. s3650(config-if)#ip address 192.168.1.1255.255.255.0  
  24. s3650(config-if)#no shut  
  25. s3650(config-if)#exit  
  26. s3650(config)#int vlan 20  
  27. s3650(config-if)#  
  28. %LINK-5-CHANGED: Interface Vlan20, changedstate to up  
  29.   
  30. s3650(config-if)#ip address 192.168.3.1255.255.255.0  
  31. s3650(config-if)#no shut  
  32. s3650(config-if)#router ospf 1  
  33. s3650(config-router)#network 192.168.1.00.0.0.255 area 0  
  34. s3650(config-router)#network 192.168.3.00.0.0.255 area 0  
  35. s3650(config-router)#exit  
  36. s3650(config)#exit  
  37. s3650#  
  38. %SYS-5-CONFIG_I: Configured from console byconsole  

R1配置:

  1. Router>en  
  2. Router#config t  
  3. Enter configuration commands, one perline.  End with CNTL/Z.  
  4. Router(config)#host R1  
  5. R1(config)#int fa0/0  
  6. R1(config-if)#ip address 192.168.3.2255.255.255.0  
  7. R1(config-if)#no shut  
  8.   
  9. %LINK-5-CHANGED: Interface FastEthernet0/0,changed state to up  
  10.   
  11. %LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up  
  12.   
  13. R1(config-if)#exit  
  14. R1(config)#int serial2/0  
  15. R1(config-if)#clock rate 64000  
  16. R1(config-if)#ip address 192.168.4.1255.255.255.0  
  17. R1(config-if)#no shut  
  18.   
  19. %LINK-5-CHANGED: Interface Serial2/0,changed state to down  
  20. R1(config-if)#exit  
  21. R1(config)#router ospf 1  
  22. R1(config-router)#network 192.168.3.00.0.0.255 area 0  
  23. R1(config-router)#network  
  24. 01:10:13: %OSPF-5-ADJCHG: Process 1, Nbr192.168.3.1 on FastEthernet0/0 from LOADING to FULL, Loading Done  
  25.   
  26. % Incomplete command.  
  27. R1(config-router)#network 192.168.4.00.0.0.255 area 0  
  28. R1(config-router)#  

R2配置:

  1. Router>en  
  2. Router#config t  
  3. Enter configuration commands, one perline.  End with CNTL/Z.  
  4. Router(config)#host R2  
  5. R2(config)#int fa0/0  
  6. R2(config-if)#ip address 192.168.2.1255.255.255.0  
  7. R2(config-if)#no shut  
  8.   
  9. %LINK-5-CHANGED: Interface FastEthernet0/0,changed state to up  
  10.   
  11. %LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up  
  12.   
  13. R2(config-if)#exit  
  14. R2(config)#int serial2/0  
  15. R2(config-if)#ip address 192.168.4.2255.255.255.0  
  16. R2(config-if)#no shut  
  17.   
  18. R2(config-if)#  
  19. %LINK-5-CHANGED: Interface Serial2/0,changed state to up  
  20.   
  21. R2(config-if)#exit  
  22. R2(config)#  
  23. %LINEPROTO-5-UPDOWN: Line protocol onInterface Serial2/0, changed state to up  
  24.   
  25. R2(config)#router ospf 1  
  26. R2(config-router)#network 192.168.2.00.0.0.255 area 0  
  27. R2(config-router)#network 192.168.4.00.0.0.255 area 0  
  28. R2(config-router)#exit  
  29. R2(config)#  

测试:

从pc2 pingpc1.不通

在s3650上配置:

  1. s3650#config t  
  2. Enter configuration commands, one perline.  End with CNTL/Z.  
  3. s3650(config)#ip routing  
  4. s3650(config)#exit  
  5. s3650#  

此时测试已通。

标签:

给我留言