VLAN划分
<Huawei> #视图模式
<Huawei>system-view #进入用户模式
[Huawei] #配置模式
[Huawei]interface Ethernet 0/0/1 #进入接口Ethernet 0/0/1进行配置
[Huawei-Ethernet0/0/1]
#交换机配置
#
interface Ethernet0/0/1
port link-type trunk #配置接口为Trunk模式
port trunk allow-pass vlan 10 20 #划分 划分VLAN10 20
#
interface Ethernet0/0/2
port link-type access #配置接口为Access模式
port default vlan 10 #划分VLAN10
#
interface Ethernet0/0/3
port link-type access #配置接口为Access模式
port default vlan 20 #划分VLAN20
#
interface Ethernet0/0/4
port link-type access #配置接口为Access模式
port default vlan 20 #划分VLAN20
#
单臂路由
#单臂路由
#路由器配置单臂路由:解决不同网段在同一端口中进行通信
[Huawei]interface GigabitEthernet 0/0/0.1 #进入子接口0/0/0.1
[Huawei-GigabitEthernet0/0/0.1]dot1q termination vid 10 #802.1q
[Huawei-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
[Huawei-GigabitEthernet0/0/0.1]arp broadcast enable #打开arp网关广播
[Huawei]interface GigabitEthernet 0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]dot1q termination vid 20
[Huawei-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[Huawei-GigabitEthernet0/0/0.2]arp broadcast enable
#路由器配置查看
interface GigabitEthernet0/0/0.1
dot1q termination vid 10
ip address 192.168.1.254 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/0.2
dot1q termination vid 20
ip address 192.168.2.254 255.255.255.0
arp broadcast enable
#
静态路由
#静态路由
#R1
[Huawei]ip route-static 192.168.4.0 24 192.168.3.2
#R2
[Huawei]ip route-static 192.168.1.0 24 192.168.3.1
[Huawei]ip route-static 192.168.2.0 24 192.168.3.1
#静态路由
#ip route-static 目的网段 目的网段掩码 下一跳地址
#默认/缺省路由
#ip route-static 0.0.0.0 0.0.0.0 下一跳地址
![静态路由测试](https://upload-images.jianshu.io/upload_images/20274834-075093644ab71ce2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
DHCP配置
<Huawei>system-view
[Huawei]dhcp enable
[Huawei]ip pool TK #给地址池命个名,TK为例
[Huawei-ip-pool-TK]gateway-list 192.168.4.254 #设置个网关
[Huawei-ip-pool-TK]network 192.168.4.0 mask 24 #设置地址池范围
[Huawei-ip-pool-TK]quit
[Huawei]interface GigabitEthernet 0/0/0 #设置网关接口
[Huawei-GigabitEthernet0/0/0]ip address 192.168.4.254 255.255.255.0
[Huawei-GigabitEthernet0/0/0]dhcp select global #开启DHCP全局