How to configure dhcp+vlan+trunk?

Hello,
I purchased a Mikrotik router are RB2011UIAS-2HND-IN model.

I try to configure on this device several VLAN on one port.
Those. I try to organize a TRUNK port. And I also want each VLAN to have its own DHCP server.

Maybe you have a config file?

Thank you.

Let’s assume you’ll use ether5 as trunk port and none of other ports will be access port for one of trunked VLANs. Config would be something like this:


/interface bridge port
remove [ find interface=ether5 ] # remove ether5 port from any bridge
/interface vlan
add interface=ether5 name=e1-v100 vlan-id=100
add interface=ether5 name=e1-v255 vlan-id=255
/ip address
add interface=e1-v100 address=192.168.100.1/24
add interface=e1-v255 address=10.255.0.1/16
/ip pool
add name=pool-100 ranges=192.168.100.13-192.168.100.42
add name=pool-255 ranges=10.255.1.0-10.255.200.255
/ip dhcp-server 
add address-pool=pool-100 interface=e1-v100 name=dhcp-100
add address-pool=pool-255 interface=e1-v255 name=dhcp-255
/ip dhcp-server network
add address=192.168.100.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=192.168.100.1
add address=10.255.0.0/16 dns-server=2.2.2.2,3.3.3.3 gateway=10.255.0.1 ntp-server=4.4.4.4

Then add some appropriate firewall filter rules (if you don’t want all the subnets freely access each other).

Adjust names and VLAN IDs according to needs. Add any number of additional VLANs and appropriate IP addresses, DHCP-server stuff, etc.

If you want to have any ether ports as access (untagged) ports of one of those VLANs, then configuration should be quite different and the above template is mostly not appropriate.