Архив метки: MikroTik DHCP Server Configuration Guides

MikroTik DHCP Server Configuration in RouterOS v7

Dynamic Host Configuration Protocol (DHCP) is a client/server protocol where a DHCP server automatically provides an Internet Protocol (IP) address and other related information such as subnet mask, default gateway and DNS to DHCP clients. DHCP server and client use UDP port 67 and 68 for communication.




In a network, a DHCP client (IP devices such as Desktop, Laptop, Smartphone etc.) requests for an IP lease sending broadcast message over 67/UDP port to any DHCP server and a DHCP server responses over 68/UDP allocating IP address and other related IP information for a certain period. So, a DHCP server reduces huge network administration tasks of a system administrator.




Every MikroTik RouterOS including RouterOS v7 has a built-in DHCP service. So, system admin can easily turn MikroTik RouterOS into a DHCP server and can easily reduce his network administration task.




In my previous article, I discussed elaborately how to configure a MikroTik RouterOS v7 first time and in this article I am going to show how to configure a DHCP Server in MikroTik RouterOS v7.




MikroTik DHCP Server Setup in RouterOS 7




DHCP Service is built-in in MikroTik RouterOS v7 but not enabled by default. So, if we want to use DHCP Server in our network with MikroTik RouterOS v7, we have to setup and configure it.






But before going to start DHCP Server configuration in MikroTik RouterOS v7, I will show a basic network diagram as an example where a MikroTik Router is working as a DHCP Server as well as it is working as a network gateway. I hope, your network will be almost similar like the following network diagram and you will be able to run a smooth DHCP Server in your network with MikroTik RouterOS v7.




MikroTik DHCP Configuration
MikroTik DHCP Server Enabled Network




In the above network diagram, the ether1 interface of MikroTik Router is connected to an ISP for accessing internet and this interface is known as WAN. All LAN users are connected to ether2 interface through a network switch.




We will now enable DHCP Server on the ether2 interface so that all LAN users will get network information (IP, Subnet mask, Gateway and DNS) dynamically from this DHCP Server. But before enabling DHCP server in MikroTik RouterOS 7, we have to complete MikroTik RouterOS basic configuration. MikroTik RouterOS 7 basic configuration using Winbox or command was discussed in the previous article. So, follow that article for basic RouterOS 7 configuration and then follow the following steps for DHCP Server configuration using Winbox.







  • Go to IP > DHCP Server menu item from Winbox. DHCP Server window will appear.
  • In DHCP Server window, click on DHCP Setup button and choose the interface (in this article: ether2) on which you want to setup DHCP server from DHCP Server Interface drop-down menu and then click on Next button.
  • Now put your LAN network block in DHCP Address Space input box and click Next button. DHCP client/LAN user will get IP from this network.
  • Choose gateway address for the given network in Gateway for DHCP Network input box and then click Next button.
  • Provide IP range from which DHCP client/LAN user will get IP in Address to Give Out input box and click Next button.
  • Provide preferred DNS server IP and click Next button.
  • Provide IP lease time and click Next button. Default lease time is 3 days.
  • DHCP setup is now complete and a successful message will be shown.




Now connect any IP device (Desktop, Laptop, Smartphone etc.) to your network. An IP will automatically be allocated for that device from MikroTik DHCP Server. Click Leases tab and observe IP lease status of that DHCP client.




DHCP Server configuration in MikroTik RouterOS7 has been explained step by step in this article. I hope, you will be able to configure DHCP Server in your network with MikroTik Router OS v7. However, if you face any confusion to configure a DHCP server in MikroTik Router OS7, feel free to discuss in comment or contact with me from Contact page. I will try my best stay with you.



2022-05-18T12:29:50
MikroTik DHCP Server Configuration Guides

MikroTik Configuration with DHCP WAN Connection

MikroTik Router is one of the most popular routers because of having a lot of networking features. MikroTik DHCP Client is a special feature that is used to connect to any DHCP Server. So, if any uplink ISP provides DHCP connection, MikroTik Router is able to connect that DHCP Server using this DHCP Client. In my previous article, I discussed how to configure MikroTik Router with PPPoE WAN Connection. In this article, I will discuss how to configure MikroTik Router with DHCP WAN Connection.




Core Devices and IP Information




To configure MikroTik Router with DHCP WAN Connection, I am using a MikroTik RouterBoard 1100 AHX2 (RouterOS v6.38.1) and the LAN Gateway IP is 192.168.10.1/24. This information is just for my R&D purpose. Change this information according to your network requirements.




Network Diagram




To configure MikroTik Router with WAN DHCP Client, I am following a network diagram like the below diagram.




MikroTik Network with DHCP WAN Connection
MikroTik Network with DHCP WAN Connection




In this network diagram, MikroTik Router’s ether1 interface is connected to ISP network where  DHCP Server is enabled. So, we will create MikroTik DHCP Client in this interface so that MikroTik Router can connect with ISP DHCP Server and can access internet. Again, MikroTik Router’s ether2 interface is connected to a LAN switch having IP block 192.168.10.0/24. We are assigning static IP for LAN users but if we want, we can configure MikroTik PPPoE Server, MikroTik DHCP Server or MikroTik Hotspot Server on ether2 interface. We will also configure NATing in our MikroTik Router so that LAN users are able to get internet using this private IP block. 




MikroTik Configuration with WAN DHCP Client




We will now start our MikroTik Router configuration with WAN DHCP client according to the above network diagram. Complete MikroTik configuration with DHCP WAN connection can be divided into the following three steps.




  • MikroTik DHCP Client Configuration on WAN Interface
  • Assigning LAN Gateway
  • NATing configuration




Step 1: MikroTik DHCP Client Configuration on WAN Interface




If your uplink ISP provides DHCP connection, you must configure MikroTik DHCP Client on your WAN interface. The following steps will show how to configure DHCP Client on MikroTik WAN interface.




  • Login to MikroTik Router using Winbox with admin privilege credential.
  • Click on IP > DHCP Client menu item. DHCP Client window will appear. Click on PLUS SIGN (+). New DHCP Client will appear.
  • Choose WAN interface (ether1) from Interface dropdown menu.
  • Make sure that Use Peer DNS and Use Peer NTP is selected if your ISP includes DNS and NTP Server Information with DHCP connection. Usually, DNS IP is provided with every DHCP connection.
  • Choose yes from Add Default Route dropdown menu otherwise you and your LAN user cannot communicate with the internet.
  • Click Apply and OK button.




MikroTik DHCP Client Configuration
MikroTik DHCP Client Configuration




If your WAN interface is connected to your uplink ISP network, your DHCP Client will be connected with the ISP DHCP Server and you will find connection status with assigned IP information from Status tab in respected DHCP Client window.




You will also find that a dynamic IP is added in IP > Address list window, Dynamic DNS Servers are added in IP > DNS window and a default route is automatically added in IP > Routes list by MikroTik DHCP client.




Step 2: Assigning LAN Gateway




After MikroTik DHCP Client configuration, we will now assign LAN Gateway IP so that LAN user can communicate through MikroTik Router. The following steps will show how to assign LAN Gateway IP in MikroTik Router.




  • Go to IP > Addresses menu item. Address List window will appear.
  • Click on PLUS SIGN (+) and put your LAN gateway IP (192.168.10.1/24) in Address input field.
  • Choose your LAN interface (ether2) from Interface dropdown menu.
  • Click Apply and OK button.




LAN Gateway IP has been assigned. Now we will configure NATing so that LAN user can get internet through MikroTik Router.


Step 3: NATing Configuration




We will now create a NAT rule in MikroTik Firewall for masquerading our LAN IP block. Otherwise, our LAN user cannot access internet through our MikroTik router. The following steps will show how to create the masquerade firewall rule in MikroTik router.




  • Go to IP > Firewallmenu and click on NAT tab and then click on PLUS SIGN (+). New NAT Rule window will appear now.
  • Choose srcnatfrom Chain dropdown menu and put LAN IP block (192.168.10.0/24) in Address input field.
  • Click on Action tab and choose masqueradefrom Action dropdown menu.
  • Click Applyand OK




NATing configuration in MikroTik router has been completed as well as all our necessary steps to configure MikroTik Router with WAN DHCP Client have been completed. Now connect your LAN users to MikroTik Router through a LAN switch. If everything is OK, your LAN users will able to get internet through MikroTik Router.






I have used static IP for LAN users for making this article simple but in real situation you will prefer MikroTik DHCP Server or MikroTik PPPoE Server or MikroTik Hotspot Server for connecting your LAN users. So, follow my articles about MikroTik DHCP Server Configuration, MikroTik PPPoE Server Configuration and MikroTik Hotspot Server Configuration and choose which is suitable for your network.




If you face any confusion to follow the above steps properly, watch the below video about MikroTik DHCP Client configuration. I hope it will reduce your any confusion about MikroTik DHCP client configuration on WAN interface.