第一步打开pc的DHCP模式
交换机配置:
<Huawei>sys
[Huawei]vlan batch 10 (创建vlan10)
[Huawei]int e0/0/1 进入(e接口)
[Huawei-Ethernet0/0/1]port link-type access (在此接口建立模式类型为access)
[Huawei-Ethernet0/0/1]port default vlan 10 (将vlan10添加到e0/0/1端口上)
[Huawei-Ethernet0/0/1]int e0/0/2 (进入接口)
[Huawei-Ethernet0/0/2]port link-type access (在此接口建立模式类型为access)
[Huawei-Ethernet0/0/2]port default vlan 10 (将vlan10添加到e0/0/2端口上)
[Huawei-Ethernet0/0/2]int e0/0/3 (进入接口)
[Huawei-Ethernet0/0/3]port link-type access (在此接口建立模式类型为access)
[Huawei-Ethernet0/0/3]port default vlan 10 (将vlan10添加到e0/0/3端口上,允许交换机通过vlan10访问路由器)交换机与pc端路由器的接口模式都为access,交换机之间为trunk
路由器配置:
<Huawei>sys
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.1 24 (在这个端口上面添加IP地址)
[Huawei-GigabitEthernet0/0/0]q
[Huawei]ip pool vlan10 (建立vlan10的地址池)
[Huawei-ip-pool-vlan10]net 192.168.1.2 mask 24 (添加网络地址 子网掩码为24)
[Huawei-ip-pool-vlan10]gateway-list 192.168.1.254 (添加网关)
[Huawei-ip-pool-vlan10]excluded-ip-address 192.168.1.2 192.168.1.250 (ip地址范围在这个网段为1.2-1.250之间所有的地址)
[Huawei-ip-pool-vlan10]dns-list 8.8.8.8 (服务器解析地址8.8.8.8)
[Huawei-ip-pool-vlan10]q
[Huawei]dhcp en
[Huawei]dhcp enable (先打开DHCP模式)
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global (再在这个端口模式下选择全局模式)
查看结果: