A-A+

配置浮动路由的实验

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

实验名称:配置浮动路由

实验过程:

步骤1:准备基本环境

首先,打开Cisco Packet tracer。购买两台主机,两台交换机。两台路由器,并各自组成A、B网络,

为主机A配置IP为192.168.1.1。主机B配置192.168.3.1。

步骤2:配置路由器,是的两个网络可以ping通

打开路由器A,进入

  1. Router>enable  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#interface fastethernet 0/0  
  8.   
  9. Router(config-if)#ip address 192.168.1.254 255.255.255.0  
  10.   
  11. Router(config-if)#no shutdown  
  12.   
  13.   
  14. Router(config-if)#  
  15.   
  16. %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up  
  17.   
  18.   
  19. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up  

打开路由器B,

  1. Router>enable  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#interface fastethernet 0/0  
  8.   
  9. Router(config-if)#ip address 192.168.3.254 255.255.255.0  
  10.   
  11. Router(config-if)#no shutdown  
  12.   
  13.   
  14. Router(config-if)#  
  15.   
  16. %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up  
  17.   
  18.   
  19. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up  

回到A配置与B路由器同一网段

  1. Router#  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#interface fastethernet 0/1  
  8.   
  9. Router(config-if)#ip address 192.168.2.1 255.255.255.0  
  10.   
  11. Router(config-if)#no shutdown  
  12.   
  13. Router(config-if)#  
  14.   
  15. %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up  

同样进入B

  1. Router#  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#interface fastethernet 0/1  
  8.   
  9. Router(config-if)#ip address 192.168.2.2 255.255.255.0  
  10.   
  11. Router(config-if)#no shutdown  
  12.   
  13. Router(config-if)#  
  14.   
  15. %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up  
  16.   
  17. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up  

这样就将两个路由器加入到同一网段。下面为路由表添加下一跳

回到A

  1. Router#  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2  
  8.   
  9. Router(config)#  

回到B

  1. Router#  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1  
  8.   
  9. Router(config)#  

通过主机Aping主机B,

  1. C>ping 192.168.3.1  
  2.   
  3. Pinging 192.168.3.1 with 32 bytes of data:  
  4.   
  5. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  6.   
  7. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  8.   
  9. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  10.   
  11. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  12.   
  13. Ping statistics for 192.168.3.1:  
  14.   
  15.    Packets: Sent = 4Received = 4Lost = 0 (0% loss),  
  16.   
  17. Approximate round trip times in milli-seconds:  
  18.   
  19.    Minimum = 0msMaximum = 0msAverage = 0ms  

回到主机A查看IP信息,对设置进行保存

  1. C    192.168.1.0/24 is directly connected, FastEthernet0/0  
  2.   
  3. C    192.168.2.0/24 is directly connected, FastEthernet0/1  
  4.   
  5. S    192.168.3.0/24 [1/0] via 192.168.2.2  
  6.   
  7. Router#write  www.xiaoxiongboke.com   
  8.   
  9. Building configuration...  
  10.   
  11. [OK]  
  12.   
  13. Router#  

同样步骤到B

  1. S    192.168.1.0/24 [1/0] via 192.168.2.1  
  2.   
  3. C    192.168.2.0/24 is directly connected, FastEthernet0/1  
  4.   
  5. C    192.168.3.0/24 is directly connected, FastEthernet0/0  
  6.   
  7. Router#write  
  8.   
  9. Building configuration...  
  10.   
  11. [OK]  
  12.   
  13. Router#  
  14.   
  15. Router#  

步骤2:建立浮动路由

由于之前已经做好保存,下面直接将路由器关机,购买一个MN-1FE-TX到路由器A B,为端口连线。

开机

进入路由器A

  1. Router(config)#interface fastethernet 1/0  
  2.   
  3. Router(config-if)#ip address 192.168.4.1 255.255.255.0  
  4.   
  5. Router(config-if)#no shutdown  
  6.   
  7. Router(config-if)#  

进入B

  1. outer>enable  
  2.   
  3. Router#configure terminal  
  4.   
  5. Enter configuration commands, one per line.  End with CNTL/Z.  
  6.   
  7. Router(config)#interface fastethernet 1/0  
  8.   
  9. Router(config-if)#ip address 192.168.4.2 255.255.255.0  
  10.   
  11. Router(config-if)#no shutdown  
  12.   
  13. Router(config-if)#  

这样就连通了两个路由器,再回到A

  1. outer(config)#interface fastethernet 1/0  
  2.   
  3. Router(config-if)#ip address 192.168.4.1 255.255.255.0  
  4.   
  5. Router(config-if)#no shutdown  
  6.   
  7. Router(config-if)#exit  
  8.   
  9. Router(config)#  
  10.   
  11. Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.4.2 50  
  12.   
  13. Router(config)#  

回到B,

  1. outer(config)#interface fastethernet 1/0  
  2.   
  3. Router(config-if)#ip address 192.168.4.2 255.255.255.0  
  4.   
  5. Router(config-if)#no shutdown  
  6.   
  7. Router(config-if)#exit  
  8.   
  9. Router(config)#  
  10.   
  11. Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.4.1  
  12.   
  13. Router(config)#  

为了验证浮动路由的作用,下面我们将A路由器的2.0网段的网线剪断,在这之前先看一下A的路由表状态

  1. Gateway of last resort is not set  
  2.   
  3.   
  4. C    192.168.1.0/24 is directly connected, FastEthernet0/0  
  5.   
  6. C    192.168.2.0/24 is directly connected, FastEthernet0/1  
  7.   
  8. S    192.168.3.0/24 [1/0] via 192.168.2.2  
  9.   
  10. C    192.168.4.0/24 is directly connected, FastEthernet1/0  
  11.   
  12. Router#  

下面剪断拔掉192.168.2.1的端口

  1. Router(config)#interface fastethernet 0/1  
  2.   
  3. Router(config-if)#shutdown  
  4.   
  5.   
  6. Router(config-if)#  
  7.   
  8. %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down  
  9.   
  10.   
  11. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down  
  12.   
  13.   
  14. Router(config-if)#  

再次进入查看路由

  1. C    192.168.1.0/24 is directly connected, FastEthernet0/0  
  2.   
  3. S    192.168.3.0/24 [50/0] via 192.168.4.2  
  4.   
  5. C    192.168.4.0/24 is directly connected, FastEthernet1/0  
  6.   
  7. Router#  

发现192.168.4.0段的路由开始生效,用主机Aping一下主机B。

  1. C>ping 192.168.3.1  
  2.   
  3. Pinging 192.168.3.1 with 32 bytes of data:  
  4.   
  5. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  6.   
  7. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  8.   
  9. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  10.   
  11. Reply from 192.168.3.1: bytes=32 time=0ms TTL=126  
  12.   
  13.   
  14. Ping statistics for 192.168.3.1:  
  15.   
  16.    Packets: Sent = 4Received = 4Lost = 0 (0% loss),  
  17.   
  18. Approximate round trip times in milli-seconds:  
  19.   
  20. Minimum = 0msMaximum = 0msAverage = 0ms  

没有任何问题,至此,浮动路由配置完成

实验结果:本次实验其实没有什么难度的说,主要还是熟练,熟练了能分清楚各IP网段就好了。

标签:

给我留言