CCNA2.0笔记_Trunk&EtherChannel

show interfaces trunk  //查看Trunk信息
show interfaces fastEthernet 0/1  //查看接口二层信息
show interfaces fastEthernet 0/1 trunk  //查看接口trunk信息

动态中继协议
 建议进行手动配置(强烈推荐手动设置)
 将两台交换机上的端口配置为Trunk或接入(Access)
 命令”nonegotiate”会禁用协商
 Trunk链路的封装要求两边的本征 vlan相同

image

Trunk实验

vlan:10,20,30,40,50,100
允许通过的vlan:10,20,30,100
本征vlan:100
  

sw1/sw2配置

sw1(config)#interface fastEthernet 0/1
sw1(config-if)#switchport mode trunk 
sw1(config-if)#switchport trunk native vlan 100
sw1(config-if)#switchport trunk allowed vlan 10,20,30,100

Center配置

center(config)#interface range fastEthernet 0/1 - 2
center(config-if-range)#switchport trunk encapsulation dot1q  //三层设备需要先配置封装
center(config-if-range)#switchport mode trunk
center(config-if-range)#switchport trunk native vlan 100
center(config-if-range)#switchport trunk allowed vlan 10,20,30,100

单臂路由

  

Router配置

Router(config)#interface gigabitEthernet 0/0.10   //进入G0/0子接口
Router(config-subif)#description vlan10
Router(config-subif)#encapsulation dot1Q 10    //配置vlan10封装
Router(config-subif)#ip address 10.1.10.1 255.255.255.0

Router(config)#interface gigabitEthernet 0/0.20    //进入G0/0子接口
Router(config-subif)#description vlan20
Router(config-subif)#encapsulation dot1Q 20    //配置vlan20封装
Router(config-subif)#ip address 10.1.20.1 255.255.255.0

Router(config)#ip dhcp pool 10
Router(dhcp-config)#network 10.1.10.0 255.255.255.0
Router(dhcp-config)#default-router 10.1.10.1
Router(dhcp-config)#dns-server 8.8.8.8
Router(config)#ip dhcp pool 20
Router(dhcp-config)#network 10.1.20.0 255.255.255.0
Router(dhcp-config)#default-router 10.1.20.1
Router(dhcp-config)#dns-server 8.8.8.8

Switch配置

Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk native vlan 123
Switch(config-if)#exit 
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit 
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit 

EtherChannel(以太通道)
  基本原理:将两个设备间多条相同特性的快速以太或千兆位以太物理链路捆绑在一起组成一条逻辑链路,从而达到带宽倍增的目的。除了增加带宽外,EtherChannel还可以在多条链路上均衡分配流量,起到负载均衡的作用;当一条或多条链路故障时,只要还有链路正常,流量将转移到其它的链路上,整个过程在几毫秒内完成,从而起到冗余的作用,增强了网络的稳定性和安全性。

 EtherChannel说明:
  ①Cisco最多允许EtherChannel绑定8个端口;
  1>如果是快速以太网,总带宽可达1600Mbit/s;
  2>如果是Gbit以太网,总带宽可达16Gbit/s。
  ②EtherChannel不支持10M端口;
  ③EtherChannel编号只在本地有效,链路两端的编号可以不一样;
  ④EtherChannel默认使用PAgP协议;
  ⑤EtherChannel默认情况下是基于源MAC地址的负载平衡;
  ⑥一个EtherChannel内所有的端口都必须具有相同的端口速率和双工模式,LACP只能是全双工模式;
  ⑦channel-group接口会自动继承最小物理接口,或最先配置的接口模式;
  ⑧cisco的交换机不仅可以支持第二层EtherChannel,还可以支持第三层EtherChannel。

 EtherChannel配置要求:
  所有接口在一个EtherChannel中必须拥有同样的配置
  相同的双工和速率
  端口模式(Access或Trunk)
  Trunk端口的NativeVlan和allowed Vlan
  Access Vlan on access ports

 两台交换机之间是否形成EtherChannel可以用协议自动协商,目前有两个协商协议:
  Cisco:PAgP (端口汇聚协议 Port Aggregation Protocol)
  IEEE :LACP (链路汇聚控制协议 Link Aggregation Control Protocol)

 能形成EtherChannel的模式总结:

 EtherChannel命令组合:
  如果想把端口配置为on:

sw1(config-if-range)#channel-group 1 mode on

  如果想把端口配置为PAgP的desirable:

sw1(config-if-range)#channel-protocol pagp 
sw1(config-if-range)#channel-group 1 mode desirable 

  如果想把端口配置为PAgP的auto:

sw1(config-if-range)#channel-protocol pagp 
sw1(config-if-range)#channel-group 1 mode auto 

  如果想把端口配置为LACP的active:

sw1(config-if-range)#channel-protocol lacp 
sw1(config-if-range)#channel-group 1 mode active 

  如果想把端口配置为LACP的passive:

sw1(config-if-range)#channel-protocol lacp 
sw1(config-if-range)#channel-group 1 mode passive

EtherChannel实验

PAgP配置

S1(config)#interface range fastEthernet 0/1-6  //进入要捆绑的端口
S1(config-if-range)#channel-group 1 mode desirable  //将物理接口指定到已创建的通道中,模式为desirable
S1(config-if-range)#exit
S1(config)#interface port-channel 1  //创建以太通道,编号为1
S1(config-if)#switchport mode trunk  //配置为Trunk模式
S1(config-if)#switchport nonegotiate    //命令"nonegotiate"会禁用协商,阻止交换机试图自动检测链路类型,以及自动设置中继。
Core(config)#interface range fastEthernet 0/1-6
Core(config-if-range)#channel-group 1 mode desirable
Core(config-if-range)#exit
Core(config)#interface port-channel 1
Core(config-if)#switchport trunk encapsulation dot1q  //三层交换机需要配置Trunk封装
Core(config-if)#switchport mode trunk
Core(config-if)#switchport nonegotiate

说明:创建以太通道时要指定一个唯一的通道编号,编号范围是1-6的整数,这个编号只有本地有效,因此链路两端的编号可以不一样;

LACP配置

S1(config)#interface range fastEthernet 0/1-6
S1(config-if-range)#channel-group 1 mode active	//跟PAgP区别仅在于此
S1(config-if-range)#exit
S1(config)#interface port-channel 1
S1(config-if)#switchport mode trunk
S1(config-if)#switchport nonegotiate
Core(config)#interface range fastEthernet 0/1-6
Core(config-if-range)#channel-group 1 mode active
Core(config-if-range)#exit
Core(config)#interface port-channel 1
Core(config-if)#switchport trunk encapsulation dot1q  //三层交换机需要配置Trunk封装
Core(config-if)#switchport mode trunk
Core(config-if)#switchport nonegotiate

实验调试

show etherchannel summary        //查看EtherChannel信息

show etherchannel port-channel        //查看指定的EtherChannel包含的接口

sw1#show etherchannel protocol        //显示各个Channel-group使用的协商协议
sw1#show interface port-channel 1      //查看以太通道 1 状态

接口如果进入err-disable状态有两种方法恢复:
①手动恢复:先shutdown,再no shutdown;
②自动恢复:errdisable recovery cause {all|arp-inspection|bpduguard|link-flap} 指定原因
      errdisable recovery interval 30 指定自动恢复时间间隔

posted @ 2015-01-29 09:43  airoot  阅读(670)  评论(0编辑  收藏  举报