拓扑图如下:
一、交换机 LSW1 完整配置
sysname LSW1
# 创建VLAN
vlan batch 10 20 30 40
# 配置链路聚合Eth-Trunk(三条捆绑,LACP模式)
interface Eth-Trunk 1
mode lacp-staticport link-type trunk
port trunk allow-pass vlan 10 20 30 40
# 把3个物理口加入聚合组
interface GigabitEthernet 0/0/1
eth-trunk 1
interface GigabitEthernet 0/0/2
eth-trunk 1
interface GigabitEthernet 0/0/3
eth-trunk 1
# PC1接入口 Access VLAN10
interface GigabitEthernet 0/0/4
port link-type access
port default vlan 10
# PC2接入口 Access VLAN20
interface GigabitEthernet 0/0/5
port link-type access
port default vlan 20
二、交换机 LSW2 完整配置
sysname LSW2
vlan batch 10 20 30 40
# 链路聚合Eth-Trunk1 和LSW1对接
interface Eth-Trunk 1
mode lacp-staticport link-type trunk
port trunk allow-pass vlan 10 20 30 40
interface GigabitEthernet 0/0/2
eth-trunk 1
interface GigabitEthernet 0/0/3
eth-trunk 1
interface GigabitEthernet 0/0/4
eth-trunk 1
# 上行连接AR1,Trunk允许所有业务VLAN,用于单臂路由
interface GigabitEthernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
# PC3接入 VLAN30
interface GigabitEthernet 0/0/5
port link-type access
port default vlan 30
# PC4接入 VLAN40
interface GigabitEthernet 0/0/6
port link-type access
port default vlan 40
三、路由器 AR1 完整配置(单臂路由 + 静态路由)
sysname AR1
# 路由器互联接口AR1<->AR2
interface GigabitEthernet 0/0/0
ip address 12.1.1.1 255.255.255.0
# 单臂路由主接口(先开直通,不配置IP)
interface GigabitEthernet 0/0/1
undo shutdown
# 子接口VLAN10
interface GigabitEthernet 0/0/1.10
dot1q termination vid 10
ip address 192.168.10.1 255.255.255.0
arp broadcast enable
# 子接口VLAN20
interface GigabitEthernet 0/0/1.20
dot1q termination vid 20
ip address 192.168.20.1 255.255.255.0
arp broadcast enable
# 子接口VLAN30
interface GigabitEthernet 0/0/1.30
dot1q termination vid 30
ip address 192.168.30.1 255.255.255.0
arp broadcast enable
# 子接口VLAN40
interface GigabitEthernet 0/0/1.40
dot1q termination vid 40
ip address 192.168.40.1 255.255.255.0
arp broadcast enable
# 静态路由:去往右侧50、60网段,下一跳AR2 12.1.1.2
ip route-static 192.168.50.0 255.255.255.0 12.1.1.2
ip route-static 192.168.60.0 255.255.255.0 12.1.1.2
四、交换机 LSW3 完整配置
sysname LSW3
vlan batch 50 60
# 上行连接AR2,Trunk
interface GigabitEthernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 50 60
# PC5 VLAN50
interface GigabitEthernet 0/0/2
port link-type access
port default vlan 50
# PC6 VLAN60
interface GigabitEthernet 0/0/3
port link-type access
port default vlan 60
五、路由器 AR2 完整配置(单臂路由 + 回程静态路由)
sysname AR2
# 和AR1互联接口
interface GigabitEthernet 0/0/0
ip address 12.1.1.2 255.255.255.0
# 单臂路由主接口
interface GigabitEthernet 0/0/1
undo shutdown
# 子接口VLAN50
interface GigabitEthernet 0/0/1.50
dot1q termination vid 50
ip address 192.168.50.1 255.255.255.0
arp broadcast enable
# 子接口VLAN60
interface GigabitEthernet 0/0/1.60
dot1q termination vid 60
ip address 192.168.60.1 255.255.255.0
arp broadcast enable
# 回程静态路由:去往左侧10/20/30/40网段,下一跳AR1 12.1.1.1
ip route-static 192.168.10.0 255.255.255.0 12.1.1.1
ip route-static 192.168.20.0 255.255.255.0 12.1.1.1
ip route-static 192.168.30.0 255.255.255.0 12.1.1.1
ip route-static 192.168.40.0 255.255.255.0 12.1.1.1
六、验证排错命令(配置完成后排查)
交换机查看聚合: display eth-trunk
交换机查看 VLAN 端口:display port vlan
路由器查看路由表: display ip routing-table
查看子接口状态: display ip interface brief
互通测试:PC 互相 ping 跨网段 IP