sw1命令如下
<Huawei>sys //进入特权模式
[SW1]sys SW1 //设备命名SW1
[sw1]vlan batch 10 20 100 200 //批量创建vlan
[sw1]int g0/0/1 // 进入接口g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk //设置接口状态为trunk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all //允许通过的vlan
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/2]int g0/0/3
[sw1-GigabitEthernet0/0/3]po l t
[sw1-GigabitEthernet0/0/3]po t al vlan all
[sw1-GigabitEthernet0/0/3]int g0/0/4
[sw1-GigabitEthernet0/0/4]po l t
[sw1-GigabitEthernet0/0/4]po t al vlan all
[sw1]stp enable //开启stp生成树,默认开启(红色部分可省略)
[sw1]stp mode stp
sw1] dhcp enable //开启dhcp enable,默认关闭,好久没做都忘了
[sw1]ip pool dhcp10 //创建dhcp10为名字的地址池,
[sw1-ip-pool-dhcp10]gateway-list 192.168.10.254 //设置为网关
[sw1-ip-pool-dhcp10]network 192.168.10.0 m 24 //设置网段范围及掩码 m=mask(掩码)
[sw1]ip pool dhcp20 //跟上面的一样
[sw1-ip-pool-dhcp20]gateway-list 192.168.20.254
[sw1-ip-pool-dhcp20]network 192.168.20.0 m 24
[sw1-ip-pool-dhcp20]ip pool dhcp100
[sw1-ip-pool-dhcp100]gateway-list 192.168.100.254
[sw1-ip-pool-dhcp100]network 192.168.100.0 m 24
[sw1-ip-pool-dhcp100]ip pool dhcp200
[sw1-ip-pool-dhcp200]gateway-list 192.168.200.254
[sw1-ip-pool-dhcp200]network 192.168.200.0 m 24
[sw1-ip-pool-dhcp200]int vlan 10 //进入三层vlan接口
[sw1-Vlanif10]dhcp select global //分配方式为全局分配
[sw1-Vlanif10]ip add 192.168.10.254 24 //网关地址
[sw1-Vlanif10]dhcp select global
[sw1-Vlanif10]dis this //看这个模式下配置那些命令
ip address 192.168.10.254 255.255.255.0
dhcp select global
[sw1-Vlanif10]int vlan 20
[sw1-Vlanif20]dhcp select global
[sw1-Vlanif20]ip add 192.168.20.254 24
[sw1-Vlanif20]int vlan 100
[sw1-Vlanif100]ip add 192.168.100.254 24
[sw1-Vlanif100]dhcp select global
[sw1-Vlanif100]int vlan 200
[sw1-Vlanif200]ip add 192.168.200.254 24
[sw1-Vlanif200]dhcp selec global
<sw1>sa //保存
Are you sure to continue?[Y/N]y //Y=yes
SW2配置如下:<Huawei>sys
[Huawei]sys SW2
[SW2]undo in en //关闭提示,不然会很烦人
Info: Information center is disabled.
[SW2]sys SW2
[SW2]vlan batch 10 20
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk al vlan all
[SW2-GigabitEthernet0/0/1]int e0/0/1
[SW2-Ethernet0/0/1]port link-type access
[SW2-Ethernet0/0/1]po de vlan 10
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]po l a
[SW2-Ethernet0/0/2]po de vlan 20
<SW2>sa
Are you sure to continue?[Y/N]y
SW4命令如下[Huawei]sys
[Huawei]sysname sw4
[sw4]vlan b 100 200
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw4]int g0/0/1
[sw4-GigabitEthernet0/0/1]po l t
[sw4-GigabitEthernet0/0/1]po t al vlan all
[sw4-GigabitEthernet0/0/1]int e0/0/1
[sw4-Ethernet0/0/1]po l a
[sw4-Ethernet0/0/1]po de vlan 100
[sw4-Ethernet0/0/1]int e0/0/2
[sw4-Ethernet0/0/2]po l a
[sw4-Ethernet0/0/2]po de vlan 200
[sw4]stp enable 可不输入红色的命令,默认开启
[sw4]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
<sw4>sa
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
SW2跟SW3命令相同SW4跟SW5命令相同
,