How to create DHCP multiple scopes in MikroTik Router

Download RouterOS from MikroTik

With the previous article, you have learned already about how to configure DHCP in the MikroTik Router. So, now you will learn how to create DHCP multiple scopes in MikroTik router. what is the DHCP scope in the MikroTik router? DHCP scope in the MikroTik router, is not different from the DHCP scope in Windows or other devices. This is exactly the same. The DHCP scope is a valid range of the IP addresses that are available for assignment or lease to the client computers on a particular subnet.

For example, you have a different VLAN in your network infrastructure and you want to set up a DHCP server to provide/lease a different IP subnet for each VLAN. Thus, you need to create a scope in the DHCP server. One scope for one VLAN. If you have 20 VLANs in your network, then you need to create 20 scopes in the DHCP server.

But before you create DHCP scope, you need to understand about IP requirement for each VLAN. You can calculate or estimate the IP that will use for those VLANs, then use the appropriate subnet for each VLAN. However, creating scope in DHCP on MikroTik it’s not difficult for you to do it. First, you just need to enable the DHCP server on your MikroTik router and then create scope and point it to the VLAN that you have created in your router. Please keep following our step by step on how to create DHCP multiple scopes in the MikroTik router below.

Read: How to Configure DHCP best practices in MikroTik Router

How to create DHCP multiple scopes in MikroTik Router

In this example, we will create 3 VLANs and then create 3 scopes to map with those VLANs. See the description detail below:

  • Use interface 10 (Ether 10) as a trunk in the MikroTik router
  • Create 3 VLANs (20, 30, and 40) and then add them to interface 10 (Ether 10) in the MikroTik router
  • Add IP addresses to each VLAN (VLAN 20: 192.168.20.1/24, VLAN 30: 192.168.30.1/24, VLAN 40: 192.168.40.1/24)
  • Create 3 scopes and map to those VLANs (20,30, and 40)
  • Create 3 VLANs on a distributed switch
  • Connect 3 PCs with different VLANs to a distributed switch

Configuration

1. Login and add the DNS server to the MikroTik router

  • Login into the MikroTik router. You can use Winbox to log in.
  • Add DNS (8.8.8.8, 8.8.4.4) to the MikroTik router. Navigate to IP > DNS Server. On the left menu, go to IP > DNS and add google DNS servers IP (8.8.8.8 or 8.8.4.4) in a Servers input field, then click Apply and Ok button. Note: You can add your own DNS

2. Configure NAT to allow access to the internet

  • Go to IP > Firewall > NAT to create a rule for access to the internet. Click the + button and fill in the information:
    – In General Tab, Chain: Select srcnat
    – In Action Tab, Action: Select masquerade

3. Create Interface VLANs and add them to Ether10

  • On the left menu, navigate to Interfaces, then the interface list wizard will pop up. On the wizard, click + button, then select VLAN
  • Create VLAN 20. Put the name of VLAN to VLAN-20, MTU (also you can keep it default), on the VLAN ID field, put 20, and select ether10 on the Interface input field, then click Apply, then click OK
  • Create VLAN 30. Put the name of VLAN to VLAN-30, MTU (also you can keep it default), on the VLAN ID field, put 30, and select ether10 on the Interface input field, then click Apply, then click OK
  • Create VLAN 40. Put the name of VLAN to VLAN-40, MTU (also you can keep it default), on the VLAN ID field, put 40, and select ether10 on the Interface input field, then click Apply, then click OK
How to create DHCP multiple scope in MikroTik router

4. Assign the IP addresses to an interface VLAN (20, 30, and 40)

  • On the left menu, go to IP > Addresses. The addresses list wizard will pop up
  • Assign IP address 192.168.20.1/24 to VLAN 20. Click on the + button, on the Address input field, put 192.168.20.1/24, and on the Interface input field, select VLAN-20, then click Apply, and click OK.
  • Assign IP address 192.168.30.1/24 to VLAN 30. Click on the + button, on the Address input field, put 192.168.30.1/24, and on the Interface input field, select VLAN-30, then click Apply, and click OK.
  • Assign IP address 192.168.40.1/24 to VLAN 40. Click on the + button, on the Address input field, put 192.168.40.1/24, and on the Interface input field, select VLAN-40, then click Apply, and click OK.

5. Create scopes in the DHCP server (Scope-VLAN20, Scope-VLAN30, and Scope-VLAN40)

  • On the left menu, navigate to IP > DHCP Server. The DHCP Server wizard will pop up
  • Create DHCP scope VLAN 20. Click on the DHCP Setup, then the DHCP Server wizard will pop up. Then now fill in the information. On the DHCP Server Interface input field, select VLAN-20, and Click Next. On the DHCP Address Space, put 192.168.20.0/24, and click Next. On Gateway for DHCP Network, put 192.168.20.1, and click Next. On Addresses Give Out, put 192.168.20.2-192.168.20.254, and click Next. On DNS Servers, put 8.8.8.8 (Or you can use your own). Keep Lease Time to default, then click Next to finish.
  • Create DHCP scope VLAN 30. Click on the DHCP Setup, then the DHCP Server wizard will pop up. Then now fill in the information. On the DHCP Server Interface input field, select VLAN-30, and Click Next. On the DHCP Address Space, put 192.168.30.0/24, and click Next. On Gateway for DHCP Network, put 192.168.30.1, and click Next. On Addresses Give Out, put 192.168.30.2-192.168.30.254, and click Next. On DNS Servers, put 8.8.8.8 (Or you can use your own). Keep Lease Time to default, then click Next to finish.
  • Create DHCP scope VLAN 40. Click on the DHCP Setup, then the DHCP Server wizard will pop up. Then now fill in the information. On the DHCP Server Interface input field, select VLAN-20, and Click Next. On the DHCP Address Space, put 192.168.40.0/24, and click Next. On Gateway for DHCP Network, put 192.168.40.1, and click Next. On Addresses Give Out, put 192.168.40.2-192.168.40.254, and click Next. On DNS Servers, put 8.8.8.8 (Or you can use your own). Keep Lease Time to default, then click Next to finish.

6. Create VLANs 20, 30, and 40 in Distributed Switch

  • Access your DS switch, then use the command below.
    Switch>enable
    Switch#configure terminal
    Switch(config)#vlan 20
    Switch(config-vlan)name Accounting
    Switch(config-vlan)exit
    Switch(config)#vlan 30
    Switch(config-vlan)name Finance
    Switch(config-vlan)exit
    Switch(config)#vlan 40
    Switch(config-vlan)name IT
    Switch(config-vlan)exit

Read: How to create VLANs in Cisco Switch

7. Configure Interface port 24 as a trunk on your Distributed Switch

  • Access to DS switch, then use the command below to configure an interface as a trunk and then add those VLANs to the Trunk port.
    sw1>enable
    sw1#configure terminal
    sw1(config)#interface FastEthernet 0/24
    sw1(config-if)#switchport trunk encapsulation dot1q
    sw1(config-if)#switchport mode trunk
    sw1(config-if)#switchport trunk allowed vlan 20,30,40
    sw1(config-if)#exit

Read: How to configure port as trunk in Cisco switch

  • Assign VLANs to interfaces in Distributed Switch.
    sw1(config)#interface FastEthernet 0/1
    sw1(config-int)#switchport mode access
    sw1(config-int)#switchport access vlan 20
    sw1(config)#interface FastEthernet 0/2
    sw1(config-int)#switchport mode access
    sw1(config-int)#switchport access vlan 30
    sw1(config)#interface FastEthernet 0/3
    sw1(config-int)#switchport mode access
    sw1(config-int)#switchport access vlan 40

Now you have completed everything related to creating DHCP multiple scopes in the MikroTik router. So, if you plug the computer/laptop into the interface FastEthernet 0/1, you will get the IP address from 192.168.20.0/24 subnet. And if you plug the computer/laptop into the interface FastEthernet 0/2, you will get an IP address from 192.168.30.0/24 subnet, Then if you plug a computer/laptop into the interface FastEthernet 0/3, you will get an IP address from 192.168.40.0/24 subnet.

FAQs

Why do we need to create multiple scopes in the DHCP server?

Because your network infrastructure will have many VLANs as an operation and you want to manage your infra as a professional. So, all the VLANs must have a different IP address in order to let you make an easy to manage your network. Then, you must create a scope in a DHCP server to leave a different IP address for your use in your LAN.

How to configure the trunk port in the MikroTik router?

When you create many VLANs and add them into a single MikroTik port, then that port will change the mode to a trunk port. So, you don’t need to make any configuration on that port. First, create VLANs, then add them to which port you want to be a trunk port.

Can we set/combine multiple ports to use the same scope in the MikroTik router?

Yes, we can. In the MikroTik router, there is one function called, bridge interface. With the bridge function, you can add many physical interfaces to that bridge port. First, you need to create a bridge interface and then add any physical interface to the bridge port that you just created. After you go to IP > DHCP Server > DHCP Setup to create DHCP scope, then on the Interface input field, select the bridge interface that you create above. So, all the physical interfaces under the bridge interface will get the same scope.

How to create Bridge Interface in the MikroTik Router?

It’s easy for you to create a bridge interface in the MikroTik router. To create the bridge interface, on the left menu you will see the Bridge. Click on Bridge, the Bridge wizard will pop up, Click + button, on the Name input field, put the bridge name you want, then click Apply > OK. In the same bridge wizard, go to the Ports tab, click + button, then select the physical interface and bridge interface that you just created.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top