CCNA-21、Trunk
2022-11-10 本文已影响0人
Tess鱼丸
在Trunk链路上用来传输多个VLAN信息,
- 中继是两台网络设备之间的点对点链路,负责传输多个VLAN的流量;
- VLAN中继可让 VLAN扩展到整个网络上;
- VLAN中继不属于具体某个VLAN;
ISL标识
.Cisco私有协议;
·ISL的主干功能使得VLAN信息可以穿越主干线
-通过硬件(ASIC)实现
-ISL标识不会出现在工作站,客户端并不知道ISL的封装信息
-在交换机或路由器与交换机之间,在交换机与具有ISL网卡的服务器之间可以实现;
ISL封装
- 用ISL头与CRC进行帧封装
- 可以支持多个VLAN (1024)
- VLAN号
- BPDU控制位
=================================================================
802.1Q
·IEEE标准协议;
·实现多厂商之间的交换机通过Trunk互联;
802.1Q帧标记:
-默认情况,在802.1Q Trunk上对所有的VLAN打Tag,除了Native VLAN;
-交换机根据以太网帧头信息来转发数据包;
Tag标记字段详细信息:
-Tag标记字段包含一个2 bytes EtherType (以太类型)字段、一个3bits的PRI字段、1bit的CFI字段、12bits的VLAN ID字段;
可以标记4096个vlanid
ISL是思科私有的,是在数据帧的头部插入一个26位的头部信息,可以标识1024个vlan
802.1Q是公有的,是在数据帧的中间插入一个4字节的Tag信息,可以标识4096个vlan
4个字节前面16位是用来表示以太网的类型,PRI是表示优先级结合QOS,还有1位空白位,还有12位,总共32位
Switch (config-if)# switchport mode {access \ dynamic {auto | desirable} l trunk}
- Configures the trunking characteristics of the port
Switch (config-if)# switchport mode trunk
Configures the port as a VLAN trunk
====================================
switch (config)# interface fastethernet 0/1
switch (config-if)# shutdown
Switch (config-if)# switchport trunk encapsulation ISL
switch (config-if)# switchport mode trunk
switch (config-if)# no shutdown
查看ISL Trunk的配置
Switch# show interfaces interface [switchport \ trunk]
switch# show interfaces fa0/1 switchportName: Fa0/11
Switchport: Enabled
Administrative Mode : trunkOperational Mode: down
Administrative Trunking Encapsulation: islNegotiation of Trunking : on
Access Mode VL.AN: 1 (default)
Trunking Native Mode VL.AN : 1 (default). . .
Switch#sh interfaces ethernet 0/1 trunk
###或者
Switch#sh interfaces trunk
Port Mode Encapsulation Status Native vlan
Et0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Et0/1 1-4094
Port Vlans allowed and active in management domain
Et0/1 1,10
Port Vlans in spanning tree forwarding state and not pruned
Et0/1 none
Switch#
Switch#show interfaces ethernet 0/1 switchport
Name: Et0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
###以上就是查看接口具体信息
Negotiation of Trunking: On
Access Mode VLAN: 10 (student)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk associations: none
Administrative private-vlan trunk mappings: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Appliance trust: none
Switch#
Switch Port DTP Modes
Mode Function
Access Unconditionally sets a switch port to access mode,regardloss of other DTP functions
Trunk Sets the switch port to unconditional trunking modeand negotiates to become a trunk link, regardless ofneighbor interface mode
Non-negotiate The port is trunk link, but Specifies that DTP negotiationpackets are not sent on the Layer 2 interface .
Dynamic desirable Sets the switch port to actively send and respond to DTP negotiation frames. Default for Ethernet
Dynamic auto Sets the switch port to respond but not to actively sendDTP negotiation frames.
配置管理vlan,
Switch(config-if)#switchport trunk native 10
实现VLAN之间路由
方法一:采用路由器的多个物理接口
路由器F0/0设置vlan100的网关,路由器F0/1设置vlan200的网关,
方法二:采用单臂路由的方式(子接口的方式)
一个接口里可以创建n个虚拟子接口,每个虚拟接口就给一个vlan使用,然后配置成Trunk。
采用802.1Q Trunk Link实现单臂路由:
Cisco(config)#interface fastethernet o/0
Cisco(config-if)#no shutdown
Cisco(config)#interface fastethernet 0/0.100
Cisco(config-subif)#tencapsulation dot1q 100
Cisco(config-subif)#ip address 10.10.10.1 255.255.255.0
Cisco(config-subif)#no shutdown
Cisco(config)#interface fastethernet 0/0.200
cisco(config-subif)#encapsulation dot1q 200
Cisco(config-subif)#ip address 10.10.20.1 255.255.255.0
Cisco(config-subif)#no shutdown
采用ISL Trunk Link实现单臂路由:
Cisco(config)#interface fastethernet 0/0
Cisco(config-if)#no shutdown
Cisco(config)#interface fastethernet 0/0.100
Cisco(config-subif)#encapsulation isl 100
Cisco(config-subif)#ip address 10.10.10.1255.255.255.0
Cisco(config-subif)#no shutdown
Cisco(config)#interface fastethernet 0/0.200
Cisco(config-subif)#encapsulation isl 200
Cisco(config-subif)#ip address 10.10.20.1 255.255.255.0
Cisco(config-subif)#no shutdown
路由器模拟PC一条命令no ip routing,关闭路由功能,
再配置一个默认网关ip default-gateway 192.168.100.1,
就能当PC用了
=====================================================
方法三:采用三层交换机实现Vlan之间路由
三层交换机的逻辑组件采用三层交换机实现Vlan之间路由
三层交换机默认开启路由功能
Switch(config)#ip routing(开启三层交换机路由功能)
三层交换机配置路由接口的两种方法
-开启三层交换机物理接口l的路由功能
Switch(config)#interface fastethernet 0/1
Switch(config-if)#no switchport
Switch(config-if)#ip address 10.10.10.1255.255.255.0
Switch(config-if)#no shutdown
-关闭物理接口路由功能
Switch(config-if)# switchport
-采用SVI方式(switch virtual interface)
Switch(config)#interface vlan 100
Switch(config-if)#ip address 10.10.10.1.255 255.255.0
Switch(confia-if)#no shutdown