How to Create a VLAN on Mikrotik with a Manageable Switch
Virtual Local Area Networks or commonly known as VLANs are used to create multiple virtual LANs on one physical interface. This is a layer 2 method that divides a single broadcast domain into multiple broadcast domains. So, proper VLAN planning can improve your network performance as well as network privacy. While here the Mikrotik Router functions as a router that forwards traffic between network segments.
Here's how to create a VLAN on Mikrotik with a Manageable Switch. For example, we use a D-Link DGS-1210-10 manageable switch.
Create a VLAN on Mikrotik with a Manageable Switch
Manageable Switch Configuration
1. First you connect your computer with the manageable switch, then you call the ip address of the manageable switch. Here the manageable IP switch is 10.90.90.90
2. Next you will be taken to the manageable switch login page, then enter the password
3. After you log in, you go to the VLAN ID Settings menu. There must have been a default VID with id 1-10 Untagged.
4. Here, for example, we will create 5 VLANs, first you change the default VID, make sure you change ports 3-10 to Not Member then port 1 to Untagged, and port 2 to Tagged. Because this is the default VLAN so you can't change the id and name. And one important thing if you are configuring Switch Manageable, make sure you are on the Untagged port. Because if a frame leaves the port Untagged, the switch removes the VLAN tag from the frame. And traffic will continue as usual. So here make sure you are connected to the Untagged switch manageable port 1.
5. Then do the same thing, create VLAN2 with port 3 Untagged and port 4 Tagged and on the other port you make sure Not Member. Actually Tagged is used when an interface expects a frame containing a VLAN tag. An example of this is when two switches or a switch and a router are connected, and pass tagged traffic. Usually, manageable switches use the term 'trunk' to refer to a tagged port.
6. After you have finished creating 5 VLANs, then you save your manageable switch configuration.
MikroTik VLAN Configuration
1. Next to connect the VLAN that was created earlier, with MikroTik. You go to the Interfaces menu then go to the VLAN tab, then click the Add icon.
2. Here you have to adjust the VLAN ID and Interfaces. For example, if we connect the default VLAN, it means that the contents of the VLAN ID section on the proxy are 1 because the default VLAN id is 1. Then for the interface, for example, the default VLAN port 2 which is Tagged goes to port 2 Mikrotik. That means you fill the interface with ether2.
3. Do the same for the next VLAN.
4. Next you configure the IP in the IP menu> Address then click the add icon, here you enter the IP address and network. Then in the interface, you fill in the VLAN interface.
5. Do the same for each VLAN but different IP.
6. Next you create a DHCP Server on each VLAN, for faster use DHCP Setup. And don't forget to use the VLAN interface for the interface.
7. Finally, to test it, you can connect each Untagged VLAN port with other devices such as Access Points, Laptops, PCs, and other devices. For example, suppose we connect our Laptop with the Default VLAN whose Untagged port is on port 1. Then you try to request a DHCP IP for your laptop, if you get the appropriate DHCP IP, it means that the VLAN you created has been successful.
Summary
So that's how to create a VLAN on Mikrotik with a manageable switch. But this method is a bit of a waste of ports on Manageable Switches and MikroTik Routers. Actually, we can sacrifice only 1 port when creating a Tagged port. Suppose we are going to sacrifice port 8 as a tagged path or a link to the MikroTik. So you change port 8 as Tagged, in each VLAN that you created earlier. Then when configuring the VLAN interfaces on the MikroTik, you fill in which MikroTik port is connected to the port 8 switches manageable on each VLAN you created earlier.
Hopefully, this article about How to Create a VLAN on Mikrotik with a Manageable Switch, gives you a little insight. Also, read an article about How to Create a Web Server With Apache On Debian that you may need to know. Thank you.