Configure DHCP server on S series switch based on the interface address pool.
To configure the DHCP server based on the interface address pool for the S series switches (excluding the S1700), configure an IP address for the interface and the switch allocates addresses that are on the same network segment as the interface IP address to clients.
This configuration mode is simple and applies only to scenarios where the DHCP server and clients are on the same network segment. That is, no DHCP relay exists.The configuration is as follows:
[HUAWEI] dhcp enable //Enable DHCP.
[HUAWEI] interface gigabitethernet 2/0/0 //Enter the view of the interface connected to the DHCP client.
[HUAWEI-GigabitEthernet2/0/0] port link-type access
[HUAWEI-GigabitEthernet2/0/0] port default vlan 10
[HUAWEI] interface vlanif 10
[HUAWEI-Vlanif10] ip address 10.1.1.1 24 //Configure the network segment where the DHCP client resides. The IP address range of the interface-based DHCP server is: 10.1.1.2 to 10.1.1.254.
[HUAWEI-Vlanif10] dhcp select interface //Enable the DHCP server function based on the interface address pool.
[HUAWEI-Vlanif10] dhcp server dns-list 18.104.22.168 //Specify the DNS server address in the interface address pool.
[HUAWEI-Vlanif10] dhcp server lease day 2 //Set the lease of IP addresses to 2 days.