26 Dynamic Host Configuration Protocol: MikroTik RouterOS

Jacob Christensen

Thus far, we’ve explored two approaches to integrating DHCP servers into a network using both Linux and Windows as dedicated servers. This chapter introduces yet another method for deploying DHCP, in the form of a router. This proves particularly handy in scenarios where a quick and easy solution is required. Configuring DHCP in this manner offers rapid deployment and simplicity, making it ideal fit smaller network environments.

Estimated time for completion: 10 minutes

Phase 0 – Professional Alignment

Enterprise networks can provide Dynamic Host Configuration Protocol (DHCP) services using dedicated servers or directly from network infrastructure devices. In this chapter, you will configure a MikroTik RouterOS router to provide DHCP services for a local area network while analyzing DHCP and ARP traffic with Wireshark. This lab reinforces core DHCP concepts while demonstrating how integrated network services can simplify the deployment and management of smaller enterprise networks.

DCWF Work Roles

The knowledge and skills developed in this chapter align with the following Department of Defense Cyber Workforce Framework (DCWF) work roles:

  • 441 – Network Services Specialist
  • 511 – Network Operations Specialist
  • 531 – Systems Administrator

NICE Work Roles

This chapter supports competencies associated with the following NICE Workforce Framework for Cybersecurity work roles:

  • Network Services Specialist
  • Network Operations Specialist
  • Systems Administrator

Professional Skills

By completing this chapter, you will begin developing the ability to:

  • Configure RouterOS to provide DHCP services for a local area network.
  • Deploy integrated network services on enterprise routing platforms.
  • Capture and analyze DHCP and ARP protocol traffic using Wireshark.
  • Validate automatic IPv4 address assignment for network clients.
  • Troubleshoot DHCP configuration and client connectivity issues.
  • Compare router-based DHCP services with dedicated server implementations.

What You’ll Be Able to Do

After completing this chapter, you should be able to:

  • Configure a MikroTik router to function as a DHCP server.
  • Assign and manage a DHCP address pool for client devices.
  • Verify that clients automatically receive valid IPv4 network configuration information.
  • Capture and interpret the DHCP Discover, Offer, Request, and Acknowledgment (DORA) exchange using Wireshark.
  • Capture and analyze ARP traffic to observe address resolution between network devices.
  • Validate and troubleshoot a router-based DHCP deployment in an enterprise network.

 

Learning objectives

  • Successfully deploy a DHCP solution using a MikroTik router on an enterprise network
  • Capture and Observe DHCP packets using Wireshark
  • Capture and Observe ARP packets using Wireshark
  • Successfully add hosts to an enterprise network and receive IP addresses automatically

Prerequisites

Deliverables

Five screenshots are required:

  • Neatly labeled and organized GNS3 workspace
  • MikroTik router configuration
  • Screenshot of Wireshark
    • DHCP packets for PC1
    • DHCP packets for PC2
    • PC1 pinging PC2

Resources

Contributors and testers

  • Dante Rocca, Cybersecurity Student, ERAU-Prescott
  • Kyle Wheaton, Cybersecurity Student, ERAU-Prescott

Phase I -Build the Network Topology

The following steps are to create a baseline environment for completing the lab.  It makes assumptions about learner knowledge from completing previous labs.

Your final network will look like the following:

GNS3 environment
Figure 1 – Final GNS3 network environment
  1. Start GNS3
    1. Create a new project: LAB_06
  2. Build a Class C subnet with the network address 178.58.58.0/24
    1. Two client devices – VPCS
    2. One switch – Ethernet switch
    3. One DHCP server – MikroTik router

      NOTE: The MikroTik CHR version used when making this lab was 7.11.3.

    4. Connect the PCs to the switch
    5. Connect port ether1 on the router to the switch
  3. Label and organize your network as necessary

Phase II – Configuring the MikroTik Router

Once the network is built we need to configure the router to act as our DHCP server.

  1. Start the MikroTik router and open its console
    1. Change the hostname to reflect the router’s primary purpose

      > system identity set name=DHCP-SERVER

    2. Remove the default DHCP listener on ether1

      > ip dhcp-client remove 0

      terminal command execution
      Figure 2 – Removing the DHCP client
    3. Assign a static IP address to its running interface

      > ip address add address=178.58.58.254/24 interface=ether1

      NOTE: In this example, I have ether1 connected to the switch. Remember to adjust this to be applicable for your environment.

      terminal command execution
      Figure 3 – Assigned IPv4 addresses
    4. Use the built-in setup wizard to configure the DHCP server
      Using the MikroTik setup wizard
      Figure 4 – DHCP Server setup wizard

      > ip dhcp-server setup

      1. dhcp server interface: ether1
      2. dhcp address space: 178.58.58.0/24
      3. gateway for dhcp network: 178.58.58.254
      4. addresses to give out: 178.58.58.1-178.58.58.253
      5. dns servers: (none just hit <Enter> )
      6. lease time: 1800
  2. Test the DHCP service on the network
    1. From PC1, request a new host address

      > ip dhcp

    2. From PC2, request a new host address

      > ip dhcp

  3. From PC1, ping PC2 to test connectivity

Career Connection

Many branch offices, retail locations, and small enterprise sites rely on integrated router services to provide DHCP without deploying a dedicated server. Network administrators routinely configure RouterOS and similar enterprise routing platforms to deliver automated IP address management while monitoring network behavior with packet analysis tools. Understanding both dedicated server and router-based DHCP implementations prepares you to select the most appropriate solution based on an organization’s size, operational requirements, and available infrastructure.

End of Lab

Deliverables

Five screenshots are required to receive credit for this exercise:

  • GNS3 workspace with all devices labeled
  • MikroTik router configuration
  • Wireshark capture of PC1 devices getting and receiving DHCP IPv4 addresses
  • Wireshark capture of PC2 devices getting and receiving DHCP IPv4 addresses
  • Wireshark caputre of PC1 pinging PC2

Homework

Assignment 1 – Create a LAN for 43 hosts with a Mikrotik DHCP server while minimizing unused IP addresses

  • Used a randomized network address
  • There’s no need to put in all 43 host just show the setup process for the DHCP server and that it is working with at least two hosts
  • RECOMMENDED GRADING CRITERIA
    • Screenshot of GNS3 Environment
    • Screenshot of end devices receiving IP addresses
    • Screenshot of DHCP setup process

Assignment 2 – Use the Mikrotik router as both a DHCP server and a router

  • Add another LAN attached to the same Mikrotik router
  • Ensure devices on both LANs use the Mikrotik router as a DHCP server
  • Ensure devices on both LANs can contact each other
  • RECOMMENDED GRADING CRITERIA
    • Screenshot of GNS3 Environment
    • Screenshot of an end device on the first LAN receiving an IP address
    • Screenshot of an end device on the second LAN receiving an IP address
    • Screenshot of a device on one LAN pinging a device on the other LAN
Feedback email
Figure 00 – Contact us via prmaster@erau.edu

License

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

Mastering Enterprise Networks 3e Copyright © 2024 by Mathew J. Heath Van Horn is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.