Eth-Trunk端口汇聚
链路汇聚和端口汇聚,就是端口聚合,交换机的堆叠是堆叠和端口聚合无关。
端口聚合概念:(包括二层端口聚合和三层端口聚合)
1.端口聚合IEEE标准是将最多16条链路聚合成一个逻辑的链路。其中只有8条可以使用,
其余8条作为备份。
2.做聚合的端口配置,物理介质性质(双工模式,接口带宽等等)必须一样
3.端口聚合可以提高带宽,但是不是物理上的提高,而是基于负载均衡的提高
4.做端口聚合的端口只能以2的倍数个链路做聚合,即只能2、4、6、8条链路做聚合,
不能是奇数链路做聚合
Eth-Trunk简单端口汇聚:(本地负载均衡)
SW1:
[SW1]interface Eth-Trunk 1 #建立汇聚端口1
[SW1-Eth-Trunk1]port link-type access #更改端口为访问端口,如果下面是两台交换机,则需要更改为port link-type trunk模式。
[SW1-Eth-Trunk1]mode manual load-balance #添加手动本地负载模式
[SW1-Eth-Trunk1]quit
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]eth-trunk1 #将端口0/0/1加入eth-trunk1
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]eth-trunk1 #将端口0/0/2加入eth-trunk1
[SW1]interface vlan 1
[SW1-Vlanif1]ip address 192.168.1.254255.255.255.0
[SW1-Vlanif1]quit
SW2:
[SW2]interface vlan 1
[SW2-Vlanif1]ip add
[SW2-Vlanif1]ip address 192.168.1.1255.255.255.0
[SW2-Vlanif1]quit
通过抓包验证时如果断开GigabitEthernet 0/0/1接口下连线的情况下,会自动切换到GigabitEthernet 0/0/2端口下进行通信。
删除端口下trunk的正确方法:
(因为端口默认是在vlan1的,如果删除了全部,端口就没有默认vlan1的配置了,需要重新加回来,才可以继续下一步的删除。)
[SWH1]interfaceGigabitEthernet 0/0/2
[SWH1-GigabitEthernet0/0/2]undoport trunk allow-pass vlan all
[SWH1-GigabitEthernet0/0/2]porttrunk allow-pass vlan 1
[SWH1-GigabitEthernet0/0/2]undoport link-type
[SWH1-GigabitEthernet0/0/2]quit
Eth-Trunk不同或者相同的vlan间互通:
准备:
192.168.10.23/24
192.168.20.99/24
192.168.30.45/24 Gateway:192.168.X.1/24
这三台电脑都为测试使用,其实直接用交换进行ping也可以进行测试,纯属个人习惯。
VLAN: 10 20 30
Vlanif10:192.168.10.254/24
Vlanif20:192.168.20.254/24
Vlanif30:192.168.30.254/24
配置:
SWH1:
[SWH1]vlan batch 10 20 30
[SWH1]interface vlan 10
[SWH1-Vlanif10]ip address192.168.10.254 24
[SWH1-Vlanif10]ip address 192.168.20.254 24
[SWH1-Vlanif10]ip address 192.168.30.254 24
[SWH1-Vlanif10]quit
[SWH1]interface Eth-Trunk 1
[SWH1-Eth-Trunk1]port link-type trunk
[SWH1-Eth-Trunk1]port trunk allow-pass vlanall
[SWH1-Eth-Trunk1]mode manual load-balance
[SWH1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1
[SWH1-Eth-Trunk1]trunkport GigabitEthernet 0/0/4
[SWH1]interface vlan 20
[SWH1-Vlanif20]ip address 192.168.20.254 24
[SWH1]interface Eth-Trunk 2
[SWH1-Eth-Trunk2]port link-type trunk
[SWH1-Eth-Trunk2]port trunk allow-pass vlanall
[SWH1-Eth-Trunk2]mode manual load-balance
[SWH1-Eth-Trunk2]trunkport GigabitEthernet 0/0/2
[SWH1-Eth-Trunk2]trunkport GigabitEthernet 0/0/5
[SWH1]interface vlan 30
[SWH1-Vlanif30]ip address 192.168.30.254 24
[SWH1]interface Eth-Trunk 3
[SWH1-Eth-Trunk3]port link-type trunk
[SWH1-Eth-Trunk3]port trunk allow-pass vlanall
[SWH1-Eth-Trunk3]mode manual load-balance
[SWH1-Eth-Trunk3]trunkport GigabitEthernet 0/0/3
[SWH1-Eth-Trunk3]trunkport GigabitEthernet 0/0/6
[SWH1]interface GigabitEthernet 0/0/24
[SWH1-GigabitEthernet0/0/24]port link-type access
[SWH1-GigabitEthernet0/0/24]port default vlan 10
[SWH1-GigabitEthernet0/0/24]quit
SWH4:
[SWH4]vlan batch 10 20 30
[SWH4]interface Ethernet 0/0/22
[SWH4-Ethernet0/0/22]port link-type access
[SWH4-Ethernet0/0/22]port default vlan 20
[SWH4-Ethernet0/0/22]quit
[SWH4]interface vlan 20
[SWH4-Vlanif20]ip address192.168.20.1 255.255.255.0
[SWH4-Vlanif20]quit
[SWH4]interface Eth-Trunk 2
[SWH4-Eth-Trunk2]trunkport GigabitEthernet0/0/1
[SWH4-Eth-Trunk2]trunkport GigabitEthernet0/0/2
[SWH4-Eth-Trunk2]port link-type trunk
[SWH4-Eth-Trunk2]port trunk allow-pass vlanall
[SWH4-Eth-Trunk2]mode manual load-balance
[SWH4-Eth-Trunk2]quit
[SWH4]iproute-static 192.168.10.0 24 192.168.20.254
[SWH4]iproute-static 192.168.30.0 24 192.168.20.254
SWH5:
跟SWH4的配置是一样的,就是最后的静态路由改变了。
[SWH5]vlan batch 10 20 30
[SWH5]interface Eth-Trunk 3
[SWH5-Eth-Trunk3]trunkport GigabitEthernet0/0/1
[SWH5-Eth-Trunk3]trunkport GigabitEthernet0/0/2
[SWH5-Eth-Trunk3]port link-type trunk
[SWH5-Eth-Trunk3]port trunk allow-pass vlanall
[SWH5-Eth-Trunk3]mode manual load-balance
[SWH5-Eth-Trunk3]quit
[SWH5]interface vlan 30
[SWH5-Vlanif30]ip address 192.168.30.1 255.255.255.0
[SWH5-Vlanif30]quit
[SWH5]ip route-static192.168.10.0 24 192.168.30.254
[SWH5]ip route-static 192.168.20.0 24192.168.30.254
SWH3:
跟SWH4的配置是一样的,就是最后的静态路由改变了。
[SWH3]vlan batch 10 20 30
[SWH3]interface Eth-Trunk 1
[SWH3-Eth-Trunk1]trunkport GigabitEthernet0/0/1
[SWH3-Eth-Trunk1]trunkport GigabitEthernet0/0/2
[SWH3-Eth-Trunk1]port link-type trunk
[SWH3-Eth-Trunk1]port trunk allow-pass vlanall
[SWH3-Eth-Trunk1]mode manual load-balance
[SWH3-Eth-Trunk1]quit
[SWH3]interface vlan 10
[SWH3-Vlanif10]ip address 192.168.10.1 255.255.255.0
[SWH5-Vlanif10]quit
[SWH3]ip route-static192.168.30.0 24 192.168.10.254
[SWH3]ip route-static 192.168.20.0 24192.168.10.254
检测都可以ping通,且抓包可以实现自动切换。
注意:在本地配置Eth-Trunk的时候,在对端也要进行Eth-Trunk的配置,且加上路由就可以实现不同网段间的互通。