Topology
configuration steps
1. Create a vlan, configure the VLAN to which the port belongs and the IP address of the corresponding VLAN interface. The IP address is the gateway address of the corresponding VLAN
vlan 2 to 4
#
interface GigabitEthernet1/0/1
port link-mode bridge
port access vlan 2
combo enable fiber
#
interface GigabitEthernet1/0/2
port link-mode bridge
port access vlan 3
combo enable fiber
#
interface GigabitEthernet1/0/3
port link-mode bridge
port access vlan 4
combo enable fiber
#
interface Vlan-interface2
ip address 192.168.2.1 255.255.255.0
#
interface Vlan-interface3
ip address 192.168.3.1 255.255.255.0
#
interface Vlan-interface4
ip address 192.168.4.1 255.255.255.0
2. Configure the DHCP address pool 2 3 4 to assign IP addresses to clients in the 192.168.2.0/24 , 192.168.3.0/24 , and 192.168.4.0/24 network segments
DNS address 114.114.114.114
dhcp server ip-pool vlan2
gateway-list 192.168.2.1
network 192.168.2.0 mask 255.255.255.0
dns-list 114.114.114.114
#
dhcp server ip-pool vlan3
gateway-list 192.168.3.1
network 192.168.3.0 mask 255.255.255.0
dns-list 114.114.114.114
#
dhcp server ip-pool vlan4
gateway-list 192.168.4.1
network 192.168.4.0 mask 255.255.255.0
dns-list 114.114.114.114
#
Reserved address not issued
dhcp server forbidden-ip 192.168.2.200 192.168.2.254
After the configuration is complete, you can run the display dhcp server ip-in-use command on the switch to view the IP address assigned by the DHCP server to the client .
[H3C]display dhcp server ip-in-use
IP address Client identifier/ Lease expiration Type
Hardware address
192.168.2.2 0061-6330-322e-6437-Mar 31 18:15:13 2023 Auto(C)
6165-2e30-3230-362d-
4745-302f-302f-31
192.168.3.2 0061-6330-322e-6464-Mar 31 18:21:21 2023 Auto(C)
3339-2e30-3330-362d-
4745-302f-302f-31
192.168.4.2 0061-6330-322e-6531- Mar 31 18:18:30 2023 Auto(C)
6537-2e30-3430-362d-
4745-302f-302f-31
After the configuration is complete, the PC_2/ PC_3/ PC_4 client can view the IP address
Select the PC , right-click configuration, enable interface management, select DHCP for IPV4 configuration , click enable, and then refresh to display the IPV4 address status, and the operation of other PCs is the same.