A-A+

Cisco基础–VLan、静态路由、默认路由综合实验

2015年12月29日 路由器高级应用 暂无评论 阅读 2 views 次

纪念一下2014年11月26日晚。学校爆发大规模的病毒,集体恶心,上吐下泻。好吧,我不幸也中枪了。昨晚顶着高烧写完的,写完后一看断网了,只能今早誊写在博客中了。小伙伴们可千万不要吃垃圾食品了。健康才是最重要的哦。

拓扑图:

实验要求及步骤:

1.根据图中的IP地址,合理规划各设备接口和PC的IP地址;

2.校园网按照图示划分VLAN,各VLAN通过三层交换机SVI实现通信;另外三层交换机F0/24口开启三层功能并配置IP地址。

3.在网络设备SW1,R3上配置静态路由,在R2上配置默认路由,实现各网段的连通;

4.给各路由器配置主机名,如图所示;

5.在路由器R3上配置loopback接口,配置IP地址为3.3.3.3/24,将其作为路由器远程登录的地址,并进行远程登录

的相关配置,实现路由器R3能够远程登录;

6.在server上配置WWW服务,使得远程主机可以访问WWW。

***********************规划IP地址*****************************

******************划分VLAN ,实现各VLAN通信********************

  1. SW21  
  2.   
  3. Switch>enable  
  4. Switch#  
  5. Switch#conf t  
  6. Switch(config)#vlan 10       //创建vlan 10  
  7. Switch(config-vlan)#exit  
  8. Switch(config)#inter f 0/1  
  9. Switch(config-if)#switchport access vlan 10       
  10. Switch(config-if)#no shut       
  11. Switch(config-if)#exit  
  12. Switch(config)#inter f 0/23  
  13.  //因为此线路要实现VLAN包的转发,所以要配置成trunk链路  
  14. Switch(config-if)#switchport mode trunk   Switch(config-if)#no shut  
  15. Switch(config-if)#exit  
  16. Switch(config)#  
  17.   
  18. SW 22  
  19.   
  20. Switch(config)#vlan 20  
  21. Switch(config-vlan)#exit  
  22. Switch(config)#  
  23. Switch(config)#inter f 0/1  
  24. Switch(config-if)#switchport access vlan 20  
  25. Switch(config-if)#no shut  
  26. Switch(config-if)#exit  
  27. Switch(config)#inter f  0/22  
  28. Switch(config-if)#switchport mode trunk   
  29. Switch(config-if)#no shut  

SW23的配置同理与SW21和SW22

  1. SW31  
  2.   
  3. Switch#conf t  
  4. Enter configuration commands, one per line.  End with CNTL/Z.  
  5. Switch(config)#  
  6. Switch(config)#hostname SW31  
  7. SW31(config)#vlan 10  
  8. SW31(config-vlan)#exit  
  9. SW31(config)#vlan 20  
  10. SW31(config-vlan)#exit  
  11. SW31(config)#vlan 30  
  12. SW31(config-vlan)#exit       //创建三个vlan的虚接口  
  13. SW31(config)#inter vlan 10  
  14. SW31(config-if)#ip address 192.168.10.254 255.255.255.0  
  15. SW31(config-if)#no shut  
  16. SW31(config-if)#exit  
  17. SW31(config)#inter vlan 20  
  18. SW31(config-if)#ip address 192.168.20.254 255.255.255.0  
  19. SW31(config-if)#no shut  
  20. SW31(config-if)#  
  21. SW31(config-if)#exit  
  22. SW31(config)#  
  23. SW31(config)#inter vlan 30  
  24. SW31(config-if)#ip address 192.168.30.254 255.255.255.0  
  25. SW31(config-if)#no shut  
  26. SW31(config-if)#exit              //配置所有vlan的IP地址  
  27. SW31(config)#   
  28. //开启三层交换机路由功能,实现不同VLAN之间的通信以及路由功能  
  29. SW31(config)#ip routing    
  30. SW31(config)#  
  31.   
  32. Vlan 10 ping vlan 20  

其他各vlan 一样能ping通

*********************给各路由器端口配置IP地址********************

  1.  SW31(config)#inter f 0/24  
  2. SW31(config-if)#no switchport   
  3. SW31(config-if)#ip ad  
  4. SW31(config-if)#ip address 192.168.40.1 255.255.255.0  
  5. SW31(config-if)#no shut  
  6. SW31(config-if)#exit  
  7. SW31(config)#  
  8.   
  9. Router(config)#hostname R3  
  10. R3(config)#inter f0/0  
  11. R3(config-if)#ip address 192.168.40.2 255.255.255.0  
  12. R3(config-if)#no shut  
  13. R3(config-if)#exit  
  14. R3(config)#inter s 0/1/1  
  15. R3(config-if)#ip ad  
  16. R3(config-if)#ip address 23.0.0.1 255.255.255.0  
  17. R3(config-if)#no shut  
  18.   
  19. Router(config)#hostname R2  
  20. R2(config)#inter s 0/1/1  
  21. R2(config-if)#clock rate 64000  
  22. R2(config-if)#ip address 23.0.0.2 255.255.255.0  
  23. R2(config-if)#no shut  
  24. R2(config-if)#exit  
  25. R2(config)#  
  26. R2(config)#inter f 0/0  
  27. R2(config-if)#ip add  
  28. R2(config-if)#ip address 200.0.0.254 255.255.255.0  
  29. R2(config-if)#no shut  

*******配置各个路由器的静态路由与R2的默认路由,实现全网段连通****

  1. R3(config)#ip route 192.168.10.0 255.255.255.0 192.168.40.1  
  2. R3(config)#ip route 192.168.20.0 255.255.255.0 192.168.40.1  
  3. R3(config)#ip route 192.168.30.0 255.255.255.0 192.168.40.1  
  4.     
  5. R3#show ip route  
  6. ..........................  
  7. ..........................  
  8. C       23.0.0.0 is directly connected, Serial0/1/1  
  9. S    192.168.10.0/24 [1/0] via 192.168.40.1  
  10. S    192.168.20.0/24 [1/0] via 192.168.40.1  
  11. S    192.168.30.0/24 [1/0] via 192.168.40.1  
  12. C    192.168.40.0/24 is directly connected, FastEthernet0/0  

此时各个vlan中的PC机都能ping通R3的F0/0接口

  1. SW31(config)#ip route 23.0.0.0 255.255.255.0 192.168.40.2  
  2. SW31(config)#exit  
  3.     
  4. SW31#show ip route  
  5. .........................................  
  6. S       23.0.0.0 [1/0] via 192.168.40.2  
  7. C    192.168.10.0/24 is directly connected, Vlan10  
  8. C    192.168.20.0/24 is directly connected, Vlan20  
  9. C    192.168.30.0/24 is directly connected, Vlan30  
  10. C    192.168.40.0/24 is directly connected, FastEthernet0/24  

此时,各vlan中的所有PC机都能ping通R3的S 0/1/1接口

  1. R2(config)#ip route 192.168.10.0 255.255.255.0 23.0.0.1  
  2. R2(config)#ip route 192.168.20.0 255.255.255.0 23.0.0.1  
  3. R2(config)#ip route 192.168.30.0 255.255.255.0 23.0.0.1  
  4. R2(config)#exit  
  5. R2#  
  6. R2#show ip route  
  7. ..........................................  
  8. C       23.0.0.0 is directly connected, Serial0/1/1  
  9. S    192.168.10.0/24 [1/0] via 23.0.0.1  
  10. S    192.168.20.0/24 [1/0] via 23.0.0.1  
  11. S    192.168.30.0/24 [1/0] via 23.0.0.1  
  12. C    200.0.0.0/24 is directly connected, FastEthernet0/0  

此时,各vlan中的所有PC机都能ping通R2的s 0/1/1接口

但是题目中要求要在R2是配置的是默认路由,所以在R2上

  1. R2(config)#no ip route 192.168.10.0 255.255.255.0 23.0.0.1  
  2. R2(config)#no ip route 192.168.20.0 255.255.255.0 23.0.0.1  
  3. R2(config)#no ip route 192.168.30.0 255.255.255.0 23.0.0.1 //删除静态路由  
  4. R2(config)#ip route 0.0.0.0 255.255.255.0 23.0.0.1      //添加默认路由  
  5. R2(config)#exit  
  6.     
  7. R2#show ip route  
  8. ..........................................  
  9.  *   0.0.0.0/24 is subnetted, 1 subnets  
  10. S*      0.0.0.0 [1/0] via 23.0.0.1  
  11.      23.0.0.0/24 is subnetted, 1 subnets  
  12. C       23.0.0.0 is directly connected, Serial0/1/1  
  13. C    200.0.0.0/24 is directly connected, FastEthernet0/0  

此时各vlan中的PC机依然能ping 通R2的s 0/1/1接口

  1. SW31(config)#ip route 200.0.0.0 255.255.255.0 192.168.40.2  
  2. SW31#show ip route  
  3. ......................................................  
  4. S       23.0.0.0 [1/0] via 192.168.40.2  
  5. C    192.168.10.0/24 is directly connected, Vlan10  
  6. C    192.168.20.0/24 is directly connected, Vlan20  
  7. C    192.168.30.0/24 is directly connected, Vlan30  
  8. C    192.168.40.0/24 is directly connected, FastEthernet0/24  
  9. S    200.0.0.0/24 [1/0] via 192.168.40.2  
  10.   
  11. R3(config)#ip route 200.0.0.0 255.255.255.0 23.0.0.2  
  12. R3(config)#exit  
  13. R3#  
  14.     
  15. R3#  
  16. R3#show ip route  
  17. ....................................................  
  18. C       23.0.0.0 is directly connected, Serial0/1/1  
  19. S    192.168.10.0/24 [1/0] via 192.168.40.1  
  20. S    192.168.20.0/24 [1/0] via 192.168.40.1  
  21. S    192.168.30.0/24 [1/0] via 192.168.40.1  
  22. C    192.168.40.0/24 is directly connected, FastEthernet0/0  
  23. S    200.0.0.0/24 [1/0] via 23.0.0.2  

此时各vlan所有PC机都能ping通R2的f 0/0接口

而且所有pC机都能访问WEB服务器 http://www.19216811.la

*********在路由器上配置loopback 0接口,并配置静态路由,使其连通***

  1. R3(config)#inter loopback 0  
  2. R3(config-if)#ip add  
  3. R3(config-if)#ip address 3.3.3.3 255.255.255.0  
  4. R3(config-if)#no shut  
  5. R3(config-if)#exit  
  6.   
  7. SW31(config)#ip route 3.3.3.0 255.255.255.0 192.168.40.2  
  8. SW31(config)#exit  
  9. SW31#  
  10. %SYS-5-CONFIG_I: Configured from console by console  
  11.     
  12. SW31#show ip route  
  13. ...................................................  
  14.      3.0.0.0/24 is subnetted, 1 subnets  
  15. S       3.3.3.0 [1/0] via 192.168.40.2  
  16.      23.0.0.0/24 is subnetted, 1 subnets  
  17. S       23.0.0.0 [1/0] via 192.168.40.2  
  18. C    192.168.10.0/24 is directly connected, Vlan10  
  19. C    192.168.20.0/24 is directly connected, Vlan20  
  20. C    192.168.30.0/24 is directly connected, Vlan30  
  21. C    192.168.40.0/24 is directly connected, FastEthernet0/24  
  22. S    200.0.0.0/24 [1/0] via 192.168.40.2  

此时各vlanPC机能ping通 3.3.3.0网络

********将loopbace 0作为路由器远程登录地址,并进行远程登录*****

  1.  R3(config)#enable password 123456  
  2. R3(config)#login  
  3. R3(config)#line vty 0 4  
  4. R3(config-line)#pas  
  5. R3(config-line)#password 123  
  6. R3(config-line)#login  
  7. R3(config-line)#  

此时各vlan中所有PC机都能通过远程telnet登录到3.3.3.3上

标签:

给我留言