创新|开发|定制
专注于软路由|网络技术领域

华为交换机 DHCP中继全局不同网段配置

一、组网需求

1、DHCP作为公司汇聚交换机,在上面配置DHCP全局地址池,然后接入交换机根据不同vlan会获取到不同网段IP地址。

2、网络拓扑

二、操作步骤

1、客户端
1)创建DHCP服务器组,并为DHCP服务器组添加DHCP服务器对应网段的网关IP
<Huawei>system-view 
[Huawei]sysname Client
[Client]dhcp server group dhcp1
[Client-dhcp-server-group-dhcp1]dhcp-server 192.168.1.1
[Client-dhcp-server-group-dhcp1]q
[Client]dhcp server group dhcp2
[Client-dhcp-server-group-dhcp2]dhcp-server  192.168.2.1
[Client-dhcp-server-group-dhcp2]q
2)创建vlan
[Client]vlan batch 10 20
3)使能全局DHCP功能
[Client]dhcp enable
4)开启vlanif中继功能并配置接口IP,指定DHCP服务器。
[Client]interface  Vlanif 10
[Client-Vlanif10]dhcp select relay 
[Client-Vlanif10]ip address  192.168.1.2 24
[Client-Vlanif10]dhcp relay server-select  dhcp1
[Client-Vlanif10]q
[Client]interface  Vlanif  20
[Client-Vlanif20]dhcp select relay 
[Client-Vlanif20]ip address  192.168.2.2 24
[Client-Vlanif20]dhcp relay  server-select  dhcp2
[Client-Vlanif20]q
5)配置接口
[Client]interface  GigabitEthernet  0/0/1
[Client-GigabitEthernet0/0/1]port link-type trunk 
[Client-GigabitEthernet0/0/1]port trunk  allow-pass vlan all 
[Client-GigabitEthernet0/0/1]q
[Client]interface  GigabitEthernet  0/0/2
[Client-GigabitEthernet0/0/2]port link-type access  
[Client-GigabitEthernet0/0/2]port default  vlan  10
[Client-GigabitEthernet0/0/2]q
[Client]interface  GigabitEthernet  0/0/3
[Client-GigabitEthernet0/0/3]port link-type access  
[Client-GigabitEthernet0/0/3]port default  vlan  20
[Client-GigabitEthernet0/0/3]q
2、DHCP服务器
1)使能DHCP
<Huawei>system-view 
[Huawei]sysname DHCP 
[DHCP]dhcp enable 
2)创建vlan,配置IP地址,并让vlan接口下的客户端从全局地址池中获取IP
[DHCP]vlan batch 10 20
[DHCP]interface  Vlanif 10
[DHCP-Vlanif10]ip address  192.168.1.1 24
[DHCP-Vlanif10]dhcp select global 
[DHCP-Vlanif10]q
[DHCP]interface Vlanif 20
[DHCP-Vlanif20]ip address  192.168.2.1 24
[DHCP-Vlanif20]dhcp select global 
[DHCP-Vlanif20]q
3)配置全局地址池
[DHCP]ip pool 1
[DHCP-ip-pool-1]network 192.168.1.0 mask  24
[DHCP-ip-pool-1]gateway-list 192.168.1.1
[DHCP-ip-pool-1]lease day 1
[DHCP-ip-pool-1]q
[DHCP]ip pool 2
[DHCP-ip-pool-2]network 192.168.2.0 mask  24
[DHCP-ip-pool-2]gateway-list  192.168.2.1 
[DHCP-ip-pool-2]lease day 1
[DHCP-ip-pool-2]q
4)配置接口
[DHCP]interface  GigabitEthernet  0/0/1
[DHCP-GigabitEthernet0/0/1]port link-type trunk 
[DHCP-GigabitEthernet0/0/1]port trunk allow-pass vlan  all 
[DHCP-GigabitEthernet0/0/1]q
3、验证
1)PC设置自动获取IP
2)ping测试
赞(1) 打赏
转载请注明出处:Ros资源网 » 华为交换机 DHCP中继全局不同网段配置

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏