具體配置指令如下:
因為SW1和SW2的配置指令一樣,是以此處隻是附上配置SW2的代碼
[041740509-sw2]int Eth-Trunk 1
//在交換機上建立vlan接口
[041740509-sw2-Eth-Trunk1]trunkport Ethernet 0/0/1 to 0/0/3
// 并将成員接口加入Eth-Trunk 1
[041740509-sw2-Eth-Trunk1]q
[041740509-sw2]vlan 10 //建立vlan
[041740509-sw2-vlan10]vlan 20
[041740509-sw2-vlan20]int vlan 10 //為VLAN配置ip 位址
[041740509-sw2-Vlanif10]ip add 192.168.10.30 24
[041740509-sw2-Vlanif10]int vlan 20
[041740509-sw2-Vlanif20]ip add 192.168.20.30 24
[041740509-sw2-Vlanif20]q
[041740509-sw2]int e0/0/4 //進入接口
[041740509-sw2-Ethernet0/0/4]port link-type access //設定接口模式
[041740509-sw2-Ethernet0/0/4]port default vlan 10 //将接口加入VLAN 10
[041740509-sw2-Ethernet0/0/4]q
[041740509-sw2]int e0/0/5
[041740509-sw2-Ethernet0/0/5]port link-type access //設定接口模式
[041740509-sw2-Ethernet0/0/5]port default vlan 20 //将接口加入VLAN 20
[041740509-sw2-Ethernet0/0/5]q
[041740509-sw2]int Eth-Trunk 1 //将聚合接口設定為trunk模式
[041740509-sw2-Eth-Trunk1]port link-type trunk
[041740509-sw2-Eth-Trunk1]port trunk allow-pass vlan all
//設定聚合接口允許通過所有VLAN的資料包通過
[041740509-sw2-Eth-Trunk1]load-balance src-dst-mac
[041740509-sw2-Eth-Trunk1]q
[041740509-sw2]int Eth-Trunk 1
[041740509-sw2-Eth-Trunk1]max active-linknumber 2
//配置活動接口上限門檻值為2
[041740509-sw2-Eth-Trunk1]q
[041740509-sw2]int e0/0/1
[041740509-sw2-Ethernet0/0/1]lacp priority 33
//配置系統優先級為33,使其成為LACP 的主動端,即活動接口
[041740509-sw2-Ethernet0/0/1]q
[041740509-sw2]int e0/0/2
[041740509-sw2-Ethernet0/0/2]lacp priority 33
//配置系統優先級為33,使其成為LACP 的主動端,即活動接口,使e0/0/1和e0/0/2成為激活接口,e0/0/3成為備份鍊路
[041740509-sw2-Ethernet0/0/2]q
[041740509-sw2]q
<041740509-sw2>save
相同VLAN 的主機之間的通信:
不同VLAN 的主機之間的通信: