DHCP Client, Relay and Server · Topic 3 of 5

DHCP Server Networks and Pools

Learn how to build a RouterOS DHCP server: the IP pool, the network entry with gateway and DNS, the server, lease time, and dynamic and static leases.

  • 5 min
In a nutshell
  • A DHCP server needs a pool, a network entry and a server entry.
  • Pools are in /ip pool, networks in /ip dhcp-server network, servers in /ip dhcp-server.
  • The network entry gives the gateway, DNS servers and domain to clients.

What it is

A DHCP server hands out addresses and network settings to clients on an interface.

Three parts work together in RouterOS. The IP pool holds the addresses to give out.

The DHCP network holds the settings that go with them, such as the gateway. The DHCP server ties them to an interface.

IP pooladdresses to giveDHCP serverbound to an interfaceDHCP networkgateway, DNS, maskClientreceives a lease

If any of the three is missing, clients get nothing.

How it works

You create the pool, the network and then the server.

Step one: the IP pool

A pool is a named list of address ranges in /ip pool.

/ip pool add name=lan-pool ranges=192.168.88.100-192.168.88.200

You can give more than one range, separated by commas. Keep the router address and any fixed servers out of the range. The pool menu is also used by other services, such as PPP, so one pool can be shared where it makes sense.

Step two: the DHCP network

The network entry describes the subnet and the settings handed out with it. It lives in /ip dhcp-server network.

/ip dhcp-server network add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=192.168.88.1 domain=lan.example
ParameterWhat the client receives
addressThe subnet this entry applies to, which also gives the mask
gatewayThe default gateway
dns-serverOne or more DNS servers
domainThe domain name
ntp-serverAn NTP server
wins-serverA WINS server

The server finds the right network entry by comparing the client subnet with the entries. If the subnet does not match, the clients receive no usable settings.

Step three: the DHCP server

The server entry binds a pool to an interface in /ip dhcp-server.

/ip dhcp-server add name=dhcp1 interface=bridge address-pool=lan-pool lease-time=1d disabled=no

The interface must have an IP address in the same subnet as the pool. The server uses that address as its own identity on the network.

ParameterMeaning
interfaceWhere the server listens
address-poolThe pool to take addresses from
lease-timeHow long a lease lasts
disabledA server is created disabled until you set no

In many cases the setup command does all three steps for you, and asks for the pool, the gateway and the DNS servers.

/ip dhcp-server setup

Leases

A lease is the binding between a client and an address. The leases are in /ip dhcp-server lease.

TypeHow it is made
DynamicThe server picks an address from the pool and the lease ends when the time runs out
StaticYou tie a MAC address to a fixed address, so the client always gets the same one
/ip dhcp-server lease add address=192.168.88.50 mac-address=00:0C:42:AA:BB:CC server=dhcp1
/ip dhcp-server lease make-static 0

A static lease keeps a printer or a camera at a known address while still using DHCP. The make-static command turns an existing dynamic lease into a static one. Static leases may use addresses outside the pool range, as long as they are in the same subnet.

ClientMAC 00:0C:42:AA:BB:CCLease tablestatic entry foundClientalways gets 192.168.88.50

What the server checks

Before it offers an address, the server checks that nobody uses it. This avoids a duplicate address on the network. A lease shows a status such as bound when active, and offered when the address is proposed but not yet confirmed.

If the pool is exhausted, new clients get no address. You can see the used and free addresses with /ip pool used print. Raise the pool size, or lower the lease time, when many short visits fill it.

Exam tip

A shorter lease time helps when many guests come and go, because addresses return to the pool faster.

Common troubleshooting steps

When clients do not get an address, check these points in order.

  1. The server is enabled and bound to the correct interface.
  2. The interface has an address in the pool subnet.
  3. The pool has free addresses.
  4. A network entry covers the subnet.
  5. No firewall rule drops DHCP traffic.

What to remember for the exam

Eight facts cover most questions on this topic.

  • A DHCP server needs a pool, a network entry and a server entry.
  • Pools are in /ip pool, networks in /ip dhcp-server network, servers in /ip dhcp-server.
  • The network entry gives the gateway, DNS servers and domain to clients.
  • The interface needs an address in the same subnet as the pool.
  • lease-time sets how long a lease lasts.
  • Dynamic leases come from the pool, and static leases tie a MAC address to an address.
  • make-static converts a dynamic lease into a static one.
  • /ip dhcp-server setup creates the pool, network and server together.
Watch out

A server created by hand starts disabled. Check the status after you add it.

Common mistakes

These four mistakes appear often.

Forgetting the network entry. Clients get an address but no gateway or DNS.

Using a pool outside the interface subnet. The server cannot serve that pool on the interface.

Including the router address in the pool. The pool may give out the router address to a client.

Leaving the server disabled. A new entry does nothing until it is enabled.

Check yourself

Work through these three questions.

  • Which three items does a basic DHCP server need?

    An IP pool, a DHCP network entry and a DHCP server entry.

  • Where does the gateway given to clients come from?

    From the gateway parameter in the DHCP network entry.

  • How do you keep a device on the same address with DHCP?

    Create a static lease that ties its MAC address to the address.

Topic 3 of 5 in DHCP Client, Relay and Server

Test yourself on DHCP Client, Relay and Server

The full MikroTik MTCTCE question bank has 479 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by MikroTik. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.