Blog

 

Dive deep into MikroTik's RouterBoards and RouterOS. We keep you informed and up-to-date, always.

Author

 

Every post is penned by our certified MikroTik engineers, ensuring relevance and accuracy in every word.

Feedback

 

Your insights drive our content. Sharing knowledge, we elevate the MikroTik community in Canada together.

8 Tips You Want to Know About DHCP in RouterOS

Using DHCP in RouterOS? Wait a Sec...

DHCP (Dynamic Host Configuration Protocol) is used for the automatic distribution of IP host information across a network, including mainly IP address and subnet mask, netmask, default gateway, and DNS server(s).

 

When do we use DHCP? Almost always since we usually have more than a few IP hosts on our network and using DHCP will make life much much easier! DHCP in RouterOS DHCP has both client and server functions, and MikroTik routers can carry both functions at the same time.

 

Read below for 8 of the most crucial tips you need to know when working with DHCP in RouterOS.

... or scroll to the bottom to see our latest tutorial!

1. Where Does DHCP Land?

You can set up DHCP clients and servers on any Ethernet-like interface, and a given MikroTik device can carry a DHCP client and server at the same time.

 

However, bear in mind that, regarding DHCP servers, you can only bind a single DHCP server to each interface at a given time.

Become Familiar with DHCP Client in the Tutorial Below!

2. Mind the Interface

When choosing the interface on which you want to set up the DHCP server, make sure you observe the three following issues:

 

  • It needs to have a network connectede to the same broadcast domain as your clients;
  • An IP address must be assigned to that interface; and,
  • Your chosen interface must not be slave, meaning it shouldn't be part of a bridge.

3. Requirements for DHCP Server

When setting up a DHCP server, there are 6 parameters you'll be asked to determine, namely:

 

  • The interface;
  • Address space;
  • Network gateway;
  • IP pool;
  • DNS server(s); and,
  • Lease time.


If you have created a valid interface with an IP address assigned to it, you are way ahead and don't have to worry about the gateway or the DNS server(s).


Regarding IP pool and lease time, however, you should have a glance at the usage of your network and therefore need to take a few factors into account, which you can read below.

See a Sample Process of DHCP Server Setup in Session 27.

4. DHCP Lease Can be Dynamic or Static

Within the DHCP server, a lease can be created dynamically or statically.


As for the former, if the lease is created automatically by the DHCP server, it wil be shown as Dynamic with a D flag next to it.


However, if you manually create a lease by inputting the parameters of IP address, the client's MAC address, and IP pool, that lease will be static. Alternatively, you can also open up a dynamic DHCP lease and simply click on "Make Static" to convert that lease into static.

5. DHCP Client Goes First

In the process of the creation and provision of IP host information by a DHCP server to a client, it is the DHCP client that starts the whole back and forth communication.

 

As it is not aware of the presence of a server, the DHCP client sends a broadcast to 255.255.255.255 with the aim of finding a DHCP server.

 

Once this broadcast is received by the DHCP server, a quick communication starts between the two parties, at the end of which the DHCP server assigns an IP address to the DHCP client, along with other information including the server's IP address, default gateway, and DNS server(s).

6. Don't Forget the DHCP Log

In case you're interested to review the details of the interaction between the DHCP client and server, you will find the router's logs quite handy.

 

However, remember that DHCP information are not recorded and logged by default, and, in order to see this information in your logging table, you need to refer to teh System menu and the Logging submenu, and, there, add DHCP as an action to be shown in your log records.

7. What's with All the Log Jargon?

When you start paying more attention to DHCP logs, you'll see that the client and server are communicating various types of info, some of which are shown with certain abbreviations. In case you are not familiar with them, no worries. Here's what they mean:

 

  • ciaddr: Client's IP address
  • chaddr: Client's hardware address
  • yiaddr: Your IP address (IP address provided by the server to the client)
  • siaddr: Server's IP address

8. Determine Lease Time Carefully

Lease time is the duration an IP address is kept alive and occupied by the server for the client. Based on different industries and usages, you should determine the correct lease time for your own network or those of your clients.

 

For instance, if you are distributing addresses on a wireless network of a restaurant, you don't need much lease time as you should reallocate your addresses to new customers. However, since you will be accommodating a large number of devices throughout the day, a larger IP pool will be useful.

 

In contrast, an office network with a fixed number of employees does not need a large IP pool but since the employees will be there for much longer periods of time during the year, you can increase their lease time.

 

When determining lease time, consider the following:

 

  • Number of (simultaneous) users on the network;
  • Desired length of lease time based on network usage; and,
  • Desired length of activiity record time.

Get into the Details of Server-Client Interactions in the Latest Episode!

Class is in Session!

We finished Module 1 of our online MTCNA course a couple of weeks ago, and Module 2 will soon come to an end as well. Thus, if you're starting now, you've got some catching up to do! Visit our channel on YouTube for all MTCNA tutorials.

 

Also, a number of other classes such as MTCRE, MTCTCE and MTCUME are on offer as well, so if you've looking for more advanced engineering courses in-person or online, get in touch!

MikroTik News