MikroTik DHCP server generator
Enter the interface and subnet, and get the IP pool, DHCP server, network settings and static leases as one checked RouterOS script.
Runs in your browser; nothing you type leaves your device
Generates RouterOS v7 syntax (also valid on v6) for an IPv4 DHCP server on one interface. Custom DHCP options and relays are not covered. MikroTik and RouterOS are trademarks of SIA Mikrotīkls. This tool is independent and not affiliated with or endorsed by MikroTik.
How to set up a DHCP server on MikroTik
- Enter the interface the clients are on (a bridge or a VLAN interface) and its subnet; the gateway and pool are suggested from it.
- Adjust the pool, DNS servers, domain and lease time, and add static leases for devices that need a fixed address.
- Copy the script or download the .rsc file and run it; the notes point out anything that needs a second look.
DHCP on RouterOS, piece by piece
RouterOS keeps a DHCP server in three places, and a missing piece is the usual reason clients get no address. The pool is just a named set of address ranges. The server listens on one interface and leases addresses from its pool. The network entry is matched by subnet and holds the options sent with each lease: gateway, DNS servers, domain name and NTP servers. The interface also needs the router's own address in that subnet, or the server has no network to serve.
The page checks the pieces against each other before writing anything: the gateway and pool must sit inside the subnet, the pool must avoid the network, broadcast and gateway addresses, and static leases must be unique and inside the subnet. Static leases are written to /ip dhcp-server lease with the server's name, so each device always gets the same address.
Tips
- Planning the addressing? The subnet calculator shows the host range and size of any prefix.
- One DHCP server per VLAN: create the VLAN interfaces first with the VLAN generator, then run this once per VLAN.
- If the router answers DNS, make sure the firewall drops DNS from the internet.
Questions
What are the parts of a RouterOS DHCP server?
Three menus work together: /ip pool holds the addresses to hand out, /ip dhcp-server binds a server to an interface and a pool, and /ip dhcp-server network holds what clients are told: the gateway, DNS servers, domain and NTP servers for that subnet. The router also needs its own address on the interface, which the script can add.
Should static leases be inside or outside the pool?
Either works: RouterOS never hands out an address that a static lease holds. Keeping fixed devices outside the dynamic range, for example .2 to .9 with the pool from .10, makes the plan easier to read and avoids confusion if a lease is deleted.
What lease time should I use?
For a home or office LAN, a day is common. Guest networks and hotspots with many short visits do better with an hour or less, so addresses come back to the pool quickly. Very short leases mean more renewals but no real cost on a small network.
Do I need allow-remote-requests for clients to use the router as DNS?
Yes, and that is also what makes a router an open resolver when the firewall doesn't drop DNS from the WAN. The tool only adds it when you tick the option, and reminds you to check the input chain.
Is my network plan sent anywhere?
No. The checks and the script are done in your browser.