思科交换机如何配置trunk?

实验目的

 

1、理解Trunk的运行原理

2、掌握Trunk的配置方法

 

实验拓扑

 

图片

实验需求

 

1、根据实验拓扑图,完成设备的基本配置;

2、分别在SW1和SW2创建VLAN10和VLAN20,名字为IT和HR;

3、分别在SW1和SW2上把相应的接口划入VLAN10和VLAN20;

4、把SW1和SW2互连的链路配置成Trunk,采用Dot1q封装;

5、测试PC之间的网络连通性。

 

实验步骤

 

 

 

步骤1:设备的基本配置

配置PC1

  •  
  •  
VPCS> set pcname PC1   //设置主机名PC1> ip 10.1.1.1/24      //设置IP地址

 

配置PC2

  •  
  •  
VPCS> set pcname PC2PC2> ip 10.1.2.1/24

 

配置PC3

  •  
  •  
VPCS> set pcname PC3PC3> ip 10.1.1.2/24

 

配置PC4

  •  
  •  
VPCS> set pcname PC4PC4> ip 10.1.2.2/24

 

配置SW1

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Switch>enableSwitch#configure terminalSwitch(config)#hostname SW1SW1(config)#no ip domain-lookupSW1(config)#line console 0SW1(config-line)#exec-timeout 0 0SW1(config-line)#logging synchronousSW1(config-line)#endSW1#

 

配置SW2

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Switch>enableSwitch#configure terminalSwitch(config)#hostname SW2SW2(config)#no ip domain-lookupSW2(config)#line console 0SW2(config-line)#exec-timeout 0 0SW2(config-line)#logging synchronousSW2(config-line)#endSW2#

 

步骤2:VLAN的配置

配置SW1

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
SW1(config)#vlan 10SW1(config-vlan)#name ITSW1(config-vlan)#exitSW1(config)#vlan 20SW1(config-vlan)#name HRSW1(config-vlan)#exitSW1(config)#interface Eth0/1SW1(config-if)#switchport mode accessSW1(config-if)#switchport access vlan 10SW1(config-if)#exitSW1(config)#interface Eth0/2SW1(config-if)#switchport mode access   SW1(config-if)#switchport access vlan 20SW1(config-if)#endSW1#

 

配置SW2

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
SW2(config)#vlan 10SW2(config-vlan)#name ITSW2(config-vlan)#exitSW2(config)#vlan 20SW2(config-vlan)#name HRSW2(config-vlan)#exitSW2(config)#interface Eth0/1SW2(config-if)#switchport mode accessSW2(config-if)#switchport access vlan 10SW2(config-if)#exitSW2(config)#interface Eth0/2SW2(config-if)#switchport mode access   SW2(config-if)#switchport access vlan 20SW2(config-if)#endSW2#

 

步骤3:Trunk的配置

配置SW1

  •  
  •  
  •  
  •  
  •  
SW1(config)#interface Eth0/0SW1(config-if)#switchport trunk encapsulation dot1qSW1(config-if)#switchport mode trunkSW1(config-if)#endSW1#

 

配置SW2

  •  
  •  
  •  
  •  
  •  
SW2(config)#interface Eth0/0SW2(config-if)#switchport trunk encapsulation dot1qSW2(config-if)#switchport mode trunkSW2(config-if)#endSW2#

 

实验检查

 

 

步骤1:检查VLAN

检查SW1

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
SW1#show vlan brief

VLAN Name                             Status    Ports---- -------------------------------- --------- -------------------------------1    default                             active     Et0/310   IT                                 active     Et0/120   HR                                active     Et0/21002 fddi-default                     act/unsup1003 token-ring-default               act/unsup1004 fddinet-default                  act/unsup1005 trnet-default                    act/unsupSW1已经创建好VLAN10和VLAN20,并已将对应接口划入。

 

检查SW2

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
SW2#show vlan brief

VLAN Name                             Status    Ports---- -------------------------------- --------- -------------------------------1    default                             active    Et0/310   IT                                 active    Et0/120   HR                                active    Et0/21002 fddi-default                     act/unsup1003 token-ring-default               act/unsup1004 fddinet-default                  act/unsup1005 trnet-default                    act/unsupSW2已经创建好VLAN10和VLAN20,并已将对应接口划入。

 

步骤2:检查Trunk

检查SW1

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
SW1#show interfaces Eth0/0 switchportName: Et0/0Switchport: EnabledAdministrative Mode: trunkOperational Mode: trunkAdministrative Trunking Encapsulation: dot1qOperational Trunking Encapsulation: dot1qNegotiation of Trunking: OnAccess Mode VLAN: 1 (default)Trunking Native Mode VLAN: 1 (default)Administrative Native VLAN tagging: enabledVoice VLAN: noneAdministrative private-vlan host-association: noneAdministrative private-vlan mapping: noneAdministrative private-vlan trunk native VLAN: noneAdministrative private-vlan trunk Native VLAN tagging: enabledAdministrative private-vlan trunk encapsulation: dot1qAdministrative private-vlan trunk normal VLANs: noneAdministrative private-vlan trunk associations: noneAdministrative private-vlan trunk mappings: noneOperational private-vlan: noneTrunking VLANs Enabled: ALLPruning VLANs Enabled: 2-1001Capture Mode DisabledCapture VLANs Allowed: ALLProtected: falseAppliance trust: noneE0/0接口当前是Trunk,封装的协议是dot1q。SW1#show interfaces trunkPort        Mode            Encapsulation   Status        Native vlanEt0/0       on               802.1q         trunking      1

Port        Vlans allowed on trunkEt0/0       1-4094Port        Vlans allowed and active in management domainEt0/0       1,10,20Port        Vlans in spanning tree forwarding state and not prunedEt0/0       1,10,20E0/0封装的Trunk协议是dot1q,当前的状态是trunking。SW1#sh run int Eth0/0Building configuration...Current configuration : 90 bytes!interface Ethernet0/0 switchport trunk encapsulation dot1q switchport mode trunkendE0/0接口的Trunk封装协议是dot1q,模式是trunk。

 

检查SW2

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
SW2#show interfaces trunkPort        Mode             Encapsulation  Status        Native vlanEt0/0       on                802.1q        trunking      1

Port        Vlans allowed on trunkEt0/0       1-4094Port        Vlans allowed and active in management domainEt0/0       1,10,20Port        Vlans in spanning tree forwarding state and not prunedEt0/0       1,10,20E0/0封装的Trunk协议是dot1q,当前的状态是trunking。

 

步骤4:网络连通性测试

测试PC1和PC3的连通性:

  •  
  •  
  •  
  •  
  •  
  •  
  •  
PC1> ping 10.1.1.284 bytes from 10.1.1.2 icmp_seq=1 ttl=64 time=1.603 ms84 bytes from 10.1.1.2 icmp_seq=2 ttl=64 time=1.234 ms84 bytes from 10.1.1.2 icmp_seq=3 ttl=64 time=1.027 ms84 bytes from 10.1.1.2 icmp_seq=4 ttl=64 time=2.372 ms84 bytes from 10.1.1.2 icmp_seq=5 ttl=64 time=1.200 msPC1和PC3的网络连通性正常。

 

测试PC2和PC4的连通性:

  •  
  •  
  •  
  •  
  •  
  •  
  •  
PC2> ping 10.1.2.284 bytes from 10.1.2.2 icmp_seq=1 ttl=64 time=0.887 ms84 bytes from 10.1.2.2 icmp_seq=2 ttl=64 time=0.932 ms84 bytes from 10.1.2.2 icmp_seq=3 ttl=64 time=1.295 ms84 bytes from 10.1.2.2 icmp_seq=4 ttl=64 time=0.926 ms84 bytes from 10.1.2.2 icmp_seq=5 ttl=64 time=1.011 msPC2和PC4的网络连通性正常。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值