MikroTik RouterOS V2.4 DHCP Client and Server

Document revision 12-Feb-2002
This document applies to the MikroTik RouterOS V2.5


DHCP (Dynamic Host Configuration Protocol) supports easy distribution of IP addresses for a network. The MikroTik RouterOS implementation includes both server and client modes and is compliant with RFC2131.

General usage of DHCP:

Contents of the Manual

The following topics are covered in this manual:


In V2.5, unlikely to the prior versions, the DHCP server and client are not included in the 'system' package. Please download the dhcp-2.x.npk package from the MikroTik's web site, upload the package to the router and reboot.

Use the /system package print command to see the list of installed packages.

Hardware Resource Usage

The DHCP server does not consume any significant resources. The DHCP client may consume high resource for five to ten seconds when acquiring an address or renewing an address.

DHCP Description

The DHCP protocol gives and allocates IP addresses to IP clients. DHCP is basically insecure and should only be used on secure networks. Port 67 is the DHCP listen port and port 68 is the DHPC transmit port.

DHCP Client Setup

The MikroTik RouterOS DHCP client may be attached to one Ethernet like interface. The client will accept an address, netmask, default gateway, and two dns server addresses. The IP address will be added to the interface with the netmask. The default gateway will be added to the routing table as a dynamic entry when the DHCP client is disabled, the dynamic default route will be removed. If there is already a default route installed prior the DHCP client obtains one, the route obtained by the DHCP client would be shown as invalid.

The DNS-server from the DHCP server will be used as the router default DNS if the router DNS is set to under the /ip dns settings.

To add a DHCP client to the router:

[MikroTik] ip dhcp-client> set enabled yes interface ether1 client-id test

Descriptions of arguments:

[MikroTik] - The text inside the brackets is the 'system identity' of the router. If the DHCP server requires a 'host name', then the MikroTik 'system identity' should be set to the same. This 'system identity' will be reported to the DHCP server as the 'host name'.
enabled - (yes / no). Enables or disables the DHCP client.
interface - Can be set to any Ethernet like interface this includes wireless and EoIP tunnels.
client-id - (optional) If needed, it should correspond to the settings suggested by the network administrator or ISP.

To change the 'system identity', use the cammand:

[MikroTik]> system identity set name=Mikro2345 

DHCP Server Setup

The router supports an individual server for each Ethernet like interface. The MikroTik RouterOS DHCP server supports the basic functions of giving each requesting client an IP address lease, default gateway, and DNS-server information.

To add a DHCP server:

[MikroTik] ip dhcp-server>
set ether1 enabled yes lease-time 72h from-address \
to-address netmask gateway \
dns-server domain rm219
[MikroTik] ip dhcp-server> print
0   interface: ether1 enabled: yes from-address:
    to-address: lease-time: 3 days 0:00:00 netmask:
    gateway: src-address: dns-server:
    domain: ether1-area
1   interface: Local219 enabled: no from-address: to-address:
    lease-time: 0:10:00 netmask: gateway: src-address:
    dns-server: domain: ""
[MikroTik] ip dhcp-server>

Descriptions of arguments:

interface - All Ethernet like interfaces may run a DHCP server.
enabled - (yes / no) Enable or disable the DHCP server.
from-address - Beginning number of IP address range to give to requesting DHCP clients. This address must be in the range of a static address on the same interface.
to-address - Ending number of IP address range to give to requesting DHCP clients. This address must be in the range of a static address on the same interface.
lease-time - Dictates the time that a client may use an address. Suggested setting is three days 3d'. The client will request a new address' after this time limit expires.
netmask - The netmask to be given with the IP address coming from the range of addresses that can be given out.
gateway - The default gateway to be used by the DHCP client.
source-address - The address which the DHCP client must use to renew an IP address lease. If there is only one static address on the DHCP server interface and the source-address is left as, then the static address will be used. If there are multiple addresses on the interface, an address in the same subnet as the range of given addresses should be used.
dns-server - The DHCP client will use this as the default DNS server.
domain - The DHCP client will use this as the 'DNS domain' setting for the network adapter.

Additional DHCP Resources

Links for DHCP documentation:


Copyright 1999-2002, MikroTik