With DHCP (Dynamic Host Configuration Protocol) it is easy to manage and assign IP-addresses for client devices in your network. Mikrotik RouterOS has DHCP client and DHCP server support.
Make sure you have defined a static IP address for the Mikrotik router. In our example we use the 192.168.100.0 /24 network. In Mikrotik we have assigned the first address of the network to be 192.168.100.1 /24. Note, that Mikrotik starts assigning addresses from the address pool's end instead of the start like most DHCP servers.
1. We create a DHCP pool. In our example the pool assigns addresses between 192.168.100.10 and 184.108.40.206.
/ip pool add name=dhcp_pool address=192.168.100.10-192.168.100.200
2. We create the settings for the new DHCP pool. In the settings we define the default gateway and DNS servers.
/ip dhcp-server network add address=192.168.100.0/24 gateway=192.168.100.1 netmask=24 dns-server=192.168.100.1
3. We create the DHCP server. Here we define which ports will get their addresses by DHCP and from which pool (we add the pool we just created) as well as lease time (time until an assigned address is released, once the device the address has been given to is disconnected.).
/ip dhcp-server add name=dhcp-server interface=ether1 lease-time=24:00:00 address-pool=dhcp_pool
With DHCP Exclusion you can define certain IP addresses to only be given to devices with a specific MAC address. When a device with the defined MAC address is connected to the network, it will be given the predefined address from the DHCP server.
/ip dhcp-server lease add address=192.168.100.100 mac-address=11:22:33:44:55:66
Mikrotik and Windows Deployment Services
Here is an example how you can get Mikrotik DHCP to work with WDS. Define additional settings to your DHCP server in the same fashion as the pictures.
Next Server = WDS server IP address Boot File Name = File which is first loaded from the WDS server DHCP Options = 060 PXEClient
The DHCP Client feature enables Mikrotik to get it's network settings from a DHCP server.
/ip dhcp-client add interface=ether1 disable=no
- Interface = Port to ask for the DHCP settings from
- disable no = Enable feature