交换机的作用主要有两个:
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 t
no ip do lo
enable pass cisco
line con 0
logg sync
exec-t 0 0
line vty 0 4
pass cisco
logg sync
exit
host

1.VLAN的划分
------------------------------------------------------------------------------


SW1:
vlan database
vlan 2
vlan 3
apply

int f0/1
switchport mode access
switchport access vlan 2
exit

int f0/2
switchport mode access
switchport access vlan 3
exit

R1:
int f0/0
ip add 123.1.1.1 255.255.255.0
no shut
exit

R2:
int f0/0
ip add 123.1.1.1 255.255.255.0
no shut
exit

SW1:
show vlan-switch brief

 2.VLAN的路由
--------------------------------------------------------------------------


R1:
int e0/0
no ip address
no shutdown
exit

int e0/0.10
encapsulation dot1Q 10
ip add 10.1.1.1 255.255.255.0
exit

int e0/0.20
encapsulation dot1Q 20
ip add 20.1.1.1 255.255.255.0
exit

SW1:
int f0/10
switchport mode trunk
switchport trunk encapsulation dot1q
no shutdown
exit

end

vlan database
vlan 10
vlan 20
apply
exit

conf t

int f0/1
switchport mode access
switchport access vlan 10
no shutdown
exit

int f0/2
switch mode access
switch access vlan 20
no shutdown
exit

PC1:
no ip routing
int e0/1
ip add 10.1.1.2 255.255.255.0
no shut
exit
ip default-gateway 10.1.1.1

PC2:
no ip routing
int e0/2
ip add 20.1.1.2 255.255.255.0
no shut
exit
ip default-gateway 20.1.1.1

3.生成树
-----------------------------------------------------------------------------


SW1:
int range f0/1 , f0/5
switchport mode trunk
switchport trunk encapsulation dot1q
no shutdown
exit

SW2:
int range f0/2 , f0/5
switchport mode trunk
switchport trunk encapsulation dot1q
no shutdown
exit

SW3:
int range f0/1 , f0/2
switchport mode trunk
switchport trunk encapsulation dot1q
no shutdown
exit

SW1:
vlan database
vlan 2
vtp server
vtp domain yeslab
vtp pass cisco
apply
exit

SW2:
vlan database
vtp client
vtp domain yeslab
vtp pass cisco
apply
exit

SW3:
vlan database
vtp client
vtp domain yeslab
vtp pass cisco
apply
exit

SW1:
show spanning-tree brief

SW1:
spanning-tree vlan 1 priority 4096
spanning-tree vlan 2 priority 8192

SW2:
spanning-tree vlan 2 priority 4096
spanning-tree vlan 1 priority 8192

posted on 2013-06-19 16:46  逝者如斯(乎)  阅读(783)  评论(0编辑  收藏  举报