配置服务器
1 . 开启交换机的DHCP服务。
[huawei]dhcp enable
2 . 配置地址池。
[huawei]ip pool vlan500
[huawei-ip-pool-vlan500]network 192 . 168 . 200 . 10 mask 255 . 255 . 255 . 0
[huawei-ip-pool-vlan500]dns-list 8 . 8 . 8 . 8 114 . 114 . 114 . 114
[huawei-ip-pool-vlan500]gateway-list 192 . 168 . 200 . 1
3 . 进入vlan接口开启该lan dhcp功能。
[huawei]interface vlanif 10
[huawei]dhcp select global
4 . 将端口加入vlan500 使其成为一个组可以拥有自动获取IP得权力。
[sw1]interface GigabitEthernet 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 500
[sw1]interface GigabitEthernet 0/0/3
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 500
5. 查看配置信息。
[huawei]display ip pool name 8
配置DHCP
配置两个地址池:192 . 168 . 1 . 0/24和192 . 168 . 2 . 0/24
配置两个VLAN:10和20
将四台主机分别加入VLAN
自动获取IP地址,确保全网互通。
步骤:
[DHCP]DHCP enable
打开DHCP功能
[DHCP]vlan batch 10 20
[DHCP]ip pool vlan10
[DHCP]gateway-list 192 . 168 . 1 . 254
[DHCP]network 192 . 168 . 1 . 0 mask 255 . 255 . 255 . 0
[DHCP]lease day 3
[DHCP]dns-list 8 . 8 . 8 . 8/
[DHCP]ip pool VLAN 20
[DHCP]gateway-list 192 . 168 . 2 . 254
[DHCP]network 192 . 168 . 2 . 0 mask 255 . 255 . 255 . 0
[DHCP]lease day 3
[DHCP]dns-list 8 . 8 . 8 . 8/
在服务器上创建VLAN10;20;IP地址池VLAN 10和IP地址池 VLAN 20 .
[DHCP]interface vlanif10
[DHCP]ip address 192 . 168 . 1 . 254 255 . 255 . 255 . 0
[DHCP]dhcp select global
[DHCP] interface vlanif20
[DHCP]ip address 192 . 168 . 2 . 254 255 . 255 . 255 . 0
[DHCP]dhcp select global
给VLAN10,VLAN20配置IP/
[DHCP]interface gi0/0/1
[DHCP]port link-type trunk
[DHCP]port trunk allow-pass all
[DHCP]interface gi0/0/2
[DHCP]port link-type trunk
[DHCP]port trunk allow-pass all
给DHCP服务器1口和2口配置trunk链路
[SW1]vlan batch 10 20
[SW1]interface gi0/1
[SW1]port link-type access
[SW1]port default vlan 10
[SW1]interface gi0/2
[SW1]port link-type access
[SW1]port default vlan 10
[SW1]interface gi0/3
[SW1]port link-type trunk
[SW1]port trunk allow-pass all
在交换机一上把端口1;2加入VLAN 10;端口3设置成trunk链路
[SW1]DHCP enable
打开DHCP功能。///
交换机二也做相同操作;
验证测试保存
相关课程内容推荐
华为认证入门:hcia和hcna的区别
思博华为认证课程安排表: HCIA-DATACOM课表 | HCIA-云计算课表
华为399限额限时活动入门课程:HCIA课程
华为HCIA含金量分析:HCIA认证考试有用吗?
华为认证考试怎么考:如何参加华为认证考试?