DHCP Client and Server

Document revision 1.6 (05-May-2003)
This document applies to the MikroTik RouterOS V2.7

Table of Contents


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:

IP addresses can be bound to MAC addresses using static lease feature.

DHCP server can be used with MikroTik RouterOS HotSpot feature to authenticate and account for DHCP clients. See the HotSpot Manual for more details.


Packages required : dhcp
License required : Any
Home menu level : /ip dhcp-client, /ip dhcp-server
Protocols utilized : DHCP (RFC2131)
Hardware usage: not significant

Related Documents

Software Package Installation and Upgrading
IP Addresses and Address Resolution Protocol (ARP)
IP Pools
HotSpot Gateway


The DHCP protocol gives and allocates IP addresses to IP clients. DHCP is basically insecure and should only be used on secure networks. DHCP server listens on UDP 67 port, DHCP client - on UDP 68 port.

DHCP Client Setup

Submenu level : /ip dhcp-client


The MikroTik RouterOS DHCP client may be enabled on 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's default DNS if the router's DNS is set to under the /ip dns settings.

Property Description

enabled (yes | no, default: no) - whether the DHCP client is enabled
interface (name) - any Ethernet-like interface (this includes wireless and EoIP tunnels)
host-name (string; default: "") - (optional) the host name of the client
client-id (string; default: "") - (optional) corresponds to the settings suggested by the network administrator or ISP
add-default-route (yes | no, default: yes) - whether to add the default route to the gateway specified by DHCP server
use-peer-dns (yes | no, default: yes) - whether to accept the DNS settings advertized by DHCP server (they will appear in /ip dns settings)


If host-name property is not specified, client's system identity will be sent in the respective field of DHCP request.

If client-id property is not specified, client's MAC address will be sent in the respective field of DHCP request.

To renew current leases, use the renew command. If the renew operation was not successful, client tries to reinitialize lease (i.e. it starts lease request procedure as it has not received an IP address yet).


To enable DHCP client on ether1 interface:

[admin@MikroTik] ip dhcp-client> set enabled=yes interface=ether1
[admin@MikroTik] ip dhcp-client> print
              enabled: yes
            interface: ether1
            host-name: ""
            client-id: ""
    add-default-route: yes
         use-peer-dns: yes
To show obtained leases:
[admin@MikroTik] ip dhcp-client> lease print
          expires: oct/20/2002 09:43:50
[admin@MikroTik] ip dhcp-client>

DHCP Server Setup

Submenu level : /ip dhcp-server


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/netmask lease, default gateway, domain name, DNS-server(s) and WINS-server(s) (for Windows clients) information.

Property Description

name (name; default: "")- descriptive name for server
interface (name) - Ethernet-like interface name
lease-time (time; default: 72h) - the time that a client may use an address. The client will try to renew this address after a half of this time and will request a new address after time limit expires
address-pool (name | static-only; default: static-only) - IP pool, from which to take IP addresses for clients
  • static-only - allow only the clients that have a static lease (i.e. no dynamic addresses will be given to clients, only the ones added in lease submenu)
    netmask (integer; default: 0) - the netmask to be used by DHCP client
    gateway (IP address; default: - the default gateway to be used by DHCP client
    src-address (IP address; default: - 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 (string; default: "") - the DHCP client will use this as the default DNS server. Two comma-separated DNS servers can be specified to be used by DHCP client as primary and secondary DNS servers
    domain (string; default: "") - the DHCP client will use this as the 'DNS domain' setting for the network adapter
    wins-server (string; default: "") - the Windows DHCP client will use this as the default WINS server. Two comma-separated WINS servers can be specified to be used by DHCP client as primary and secondary WINS servers
    add-arp (yes | no; default: no) - whether to add dynamic ARP entry
  • no - either ARP mode should be enabled on that interface or static ARP entries should be defined in /ip arp submenu


    Winbox does not have option for specifying two DNS or WINS servers, you should use terminal console instead.

    If using both Universal Client and DHCP Server on the same interface, client will only receive a DHCP lease in case it is directly reachable by its MAC address through that interface (some wireless bridges may change client's MAC address).


    To use MikroTik RouterOS DHCP server feature:
    1. Specify address pool to be used for DHCP clients.
      Address pools are added/managed under the /ip pool menu, for example:
      [admin@MikroTik] ip pool> add name=our-dhcp-clients ranges=
      [admin@MikroTik] ip pool> print
        # NAME                                        RANGES
        0 our-dhcp-clients                  
      [admin@MikroTik] ip pool>
      Do not inlude the DHCP server's (interface's) address into the pool range! See IP Pool Manual for more details!

    2. Add a DHCP server to the interface, for example:
      [admin@MikroTik] ip dhcp-server> add name=dhcp-office \
      \... address-pool=our-dhcp-clients interface=ether1 lease-time=72h netmask=24 \
      \... gateway= dns-server=, domain=mt.lv
      [admin@MikroTik] ip dhcp-server> enable dhcp-office
      [admin@MikroTik] ip dhcp-server> print
      Flags: X - disabled, I - invalid
        0   name="dhcp-office" interface=ether1 lease-time=72h
            address-pool=our-dhcp-clients netmask=24 gateway=
            src-address= dns-server=, domain="mt.lv"
            wins-server="" add-arp=yes
      [admin@MikroTik] ip dhcp-server>

    DHCP Server Leases

    Submenu level : /ip dhcp-server lease


    DHCP server lease submenu is used to monitor and manage server's leases. You can also add static leases to issue the definite client (determined by MAC address) with the specified IP address.

    Property Description

    address (IP address; default: - leased IP address for the client
    mac-address (MAC address; default: 00:00:00:00:00:00) - MAC address of the client. It is base for static lease assignment
    lease-time (time; default: 0) - dictates the time that a client may use an address
  • never (the same as 0) - lease will never expire
    netmask (integer; default: 0) - the netmask to be given with the IP address coming from the range of addresses that can be given out
    gateway (IP address; default: "") - the default gateway to be used by the DHCP client


    server (name) - server name which serves this client
    expires-after (time) - time until lease expires
    status (waiting | testing | busy | offeres | bound) - lease status:

  • waiting - not used static lease
  • testing - testing whether this address is used or not
  • busy - this address is used in the network, so it can not be leased
  • offered - server has offered this lease to a client, but did not receive client confirmation
  • bound - server has received client confirmation that it accepts offered address and is using it now


    Blank default values for some properties meand that property will be taken from the server's default values.

    Even though client address may be changed (with adding a new item) in lease print list, it will not change for the client. It is true for any changes in in the DHCP server configuration because of DHCP protocol. Client tries to renew assigned IP address only when half a lease time is past (it tries to renew several times). Only when full lease time is past and IP address was not renewed, new lease is asked (rebind operation).


    To assign static IP address for the existing DHCP client (shown in the lease table as item #0):
    [admin@MikroTik] ip dhcp-server lease> print
    Flags: X - disabled, D - dynamic, H - hotspot
      #    ADDRESS         MAC-ADDRESS       EXPIRES-A... SERVER                 STATUS
      0 D       00:04:EA:C6:0E:40 1h48m59s     switch                 bound
      1 D       00:04:EA:99:63:C0 1h42m51s     switch                 bound
    [admin@MikroTik] ip dhcp-server lease> add copy-from=0 address=
    [admin@MikroTik] ip dhcp-server lease> print
    Flags: X - disabled, D - dynamic, H - hotspot
      #    ADDRESS         MAC-ADDRESS       EXPIRES-A... SERVER                 STATUS
      1 D       00:04:EA:99:63:C0 1h42m18s     switch                 bound
      2      00:04:EA:C6:0E:40 1h48m26s     switch                 bound
    [admin@MikroTik] ip dhcp-server lease>

    Additional DHCP Resources

    Links for DHCP documentation:


    Copyright 1999-2003, MikroTik