Although the server is generally used for DHCP operation, DHCP operation can also be done via the Router if needed. DHCP operation can be done easily with a few commands on the router. Let's configure DHCP over the following topology.
In Huawei , we can use DHCP in two ways . The first is based on the interface, the second is globally, that is, by creating an IP pool. First of all, let's look at the part that is based on the interface.
1- Interface-based DHCP use
First of all, DHCP feature is activated on the Router.
<Huawei> <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei] sysname R1 [R1] dhcp enable
Then the interface is given an IP address and the DHCP service is activated on the interface. The dhcp select interfacecommand is used to make the DHCP distribution from Interface .
[R1] interface GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0] ip address 192.168.1.1 24 [R1-GigabitEthernet0/0/0] dhcp select interface
The router will start to distribute IP from the last IP address. IP distribution will be made as 192.168.1.254, 253, 252….
domain-name
If there is a Domain (domain) in the environment, Domain-name is specified. Although there is no domain in the current structure, I will add salihaltuntas.com as an example.
[R1-GigabitEthernet0/0/0] dhcp server domain-name test.com
DNS-Server
If there is a DNS Server in the environment, the DNS-Server address is specified. For example, I will define 192.168.1.10 as DNS-Server.
[R1-GigabitEthernet0/0/0] dhcp server dns-list 192.168.1.10
excluded-address
In DHCP, the first free IP address is distributed when the request comes. Addresses that are not intended to be distributed can be removed from this pool. Addresses can be specified individually or by giving a range.
[R1-GigabitEthernet0/0/0] dhcp server excluded-ip-address 192.168.1.2 192.168.1.10
Lease Time
Here, it is set how long the distributed IP addresses will be given. The duration can be set as indefinite, or it can be specified as days, hours and minutes.
[R1-GigabitEthernet0/0/0] dhcp server lease ? day, from 0 to 999 unlimited Unlimited
For example, let's do 1 day 12 hours 30 minutes.
[R1-GigabitEthernet0/0/0] dhcp server lease day 1 hour 12 minute 30
2- Using DHCP by creating an IP Pool
It is done while the IP pool is in global mode. ip poolAfter the command, the pool name is entered. I will create a pool named LAN1.
[R1] ip pool LAN1
Network
Network definition is made. The network in our example is 192.168.2.0/24
[R1-ip-pool-LAN1] network 192.168.2.0 mask 24
Gateway
A gateway is defined for the network. This gateway-listis done with the identification parameter.
[R1-ip-pool-LAN1] gateway-list 192.168.2.1
domain-name
If there is a Domain (domain) in the environment, Domain-name is specified. Although there is no domain in the current structure, I will add salihaltuntas.com as an example.
[R1-ip-pool-LAN1] domain-name test.com
DNS-Server
If there is a DNS Server in the environment, the DNS-Server address is specified. For example, I will define 192.168.2.10 as DNS-Server.
[R1-ip-pool-LAN1] dns-list 192.168.2.10
Lease Time
Here, it is set how long the distributed IP addresses will be given. The duration can be set as indefinite, or it can be specified as days, hours and minutes.
[R1-ip-pool-LAN1] lease day 1 hour 12 minute 30
excluded-address
In DHCP, the first free IP address is distributed when the request comes. Addresses that are not intended to be distributed can be removed from this pool. Addresses can be specified individually or by giving a range.
I'll exclude the top 10 IP addresses as an example.
[R1-ip-pool-LAN1] excluded-ip-address 192.168.2.2 192.168.2.10
IP address reservation
IP address reservation can be made optionally. As an example, I reserve the address 192.168.2.15 for PC4.
[R1-ip-pool-LAN1] static-bind ip-address 192.168.2.15 mac-address 5489-98E4-756D
Let's give the interface an IP address and enable DHCP distribution. The dhcp select globalcommand is used to make the DHCP distribution from the pool .
[R1] interface GigabitEthernet 0/0/1 [R1-GigabitEthernet0/0/1] ip address 192.168.2.1 24 [R1-GigabitEthernet0/0/1] dhcp select global
Ref:
Salih altuntas


