目的是达到了,具体对不对咱也不知道啊,麻烦大神有时间指点一下_第1张图片
sw2:
sys
[Huawei]sys sw2
[sw2]vlan batch 10 20
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 10
[sw2-Ethernet0/0/1]int e0/0/2
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]port default vlan 20
[sw2-Ethernet0/0/2]int e0/0/3
[sw2-Ethernet0/0/3]port link-type trunk
[sw2-Ethernet0/0/3]port trunk allow-pass vlan all

sw3:
sys
[Huawei]sys sw3
[sw3]vlan batch 30 40
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type access
[sw3-Ethernet0/0/1]port default vlan 30
[sw3-Ethernet0/0/1]int e0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 40
[sw3-Ethernet0/0/2]int e0/0/3
[sw3-Ethernet0/0/3]port link-type trunk
[sw3-Ethernet0/0/3]port trunk allow-pass vlan all

sw1:
sys
[Huawei]sys sw1
[sw1]dhcp enable
[sw1]vlan batch 2 10 20 30 40
[sw1]int Vlanif 10
[sw1-Vlanif10]ip add 192.168.10.1 24
[sw1-Vlanif10]dhcp select relay
[sw1-Vlanif10]dhcp relay server-ip 192.168.1.2
[sw1-Vlanif10]int Vlanif 20
[sw1-Vlanif20]ip add 192.168.20.1 24
[sw1-Vlanif20]dhcp select relay
[sw1-Vlanif20]dhcp relay server-ip 192.168.1.2
[sw1-Vlanif20]int Vlanif 30
[sw1-Vlanif30]ip add 192.168.30.1 24
[sw1-Vlanif30]dhcp select relay
[sw1-Vlanif30]dhcp relay server-ip 192.168.1.2
[sw1-Vlanif30]int vl 40
[sw1-Vlanif40]ip add 192.168.40.1 24
[sw1-Vlanif40]dhcp select relay
[sw1-Vlanif40]dhcp relay server-ip 192.168.1.2
[sw1-Vlanif40]q
[sw1]port-group 1
[sw1-port-group-1]group-member g0/0/1 g0/0/2
[sw1-port-group-1]port link-type trunk
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-port-group-1]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[sw1-port-group-1]q
[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port default vlan 2
[sw1-GigabitEthernet0/0/3]int vl 2
[sw1-Vlanif2]ip address 192.168.1.1 24
[sw1-Vlanif2]dhcp select global

ar1:
sys
[Huawei]sys ar1
[ar1]dhcp enable
[ar1]int g0/0/0
[ar1-GigabitEthernet0/0/0]ip address 192.168.1.2 24
[ar1-GigabitEthernet0/0/0]dhcp select global
[ar1-GigabitEthernet0/0/0]q
[ar1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
[ar1]ip pool p1
[ar1-ip-pool-p1]network 192.168.10.0 mask 24
[ar1-ip-pool-p1]gateway-list 192.168.10.1
[ar1-ip-pool-p1]ip pool p2
[ar1-ip-pool-p2]network 192.168.20.0 mask 24
[ar1-ip-pool-p2]gateway-list 192.168.20.1
[ar1-ip-pool-p2]ip pool p3
[ar1-ip-pool-p3]network 192.168.30.0 mask 24
[ar1-ip-pool-p3]gateway-list 192.168.30.1
[ar1-ip-pool-p3]ip pool p4
[ar1-ip-pool-p4]network 192.168.40.0 mask 24
[ar1-ip-pool-p4]gateway-list 192.168.40.1