A-A+

Cisco交换机Vlan的划分的一些思路

2016年01月02日 站长资讯 暂无评论

Cisco交换机的vlan划分,这个是基础中的基础,VLAN(Virtual LocalArea Network)的中文名为“虚拟局域网”。VLAN是一种将局域网设备从逻辑上划分成一个个网段,从而实现虚拟工作组的新兴数据交换技术。这一新兴技术主要应用于交换机和路由器中,但主流应用还是在交换机之中。但又不是所有交换机都具有此功能,只有VLAN协议的第二层以上交换机才具有此功能,这一点可以查看相应交换机的说明书即可得知。一般的,交换机默认配置都是具有vlan 1的,所有端口均在vlan 1下。

配置实例:

  1. switch>en //进入特权模式  
  2. switch#vlan database //进入vlan数据库  
  3. switch(vlan)#vlan 2 name lab //创建vlan 2,名称为lab  
  4. switch(vlan)#vlan 3 name administration //创建vlan 3,名称为administration  
  5. switch(vlan)#exit //退出vlan数据库,此时交换机会自动保存vlan信息数据,当然也有个别交换机需要输入apply命令进行保存,保存后输入exit进行退出。  
  6. switch#show vlan //查看vlan信息  
  7. VLAN Name Status Ports  
  8. —- ——————————– ——— ——————————-  
  9. 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4  
  10. Fa0/5, Fa0/6, Fa0/7, Fa0/8  
  11. Fa0/9, Fa0/10, Fa0/11, Fa0/12  
  12. Fa0/13, Fa0/14, Fa0/15, Fa0/16  
  13. Fa0/17, Fa0/18, Fa0/19, Fa0/20  
  14. Fa0/21, Fa0/22, Fa0/23, Fa0/24  
  15. Gig0/1, Gig0/2  
  16. 2 lab active //刚刚我创建的vlan 2的信息  
  17. 3 administration active //刚刚我创建的vlan 3的信息  
  18. 1002 fddi-default act/unsup  
  19.   
  20. 1003 token-ring-default act/unsup  
  21. 1004 fddinet-default act/unsup  
  22. 1005 trnet-default act/unsup  
  23. VLAN Type SAID MTU Parent RingNo BridgeNoStp BrdgMode Trans1 Trans2  
  24. —- —– ———- —– —— —— ——– —- ——– —— ——  
  25. 1 enet 100001 1500 – – – – – 0 0  
  26. 2 enet 100002 1500 – – – – – 0 0  
  27. 3 enet 100003 1500 – – – – – 0 0  
  28. 1002 fddi 101002 1500 – – – – – 0 0  
  29. 1003 tr 101003 1500 – – – – – 0 0  
  30. 1004 fdnet 101004 1500 – – – ieee – 0 0  
  31. 1005 trnet 101005 1500 – – – ibm – 0 0  
  32. Remote SPAN VLANs  
  33. ——————————————————————————   
  34. PrimarySecondary Type Ports  
  35. ——- ——— —————– ——————————————  
  36. switch#conf t //进入全局配置模式  
  37. switch(config)#int vlan 1 //进入vlan 1接口,默认vlan 1是存在的,不用我们在vlan数据库中添加  
  38. switch(config-if)#ip add 192.168.0.254 255.255.255.0 //配置vlan 1接口下的ip地址为192.168.0.254,掩码为255.255.255.0  
  39. switch(config-if)#no shut //启用vlan 1接口  
  40. switch(cofnig-if)#int vlan 2 //进入vlan 2接口  
  41. switch(config-if)#ip add 192.168.2.254 255.255.255.0 //配置vlan 2接口下的ip地址为2.254  
  42. switch(config-if)#no shut //启用vlan 2接口  
  43. switch(config-if)#int vlan 3 //进入vlan 3接口  
  44. switch(config-if)#ip add 192.168.3.254 255.255.255.0 //配置vlan 3接口下的ip地址为3.254  
  45. switch(config-if)#no shut //启用vlan 3接口  
  46. switch(config-if)#int f0/2 //进入交换机的f0/2端口  
  47. switch(config-if)#switchport mode access //端口模式为access模式   
  48. switch(config-if)#switchport access vlan 2 //将f0/2端口划分到vlan 2下  
  49. switch(config-if)#no shut //启用f0/2端口  
  50. switch(config-if)#int f0/3 //进入交换机的f0/3端口  
  51. switch(config-if)#switchport mode access //f0/3端口模式为access模式  
  52. switch(config-if)#switchport access vlan 3 //将f0/3端口模式划分到vlan 3下  
  53. switch(config-if)#no shut //启用f0/3端口  
  54. switch(config-if)#^Z //Ctrl+Z返回特权模式  
  55. switch#write //将设置保存到startup-config配置文件中,即flash:目录下的config.text中  

至此vlan的简单划分就完成了,我们可以通过show vlan命令查看我们划分的vlan信息,这里就不列出来了。

标签:

给我留言