数据链路层、vlan、trunk

1 1 案例1:划分VLAN
1.1 问题

在交换机上创建以下VLAN,按照拓扑图-1将端口加入到指定的VLAN并配置服务器IP地址,实现同VLAN主机的通信在这里插入图片描述
1.2 步骤

由于默认情况下所有接口都在VLAN1中,且VLAN1默认就存在,所以只需要配置VLAN2和VLAN3即可。

Switch>enable
Switch#configure terminal 
Switch(config)#vlan 2                                    //创建VLAN2
Switch(config-vlan)#vlan 3                                //创建VLAN3
Switch(config-vlan)#exit    
Switch(config)#interface range fastEthernet 0/3-4        //同时进入3、4接口
Switch(config-if-range)#switchport access vlan 2        //将3、4接口加入VLAN2
Switch(config-vlan)#exit
Switch(config)#interface range fastEthernet 0/5-6
Switch(config-if-range)#switchport access vlan 3
Switch#show vlan brief

2 2 案例2:多交换机VLAN的划分
2.1 问题
通过配置交换机实现图-2中的同VLAN主机互通在这里插入图片描述
2.2 步骤

注:以下配置需要在案例1的基础上完成
S1配置

Switch#configure terminal
Switch(config)#interface fastethernet 0/7
Switch(config-if)#switchport access vlan 3

S2配置

Switch>enable 
Switch#configure terminal 
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#interface range fastEthernet 0/5-7
Switch(config-if-range)#switchport access vlan 3

3 3 案例3:配置trunk中继链路
3.1 问题

通过配置实现跨交换机的同VLAN通信,如图-3所示在这里插入图片描述
3.2 步骤

注:以下配置需要在案例2的基础上完成
S1配置

Switch>enable 
Switch#configure terminal 
Switch(config)#interface fastEthernet 0/7
Switch(config-if)#switchport mode trunk 

S2配置

Switch>enable 
Switch#configure terminal 
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#interface range fastEthernet 0/3-4
Switch(config-if-range)#switchport access vlan 2
Switch(config-if-range)#exit
Switch(config)#interface fastEthernet 0/7
Switch(config-if)#switchport mode trunk

4 4 案例4:以太网通道配置
4.1 问题

参照图-4将交换机的f0/7-f0/9端口配置为以太网通道在这里插入图片描述
4.2 步骤

S1配置

Switch>enable 
Switch#configure terminal 
Switch(config)#interface range fastEthernet 0/7-9
Switch(config-if-range)#channel-group 1 mode on 
Switch(config-if-range)#end
Switch#show etherchannel summary

S2配置

Switch>enable 
Switch#configure terminal 
Switch(config)#interface range fastEthernet 0/7-9
Switch(config-if-range)#channel-group 1 mode on 
Switch(config-if-range)#end
Switch#show etherchannel summary

猜你喜欢

转载自blog.csdn.net/weixin_45048541/article/details/90270395