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命令相同
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!