DHCP Server/Client
The DHCP (Dynamic Host Configuration Protocol) protocol is used for easy distribution of IP addresses on a network. RouterOS Mikrotik includes both parts: Server / Client.
The router supports an individual DHCP server for each Ethernet interface. The Mikrotik server with the main functions is to provide a client with assignments of an IP address with its respective IP mask, as well as the address of the gateway and the DNS server.
The interface that hosts the DHCP server must have its own IP address and at the same time must not be included in the pool of addresses that clients will receive when they request it.
The DHCP protocol is located at the Network layer of the protocol map.
DHCP communication scenario
- DHCP Server always listens on port 67/UDP.
- DHCP Client listens on port 68/UDP.
- The initial negotiation involves communication between broadcast addresses.
- In some phases the sender uses source address 0.0.0.0 and/or destination addresses 255.255.255.255.
- Care must be taken of this when building a firewall.
The process for assigning an IP address to a client is as follows:
DHCP-DISCOVER.
src-mac= , dst-mac= , protocol=udp, src-ip=0.0.0.0:68, dst-ip=255.255.255.255:67
DHCP-OFFER.
src-mac= , dst-mac= , protocol=udp, src-ip= :67, dst-ip=255.255.255.255:67
DHCP-REQUEST.
src-mac= , dst-mac= , protocol=udp, src-ip=0.0.0.0:68, dst-ip=255.255.255.255:67
DHCP-ACKNOWLEGMENT.
src-mac= , dst-mac= , protocol=udp, src-ip= :67, dst-ip=255.255.255.255:67
DHCP Server Setup
The interface that is to be configured as DHCP-Server must have its own address and at the same time that address must not be included in the pool of an address. A pool is a range of addresses that will be available to clients.
In the DHCP-Server window, press the DHCP Setup button and then continue with the requested requirements:
1. Interface to which the DHCP server will be assigned:
2. Network address:
3. Gateway:
4. Address pool for DHCP clients:
5. DNS server (more than one can be used):
6. Time of assignments:
7. Then we press next and in this way the process ends:
In the window you can see the DHCP server created.
In this automatic configuration (by running DHCP Setup) the following parameters are generated:
- An address pool is created: a group of addresses to assign to clients.
- The DHCP server is created: its name and parameters (such as the interface that will accept requests from clients).
- The address space is created: the network IP address and various parameters.
IMPORTANT NOTE: if you have a bridge environment, the DHCP server must be configured on the bridge interface. If the DHCP Server is configured on a port that is part of the bridge, the DHCP server will not work.
DHCP Client
Allows an Ethernet interface to request an IP address
- A remote DHCP Server will deliver:
- IP adress
- Mask and Gateway
- DNS server addresses
- The DHCP Client will provide these options
- Hostname
- Client ID (in this case, the MAC address)
1 comment on “Chapter 2.4 – DHCP Server and DHCP Client”
Check the ports in the send and response packets.