进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]
启用DHCP功能
[Huawei]dhcp enable
查看vlan
[Huawei]display vlan
创建21个Vlan
[Huawei]vlan batch 10 to 30
对Vlan 21进行设置
[Huawei]interface Vlanif 21
[Huawei-Vlanif21]
设置网关
[Huawei-Vlanif21]ip address 192.168.21.254 24
Vlan 21开启DHCP
[Huawei-Vlanif21]dhcp select interface
排除地址(网关不用排除),为起始和终止IP
[Huawei-Vlanif21]dhcp server excluded-ip-address 192.168.21.252 192.168.21.253
设置DNS
[Huawei-Vlanif21]dhcp server dns-list 202.96.134.133
q
批量接口设置
创建接口组
[Huawei]port-group g21
接口组添加接口
[Huawei-port-group-g21]group-member g 0/0/1 to g 0/0/15
设置接口组里的接口类型 access
[Huawei-port-group-g21]port link-type access
接口组指定到所属Vlan
[Huawei-port-group-g21]port default vlan 21
单个接口设置
1.接口设置trunk
[Huawei]interface GigabitEthernet 0/0/24
设置接口类型trunk
[Huawei-GigabitEthernet0/0/24]port link-type trunk
Trunk类型,需要设置允许通过的Vlan,可以用all所有
[Huawei-GigabitEthernet0/0/24]port trunk allow-pass vlan 21
2.接口设置access,并加到相关Vlan
[Huawei]interface GigabitEthernet 0/0/16
[Huawei-GigabitEthernet0/0/16]port link-type access
把16口添加到vlan 21中
[Huawei-port-group-default]port default vlan 21
设置缺省路由
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.254(路由器内网IP)
A,B,C三台三层交换机,网关设置在各自上:B为核心
A:V1-V10 V10 10.1.4.1 255.255.255.252(1-2) ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
B:V10-V21 V10 10.1.4.2 255.255.255.252(1-2) ip route-static A的网段 10.1.4.1
V21 10.1.4.5 255.255.255.252(5-6) ip route-static B的网段 10.1.4.6
V50 路由器R网段的一个IP
ip route-static 0.0.0.0 0.0.0.0 路由器内网IP
C:V21-V30 V21 10.1.4.6 255.255.255.252(5-6) ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
路由器R:所有内网网段->V50的IP