交换机的作用主要有两个:
1.维护CAM(ContextAddress Memory)表,该表是MAC地址和交换机端口的映射表2.根据CAM进行数据帧的转发交换机对数据帧的处理有三种:1.Forward:查询CAM表,有目的计算机所在的端口,且不是入端口2.Filter:目的端口是入端口3.Flood:查询不到目的计算机所在端口,或者收到广播帧或者组播帧以太网交换机转发数据帧有三种交换方式:1.存储转发(Store-and-Forward)2.直接转发(Cut-Through)3.无碎片(Fragment-Free):读取数据帧前64个字节后,开始转发该帧。1.VLAN的划分2.VLAN间路由3.生成树enable
conf tno ip do loenable pass ciscoline con 0logg syncexec-t 0 0line vty 0 4pass ciscologg syncexithost1.VLAN的划分
------------------------------------------------------------------------------ SW1:vlan databasevlan 2vlan 3applyint f0/1switchport mode accessswitchport access vlan 2exitint f0/2switchport mode accessswitchport access vlan 3exitR1:int f0/0ip add 123.1.1.1 255.255.255.0no shutexitR2:int f0/0ip add 123.1.1.1 255.255.255.0no shutexitSW1:show vlan-switch brief2.VLAN的路由
-------------------------------------------------------------------------- R1:int e0/0no ip addressno shutdownexitint e0/0.10encapsulation dot1Q 10ip add 10.1.1.1 255.255.255.0exitint e0/0.20encapsulation dot1Q 20ip add 20.1.1.1 255.255.255.0exitSW1:int f0/10switchport mode trunkswitchport trunk encapsulation dot1qno shutdownexitendvlan databasevlan 10vlan 20applyexitconf tint f0/1switchport mode accessswitchport access vlan 10no shutdownexitint f0/2switch mode accessswitch access vlan 20no shutdownexitPC1:no ip routingint e0/1ip add 10.1.1.2 255.255.255.0no shutexitip default-gateway 10.1.1.1PC2:no ip routingint e0/2ip add 20.1.1.2 255.255.255.0no shutexitip default-gateway 20.1.1.13.生成树
----------------------------------------------------------------------------- SW1:int range f0/1 , f0/5switchport mode trunkswitchport trunk encapsulation dot1qno shutdownexitSW2:int range f0/2 , f0/5switchport mode trunkswitchport trunk encapsulation dot1qno shutdownexitSW3:int range f0/1 , f0/2switchport mode trunkswitchport trunk encapsulation dot1qno shutdownexitSW1:vlan databasevlan 2vtp servervtp domain yeslabvtp pass ciscoapplyexitSW2:vlan databasevtp clientvtp domain yeslabvtp pass ciscoapplyexitSW3:vlan databasevtp clientvtp domain yeslabvtp pass ciscoapplyexitSW1:show spanning-tree briefSW1:spanning-tree vlan 1 priority 4096spanning-tree vlan 2 priority 8192SW2:spanning-tree vlan 2 priority 4096spanning-tree vlan 1 priority 8192