Setting Up a DHCP Server on MikroTik RouterOS
A DHCP server automatically assigns IP addresses to devices on your network. Without it, every device would need a manually configured IP address — which is impractical for most networks. This guide shows you how to set up a complete DHCP server on RouterOS v7.
How DHCP Works (Brief Overview)
When a device connects to your network, it sends a broadcast message saying "I need an IP address." The DHCP server hears this, picks an available IP from its pool, and sends it to the device along with:
- The assigned IP address
- Subnet mask
- Default gateway (usually your router IP)
- DNS server addresses
- Lease time (how long the device can keep the IP)
The Three Components of RouterOS DHCP Server
To set up DHCP in RouterOS you need three things:
- IP Pool — the range of addresses to hand out
- DHCP Server — the service that listens for requests and assigns IPs
- DHCP Server Network — tells the DHCP server what gateway and DNS to send to clients
Step 1: Create an IP Pool
An IP pool defines the range of addresses available for DHCP assignment.
/ip pool add name=lan-pool ranges=192.168.1.100-192.168.1.200This creates a pool named lan-pool that can hand out addresses from .100 to .200 — that is 101 addresses.
View your pools:
/ip pool printStep 2: Create the DHCP Server
/ip dhcp-server add name=dhcp-lan interface=bridge address-pool=lan-pool disabled=noParameters explained:
name=dhcp-lan— a name for this DHCP server instance (you can have multiple)interface=bridge— which interface to listen on (use your LAN interface — often a bridge)address-pool=lan-pool— which pool to draw addresses fromdisabled=no— enable it immediately
View the DHCP server:
/ip dhcp-server printStep 3: Configure the DHCP Server Network
This tells the DHCP server what network information to send to clients:
/ip dhcp-server network add address=192.168.1.0/24 gateway=192.168.1.1 dns-server=8.8.8.8,8.8.4.4Parameters:
address=192.168.1.0/24— the network this DHCP server servesgateway=192.168.1.1— the default gateway clients should use (your router LAN IP)dns-server=8.8.8.8,8.8.4.4— DNS servers for clients
View the network configuration:
/ip dhcp-server network printVerifying It Works
Connect a device to your LAN and let it get an address automatically. Then check active leases:
/ip dhcp-server lease printYou will see something like:
# ADDRESS MAC-ADDRESS HOST-NAME STATUS
0 192.168.1.100 AA:BB:CC:DD:EE:FF my-laptop boundViewing and Managing Leases
See All Current Leases
/ip dhcp-server lease printSee Detailed Lease Information
/ip dhcp-server lease print detailRemove a Lease Manually
/ip dhcp-server lease remove 0Static DHCP Leases
A static DHCP lease (also called a DHCP reservation) assigns the same IP address to a specific device every time, based on its MAC address. This is useful for printers, servers, and other devices that need a predictable IP.
Adding a Static Lease
/ip dhcp-server lease add address=192.168.1.50 mac-address=AA:BB:CC:DD:EE:FF server=dhcp-lan comment=my-printerParameters:
address=192.168.1.50— the IP to always assign to this devicemac-address=AA:BB:CC:DD:EE:FF— the MAC address of the deviceserver=dhcp-lan— which DHCP server this lease belongs tocomment=my-printer— optional label for readability
Converting an Existing Dynamic Lease to Static
If a device already has a dynamic lease and you want to make it permanent:
/ip dhcp-server lease make-static 0(where 0 is the lease number from print)
This converts the lease to static so that device always gets the same IP.
Complete DHCP Setup in One Go
Here is a full example for a typical home network where the router LAN interface is a bridge with IP 192.168.1.1/24:
# Step 1: Create IP pool
/ip pool add name=lan-pool ranges=192.168.1.100-192.168.1.200
# Step 2: Create DHCP server
/ip dhcp-server add name=dhcp-lan interface=bridge address-pool=lan-pool disabled=no
# Step 3: Configure network info for clients
/ip dhcp-server network add address=192.168.1.0/24 gateway=192.168.1.1 dns-server=8.8.8.8,1.1.1.1Lease Time
The default lease time in RouterOS is 10 minutes for the offer and 3 days for the actual lease. You can change it per DHCP server network:
/ip dhcp-server network set 0 lease-time=1dOr set it at the DHCP server level:
/ip dhcp-server set dhcp-lan lease-time=12hCommon values: 30m, 1h, 12h, 1d, 3d
DHCP Server on Multiple Interfaces
If your router has multiple LAN segments, you can run separate DHCP servers for each:
# Pool for VLAN 10
/ip pool add name=vlan10-pool ranges=10.10.10.100-10.10.10.200
# DHCP server for VLAN 10 interface
/ip dhcp-server add name=dhcp-vlan10 interface=vlan10 address-pool=vlan10-pool disabled=no
# Network info for VLAN 10
/ip dhcp-server network add address=10.10.10.0/24 gateway=10.10.10.1 dns-server=8.8.8.8Using the DHCP Server Setup Wizard
RouterOS also includes a quick setup command that does all three steps automatically:
/ip dhcp-server setupThis runs an interactive wizard asking for interface, address pool range, gateway, and DNS. It is the fastest way if you just want a quick setup.
Summary
DHCP setup in RouterOS requires three steps:
- Create a pool:
/ip pool add - Create the server:
/ip dhcp-server add - Configure network info:
/ip dhcp-server network add
Use static leases for devices that need a fixed IP. Use /ip dhcp-server lease print to monitor what addresses have been assigned.
