A-A+

单臂路由和交换机一起实现VLAN间路由的组网和配置

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

一台思科1841路由器、一台C2950-24交换机和两台PC主机组成一个三叉戟形状的网络,利用单臂路由来实现VLAN间的路由通信,组网拓扑图如下:

第一台PC主机为静态ip,具体设置如下图:

第二台PC主机的ip配置:

交换机的配置命令如下:

  1. Switch>  
  2. Switch>en  
  3. Switch>enable   
  4. Switch#conf  
  5. Switch#configure   
  6. Configuring from terminal, memory, or network [terminal]?   
  7. Enter configuration commands, one per line.  End with CNTL/Z.  
  8. Switch(config)#h  
  9. Switch(config)#hostname SW1  
  10. SW1(config)#vl  
  11. SW1(config)#vlan 2  
  12. SW1(config-vlan)#exit  
  13. SW1(config)#in f0/1  
  14. SW1(config-if)#sw  
  15. SW1(config-if)#switchport m  
  16. SW1(config-if)#switchport mode a  
  17. SW1(config-if)#switchport mode access   
  18. SW1(config-if)#sw  
  19. SW1(config-if)#switchport a  
  20. SW1(config-if)#switchport access v  
  21. SW1(config-if)#switchport access vlan 1  
  22. SW1(config-if)#in f0/2  
  23. SW1(config-if)#sw  
  24. SW1(config-if)#switchport m  
  25. SW1(config-if)#switchport mode a  
  26. SW1(config-if)#switchport mode access   
  27. SW1(config-if)#sw  
  28. SW1(config-if)#switchport a  
  29. SW1(config-if)#switchport access v  
  30. SW1(config-if)#switchport access vlan 2  
  31.   
  32.   
  33. SW1(config-if)#in f0/3  
  34. SW1(config-if)#sw  
  35. SW1(config-if)#switchport m  
  36. SW1(config-if)#switchport mode t  
  37. SW1(config-if)#switchport mode trunk   
  38. SW1(config-if)#exit  
  39. SW1(config)#  
  40. %LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up  
  41. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up  
  42.    
  43.   
  44.   
  45. --------------------------------------------------------------------------------  
  46.   
  47.   
  48. Router>en  
  49. Router>enable   
  50. Router#conf  
  51. Router#configure   
  52. Configuring from terminal, memory, or network [terminal]?   
  53. Enter configuration commands, one per line.  End with CNTL/Z.  
  54. Router(config)#h  
  55. Router(config)#hostname R1  
  56. R1(config)#in f0/0  
  57. R1(config-if)#no shu  
  58. R1(config-if)#no shutdown  
  59.   
  60. %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up  
  61.   
  62. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up  
  63.   
  64. R1(config-if)#in f0/0.1  
  65.   
  66. %LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up  
  67.   
  68. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up  
  69. R1(config-subif)#en  
  70. R1(config-subif)#encapsulation d  
  71. R1(config-subif)#encapsulation dot1Q 1 n  
  72. R1(config-subif)#encapsulation dot1Q 1 native   
  73. R1(config-subif)#ip add 172.16.1.1 255.255.255.0  
  74. R1(config-subif)#in f0/0.2  
  75.   
  76. %LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up  
  77.   
  78. %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up  
  79. R1(config-subif)#en  
  80. R1(config-subif)#encapsulation d  
  81. R1(config-subif)#encapsulation dot1Q 2  
  82. R1(config-subif)#ip add 172.16.2.1 255.255.255.0  
  83. R1(config-subif)#exit  
  84. R1(config)#  
标签:

给我留言