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.
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.
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.
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.
0 Comments