Update: FIXED. Entries in the config that were removed are now commented out in the main post.
Our end-goal is to be able to rate-limit all the individual ports on a switch, so that our customer’s tenants can better share bandwidth. I THOUGHT I had it working well, but ran into a major wrinkle once it was brought to the site.
The main Mikrotik M1 currently has the below configuration, it gets its internet on ether1 via pppoe (or for my testing via dhcp). Switch S is able to (transparently) tag all traffic on its ports; port 1 is the trunk, port 2 uses vlan “2”, port 3 uses vlan “3”, all the way up to port 24 using vlan “24”. I had a Windows Laptop WL plugged in to any given port on the switch, and its bandwidth was correctly limited to my specs. The devices connecting directly to the switch are unaware of vlan, the switch does all that for them.
The wrinkle came when a tenant plugged in a router instead of a device or switch. (Sure there’s some potential double-nat involved, but that doesn’t create any issues here.) When they did that, NONE of the devices could route to the internet. I got the devices M1 and S back and replicated the setup with a second Mikrotik M2 and the laptop WL.
Works: WL → M1 directly ; WL gets an ip in 192.168.88.x
Works: WL → M1 directly, but with WL picking vlan XX ; WL gets an ip in 192.168.1XX.x
Works: WL → M2 → M1 ; M2 gets an ip in 192.168.88.x, and WL gets an ip from M2 – note, “double nat but with working internet”
Works: WL → S → M1 ; WL gets an ip in 192.168.1XX.x
DOES NOT WORK: WL → M2 → S → M1
In that final not-working case, I see that M2’s dhcp query is being received by M1 and an ip is allocated from the pool, but M2 isn’t applying it. And so there’s no routing. The only difference I can see in the config is that the connection to M1 is via vlanXX instead of via the bridged ether2-5 ports.
There seems to be something fundamental that I’m missing, but I can’t see it. Help?
/interface vlan
add interface=bridge name=vlan2 vlan-id=2
add interface=bridge name=vlan3 vlan-id=3
...
add interface=bridge name=vlan24 vlan-id=24
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/ip pool
add name=dhcp ranges=192.168.88.10-192.168.88.254
add name=vlan2 ranges=192.168.102.10-192.168.102.254
add name=vlan3 ranges=192.168.103.10-192.168.103.254
...
add name=vlan24 ranges=192.168.124.10-192.168.124.254
/ip dhcp-server
add address-pool=dhcp disabled=no interface=bridge name=defconf
add address-pool=vlan2 disabled=no interface=vlan2 name=vlan2
add address-pool=vlan3 disabled=no interface=vlan3 name=vlan3
...
add address-pool=vlan24 disabled=no interface=vlan24 name=vlan24
/queue simple
add max-limit=4M/16M name=vlan2 target=vlan2
add max-limit=16M/64M name=vlan3 target=vlan3
...
add max-limit=64M/512M name=vlan24 target=vlan24
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
### add bridge=bridge comment=defconf interface=vlan2
### add bridge=bridge comment=defconf interface=vlan3
### ...
### add bridge=bridge comment=defconf interface=vlan24
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
add comment=defconf interface=vlan2 list=LAN
add comment=defconf interface=vlan3 list=LAN
...
add comment=defconf interface=vlan24 list=LAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=ether2 network=192.168.88.0
add address=192.168.102.1/24 interface=vlan2 network=192.168.102.0
add address=192.168.103.1/24 interface=vlan3 network=192.168.103.0
...
add address=192.168.124.1/24 interface=vlan24 network=192.168.124.0
/ip dhcp-client
add comment=defconf disabled=no interface=ether1
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1
add address=192.168.102.0/24 gateway=192.168.102.1
add address=192.168.103.0/24 gateway=192.168.103.1
...
add address=192.168.124.0/24 gateway=192.168.124.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=accept chain=input comment="allow ssh,http,https" dst-port=22,80,443 in-interface=ether1 protocol=tcp
add action=accept chain=input comment="allow ssh,http,https" dst-port=22,80,443 in-interface=pppoe-out1 protocol=tcp
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related disabled=yes
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN