华为设备基于vlan划分的DHCP
华为设备基于VLAN的DHCP 自动分配IP地址设置
操作方法
- 01
首先搭建网络拓扑图,将三台PC机接入交换机,交换机接入路由器。
- 02
在交换机上设备vlan接口,vlan10 vlan20 vlan30 vlan40 ,是PC1接入vlan10,PC2接入vlan20,PC3接入vlan30 ,路由器接入vlan40.
- 03
给每个vlan创建一个网段,VLAN 10 IP 为192. 168.0.0/24网段 VLAN 20 IP为192. 168.1.0 / 24网段,vlan30 IP为192. 168.2.0/24网段,vlan40 IP为172.168. 0.0/24 网段。
- 04
设置每天vlanIF接口为中继,并指定DHCP 地址。如: interface Vlanif10 ip address 192. 168.0.1 255.255.255.0 dhcp select relay dhcp relay server-ip 172. 168.0.2 # interface Vlanif20 ip address 192.168 .1.1 255.255.255.0 dhcp select relay dhcp relay server-ip 172. 168.0.2 # interface Vlanif30 ip address 192. 168. 2.1 255.255.255.0 dhcp select relay dhcp relay server-ip 172 .168.0.2 # interface Vlanif40 ip address 172. 168.0.1 25 5.255.255.0
- 05
在交换机做设置: sysname R1 # vlan batch 10 20 30 40 # dhcp enable # ip pool vlan10 gateway-list 192.168.0.1 network 192.168.0.0 mask 255.255.255.0 excluded-ip-address 192.168.0.100 192.168.0.254 dns-list 192.168.0.1 # ip pool vlan20 gateway-list 192.168.1.1 network 192.168.1.0 mask 255.255.255.0 lease day 2 hour 12 minute 30 dns-list 192.168.1.1 # ip pool vlan30 gateway-list 192.168.2.1 network 192.168.2.0 mask 255.255.255.0 dns-list 192.168.2.1 # interface Vlanif10 # interface GigabitEthernet0/0/0 ip address 172.168.0.2 255.255.255.0 dhcp select global # interface NULL0 # ip route-static 0.0.0.0 0.0.0.0 172.168.0.1 # user-interface con 0 user-interface vty 0 4 user-interface vty 16 20 # Return
- 06
设置完成。查看PC机IP地址。