实验拓扑
实验需求
1、C1与C3属于vlan10,C2与C4属于vlan20
2、SW1与SW2之间使用LACP模式链路捆绑,活动接口为2个
3、SW1与R1之间进行链路混绑
4、VLAN 10 与 VLAN 20 通过DHCP自动获取IP地址
5、在R1上配置单臂路由使全网互通
vlan10 IP:192.168.10.0/24
vlan20 IP:192.168.20.0/24
SW1配置:
<SW1>system-view //进入系统视图
[SW1]vlan batch 10 20 //创建vlan
[SW1]inter e0/0/1 //进接口
[SW1-Ethernet0/0/1]port hybrid pvid vlan 10 //为进来的数据包加vlan10标签
[SW1-Ethernet0/0/1]port hybrid untagged vlan 10 //将接口以untagged方式加入vlan10
[SW1-Ethernet0/0/1]quit
[SW1]inter e0/0/2
[SW1-Ethernet0/0/2]port hybrid pvid vlan 20
[SW1-Ethernet0/0/2]port hybrid untagged vlan 20
[SW1-Ethernet0/0/2]quit
[SW1]lacp priority 100 //配置系统优先级为100
[SW1]inter eth-trunk 1 //进入eth-trunk 1
[SW1-Eth-Trunk1]mode lacp-static //设置为lacp模式
[SW1-Eth-Trunk1]max active-linknumber 2 //设置活动接口为2
[SW1-Eth-Trunk1]port hybrid tagged vlan 10 20 //将接口以tagged方式加入到vlan10和vlan20,设置中继
[SW1-Eth-Trunk1]quit
[SW1]interface e0/0/10 //进接口
[SW1-Ethernet0/0/10]eth-trunk 1 //将接口加入eth-trunk
[SW1-Ethernet0/0/10]lacp priority 100 //设置接口优先级为100,默认为32768
[SW1-Ethernet0/0/10]inter e0/0/11
[SW1-Ethernet0/0/11]eth-trunk 1
[SW1-Ethernet0/0/11]inter e0/0/12
[SW1-Ethernet0/0/12]eth-trunk 1
[SW1-Ethernet0/0/12]quit
[SW1]interface Eth-Trunk 2 //进入eth-trunk 2
[SW1-Eth-Trunk2]trunkport GigabitEthernet 0/0/1 0/0/2 //将接口加入到eth-trunk中
[SW1-Eth-Trunk2]port hybrid tagged vlan 10 20 //将接口以tagged方式加入到vlan10和vlan20
SW2配置:
<SW2>system-view
[SW2]vlan batch 10 20
[SW2]inter e0/0/3
[SW2-Ethernet0/0/3]port hybrid pvid vlan 10
[SW2-Ethernet0/0/3]port hybrid untagged vlan 10
[SW2-Ethernet0/0/3]quit
[SW2]interface e0/0/4
[SW2-Ethernet0/0/4]port hybrid pvid vlan 20
[SW2-Ethernet0/0/4]port hybrid untagged vlan 20
[SW2-Ethernet0/0/4]quit
[SW2]interface Eth-trunk 1
[SW2-Eth-Trunk1]mode lacp-static
[SW2-Eth-Trunk1]max active-linknumber 2
[SW2-Eth-Trunk1]trunkport Ethernet 0/0/10 to 0/0/12
[SW2-Eth-Trunk1]port hybrid tagged vlan 10 20
通过display eth-trunk 1 查看端口信息,发现优先级高的e0/0/10,e0/0/11接口被选中为活动接口优先级低的未被
在SW1上关闭一个端口SW1:
[SW1]interface e0/0/10
[SW1-Ethernet0/0/10]shutdown
会发现0/0/10接口关闭了以后 0/0/12接口自动补上了
R1配置:
<R1>system-view
[R1]dhcp enable
[R1]interface Eth-Trunk 1 //进入eth-trunk 1
[R1-Eth-Trunk1]undo portswitch //转换三层口,默认eth-trunk是二层口路由是三层端口要把接口转换成三层接口才可以捆绑
[R1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 0/0/2 //将接口加入eth-trunk
[R1]interface Eth-Trunk 1.10 //进入子接口
[R1-Eth-Trunk1.10]dot1q termination vid 10 //封装dot1q,设置为vlan10的网关
[R1-Eth-Trunk1.10]ip address 192.168.10.1 24 //配置接口IP
[R1-Eth-Trunk1.10]arp broadcast enable //开启ARP广播
[R1-Eth-Trunk1.10]dhcp select interface //采用接口地址池的DHCP功能
[R1-Eth-Trunk1.10]inter eth-trunk 1.20
[R1-Eth-Trunk1.20]dot ter vid 20
[R1-Eth-Trunk1.20]ip add 192.168.20.1 24
[R1-Eth-Trunk1.20]a b e
[R1-Eth-Trunk1.20]dhcp sel int
用PC自动获取DHCP
C2获取
C3获取
C4获取
C1去测试,全网互通