A-A+

通过路由器联通外网的实验

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

实验名称:搭建一个连通外网的环境

实验过程

步骤1:配置基本环境

首先,打开Cisco Packet Tacer,购买三台主机,一台交换机,一台路由器,并用合适的线缆连接起来。单击主机选择Desktop-ipconfiguration,为三台主机分别配192.168.1.1;192.168.1.2;192.168.1.3的IP。

步骤2:配置交换机的IP与网关

单击交换机进入CLI命令行模式输入enable进入特权模式,输入configure terminal 进入全局配置模式;在全局配置模式下 interface vlan 1- ip address 192.168.1.253 255.255.255.0 -no shutdown;

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

这样就配置好了交换机IP。为了验证我们可以主机1 ping一下交换机IP。

  1. ping statistics for 192.168.1.253:  
  2.   
  3.    Packets: Sent = 4Received = 3Lost = 1 (25% loss),  
  4.   
  5. Approximate round trip times in milli-seconds:  
  6.   
  7. Minimum = 0msMaximum = 0msAverage = 0ms  

发现时可以ping通的。下面输入exit回到全局配置模式。在命令行输入ip default-gateway 192.168.1.100就可以为交换机配置网关,这样可以方便不同网段主机对交换机的管理。

步骤3:配置路由器接口IP

单击路由器进入CLI命令行模式,通交换机一样,enable进入用户模式,configure terminal 进入全局配置模式。输入interface fastethernet 0/0进入接口,输入ip address 192.168.1.254 255.255.255.0然后no shutdown。

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

这样就配置好了路由器的IP了,用一个主机ping一下

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

可以Ping通,至此,实验完成。

实验结果:本次实验其实不难,主要的还是在于熟练,工作上以后,对于这样的操作,应该做到秒杀。

标签:

给我留言