Vlan trunk

TrunkVlan-compressor.png
Hello,
I am asking for help in configuration, as in the diagram

You can reuse most of the factory predefined configuration “Home AP” for R1. As the topic suggests that it is the VLAN configuration what you need help with, have you already read https://wiki.mikrotik.com/wiki/Manual:Interface/Bridge#VLAN_Example_.233_.28InterVLAN_Routing_by_Bridge.29? Assuming that the bridge named “bridge” from the “Home AP” configuration is already present, you would set the following at R1 (if you connnect to IP address of the device, connect to Ethernet 5 or to the wireless interface):

/interface bridge vlan
add bridge=bridge tagged=bridge untagged=ether5,wlan1 vlan-ids=1
add bridge=bridge tagged=bridge,ether4 untagged=ether2 vlan-ids=10
add bridge=bridge tagged=bridge,ether4 untagged=ether3 vlan-ids=20

/interface bridge port
add bridge=bridge interface=wlan1
add bridge=bridge interface=ether5 pvid=1
add bridge=bridge interface=ether2 pvid=10
add bridge=bridge interface=ether3 pvid=20

As you likely want R1 to take care about routing between the VLAN 10’s and 20’s subnets and the rest of the world, you have to create IP interfaces for these VLANs there:

/interface vlan
add interface=bridge name=vlan10 vlan-id=10
add interface=bridge name=vlan20 vlan-id=20

/ip address
add address=10.0.10.1/24 interface=vlan10 network=10.0.10.0
add address=10.0.20.1/24 interface=vlan20 network=10.0.20.0

And, finally, switch on Vlan-filtering:

/interface bridge set bridge vlan-filtering=yes

At this moment, you should already be able to change your notebook’s address to one of the 10.0.x.y ones, connect it to a corresponding “access” port and connect to the corresponding IP address of R1.

At R2, you do basically the same, except that you would use ether3 as access port to VLAN 1 and that you may omit setting of IP addresses in VLAN 10’s and 20’s subnets. But if you do so, you will not be able to configure R2 from any of these VLANs.

Thanks for explaining.

I still have a question.
What changes/gives

/interface bridge set bridge vlan-filtering=yes

DHCP on intercace vlan10,vlan20 ?

In short,

/interface bridge set bridge vlan-filtering=yes

makes the previous lines effective. The longer explanation is that this line activates the “new” way of handling VLANs which has become available in 6.41, and the configuration commands before are relevant to this way of configuring VLANs. If done the “old” way, you would have to create an own bridge for each VLAN to be able to connect an “access” ethernet port to a VLAN, in addition to the “trunk” bridge, as follows:

interface:         vlan10
          tagged side   untagged side
                /           \
bridge:    bridgeTr       bridge10
             /                 \
port:     ether4             ether2

To make R1 work as DHCP server for the two subnets, you have to configure a pool and a network for each of them, for example:

/ip dhcp-server network
add address=10.0.10.0/24 dns-server=10.0.10.1 gateway=10.0.10.1 ntp-server=10.0.10.1
add address=10.0.20.0/24 dns-server=10.0.20.1 gateway=10.0.20.1 ntp-server=10.0.20.1

/ip pool
add name=pool10 ranges=10.0.10.2-10.0.10.254
add name=pool20 ranges=10.0.20.2-10.0.10.254

Once you prepare these pre-requisites (in any order), you can refer to them when attaching a DHCP server to each vlanX interface:

/ip dhcp-server
add address-pool=pool10 disabled=no interface=vlan10 name=dhcp10
add address-pool=pool20 disabled=no interface=vlan20 name=dhcp20

I am very grateful for your help and a thorough explanation.
Because after two days of work without effect, it starts to work.
Thank you again

Out of curiosity, with which tool did you create that schema?

I use PhotoShop, but I can recommend it for example draw.io, maybe not the best but if I need to quickly draw a diagram I use it

Thx for info