思科模拟器 交换机链路聚合(二层、三层)

端口聚合工作原理
将连接多个物理链路的端口捆绑在一起形成一个逻辑端口,这个逻辑端口成为聚合端口(AP)。聚合端口AP的功能遵循IEEE802.3ad标准,目标是扩展链路带宽,提高链路可靠性。
端口聚合条件:
一般交换机最多支持8个物理端口组成一个聚合端口,同时要满足以下条件:
1、物理端口速度相同;
2、物理端口介质相同;
3、物理端口层次一致;
4、AP成员端口必须属于同一个VLAN。

端口聚合又称链路捆绑,分为二层端口聚合和三层端口聚合。二层端口聚合针对二层交换机,交换机接口只能是二层性质的,接口链路类型可以设置为trunk和access,形成的链路不带IP地址功能。三层聚合端口也称为路由聚合端口,针对三层交换机,形成的链路带IP地址功能,则不能设置链路类型为trunk和access。原文链接:https://blog.csdn.net/STARDEIT/article/details/119833428

二层聚合端口配置
配置二层聚合端口的过程:
1、创建聚合端口
2、将端口绑定到聚合端口
3、设置聚合端口类型

下面是以思科模拟器为例做二层聚合端口操作步骤:
1、创建聚合组进入聚合接口模式(全局模式)
Switch(config)#interface port-channel 1
2、将端口绑定到聚合端口(接口模式)
Switch(config)#int range f0/1-3
Switch(config-if-range)#channel-group 1 mode on
channel-group指定当前端口要加入到的聚合组(聚合端口ID)
3、聚合接口下端口配置(聚合接口模式)
Switch(config)#int port-channel 1
Switch(config-if)#switchport mode trunk

二层实例
思科模拟器 交换机链路聚合(二层、三层)_第1张图片

交换机switch0的配置

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int port-channel 1
Switch(config-if)#exit
Switch(config)#int range f0/2-3
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

Switch(config-if-range)#exit
Switch(config)#int port-channel 1
Switch(config-if)#switchport mode trunk

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

交换机switch1的配置

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int port-channel 1
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#int range f0/2-3
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%EC-5-CANNOT_BUNDLE2: Fa0/2 is not compatible with Po1 and will be suspended (vlan mask is different)

%LINK-5-CHANGED: Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

三层聚合端口配置
配置三层聚合端口的过程:
1、创建聚合端口,并将类型设置为三层端口(路由端口),并为其配置IP地址。
2、将需要加入的物理端口类型设置为三层端口。
3、将需要加入的物理端口加入到聚合端口。
4、如有不同网段的信息通信,需要开启路由,并做路由配置。

下面是以思科模拟器为例做二层聚合端口操作步骤:
1、创建聚合组进入聚合接口模式(全局模式)
Switch(config)#interface port-channel 1
2、将端口绑定到聚合端口(接口模式)
Switch(config)#int range f0/1-3
Switch(config-if-range)#channel-group 1 mode on
channel-group指定当前端口要加入到的聚合组(聚合端口ID)
3、聚合接口下端口配置(聚合接口模式)
Switch(config)#int port-channel 1
Switch(config-if)#switchport mode trunk
4、全局模式下开启路由功能
Switch(config)#ip routing
Switch(config)#ip route 192.168.1.0 255.255.255.0 192.168.12.1

三层实例
思科模拟器 交换机链路聚合(二层、三层)_第2张图片
交换机switch0的配置代码

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int vlan 1
Switch(config-if)#ip add 192.168.1.1 255.255.255.0
Switch(config-if)#no shutdown 
Switch(config-if)#exit
Switch(config)#int port-channel 1
Switch(config-if)#no switchport 
Switch(config-if)#ip add 192.168.12.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int range f0/1-3
Switch(config-if-range)#no switchport 
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

Switch(config-if-range)#exit
Switch(config)#ip routing 
Switch(config)#ip route 192.168.2.0 255.255.255.0 192.168.12.2
Switch(config)#
%LINK-5-CHANGED: Interface FastEthernet0/5, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/5, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

交换机switch1的配置代码:

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#int vlan 2
Switch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#no shutdown 
Switch(config-if)#int f0/4
Switch(config-if)#sw acc vlan 2
Switch(config-if)#exit
Switch(config)#int port-channel 1
Switch(config-if)#no switchport 
Switch(config-if)#ip add 192.168.12.2 255.255.255.0
Switch(config-if)#int range f0/1-3
Switch(config-if-range)#no switchport 
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

Switch(config-if-range)#exit
Switch(config)#ip routing 
Switch(config)#ip route 192.168.1.0 255.255.255.0 192.168.12.1
Switch(config)#end
Switch#sh ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

S    192.168.1.0/24 [1/0] via 192.168.12.1
C    192.168.2.0/24 is directly connected, Vlan2
C    192.168.12.0/24 is directly connected, Port-channel 1

你可能感兴趣的