Dudas sobre Vlan´s

Hola de nuevo, siguo intentando aprender mas sobre mikrotik y ahora he intentado dividir la red en varias Vlan´s para separar equipos.
Tengo un Router RB4011iGS+ y un CRS109-8G-1S-2Hnd como swicht, los tengo configurados y las Vlans separadas, por aprovechar puertos del Router he sacado por ahi un par de Vlan´s. Aunque funciona creo que no esta bien configurado por que el procesador del Swicht trabaja demasiado para lo que le tengo conectado y he perdido el HardwareOffload "creo".
Una de las dudas que me han surgirdo al intentar configurarlas si se podria configurar las Vlan´s no por los puertos si no por la MAC de los equipos y no tuviera que preocuparme de donde conecto o no conecto, es que he visto un menu en el CRS de Swicht y menciona algo asi pero no tengo ni idea de como funciona por que no le intentado y no soy capaz de hacerlo funcionar.
Os paso el codigo de los 2, haber que se podria mejorar, he limpiado algunas cosas que no tienen importancia para no hacer tan largo el codigo. Y si esta bien ahi esta por si a alguien le vale al montar algo como lo mio.

El codigo del Router:

Código:
# feb/22/2022 13:29:13 by RouterOS 7.1.3
# software id = 6K8T-F4VI
#
# model = RB4011iGS+
# serial number = F0260FD2CA40
/interface bridge
add admin-mac=DC:2C:6E:18:10:DA auto-mac=no name=bridge1-BSE protocol-mode=\
    none
add ingress-filtering=no name=bridge60-Loapi protocol-mode=none \
    vlan-filtering=yes
add ingress-filtering=no name=bridge70-Wifi2 protocol-mode=none \
    vlan-filtering=yes
add ingress-filtering=no name=bridge80-Cripto protocol-mode=none \
    vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] comment="Conexion con Swicht" name=\
    ether1->Swicht
set [ find default-name=ether2 ] comment="Puertos de Administraci\F3n 2-3-4"
set [ find default-name=ether4 ] disabled=yes
set [ find default-name=ether5 ] comment="Servidor BSE-SinVlan" name=\
    ether5-BSE
set [ find default-name=ether6 ] disabled=yes
set [ find default-name=ether7 ] disabled=yes
set [ find default-name=ether8 ] comment="Puertos Cripto 8-9-10 -Vlan80"
/interface vlan
add interface=ether1->Swicht name=vlan60-Loapi vlan-id=60
add interface=ether1->Swicht name=vlan70-Wifi2 vlan-id=70
add interface=ether1->Swicht name=vlan80-Cripto vlan-id=80
add interface=sfp-sfpplus1 name=vlanWAN vlan-id=20
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/ip pool
add name=pool-Admin ranges=192.168.1.2-192.168.1.254
add name=pool60_Loapi ranges=192.168.60.2-192.168.60.254
add name=pool70-Wifi2 ranges=192.168.70.2-192.168.70.254
add name=pool-Cripto ranges=192.168.80.2-192.168.80.254
/ip dhcp-server
add address-pool=pool-Admin interface=bridge1-BSE name=dhcp-Administracion
add address-pool=pool60_Loapi interface=bridge60-Loapi name=dhcp60-Loapi
add address-pool=pool70-Wifi2 interface=bridge70-Wifi2 name=dhcp70-Wifi2
add address-pool=pool-Cripto interface=bridge80-Cripto name=dhcp80-Cripto
/interface bridge port
add bridge=bridge1-BSE ingress-filtering=no interface=ether2
add bridge=bridge1-BSE ingress-filtering=no interface=ether3
add bridge=bridge1-BSE ingress-filtering=no interface=ether4
add bridge=bridge1-BSE ingress-filtering=no interface=ether5-BSE
add bridge=bridge1-BSE ingress-filtering=no interface=ether6
add bridge=bridge1-BSE ingress-filtering=no interface=ether7
add bridge=bridge80-Cripto ingress-filtering=no interface=ether8
add bridge=bridge80-Cripto ingress-filtering=no interface=ether9
add bridge=bridge80-Cripto ingress-filtering=no interface=ether10
add bridge=bridge1-BSE ingress-filtering=no interface=ether1->Swicht
add bridge=bridge60-Loapi interface=vlan60-Loapi
add bridge=bridge70-Wifi2 interface=vlan70-Wifi2
add bridge=bridge80-Cripto interface=vlan80-Cripto
/ip neighbor discovery-settings
set discover-interface-list=LAN
/ip settings
set max-neighbor-entries=8192
/ipv6 settings
set disable-ipv6=yes max-neighbor-entries=8192
/interface list member
add interface=bridge1-BSE list=LAN
add interface=vlanWAN list=WAN
/ip address
add address=192.168.1.1/24 interface=bridge1-BSE network=192.168.1.0
add address=192.168.60.1/24 interface=bridge60-Loapi network=192.168.60.0
add address=192.168.70.1/24 interface=bridge70-Wifi2 network=192.168.70.0
add address=192.168.80.1/24 interface=bridge80-Cripto network=192.168.80.0
/ip dhcp-client
add interface=vlanWAN use-peer-dns=no
/ip dhcp-server lease
add address=192.168.1.250 client-id=\
    ff:49:2b:b2:8c:0:1:0:1:26:49:7f:27:50:e5:49:2b:b2:8c mac-address=\
    50:E5:49:2B:B2:8C server=dhcp-Administracion
/ip dhcp-server network
add address=192.168.1.0/24 gateway=192.168.1.1
add address=192.168.60.0/24 dns-server=45.90.28.130,45.90.30.130 gateway=\
    192.168.60.1
add address=192.168.70.0/24 dns-server=45.90.28.130,45.90.30.130 gateway=\
    192.168.70.1
add address=192.168.80.0/24 dns-server=45.90.28.130,45.90.30.130 gateway=\
    192.168.80.1
/ip dns static
add address=192.168.88.1 comment=defconf disabled=yes name=router.lan
add address=45.90.28.0 name=dns.nextdns.io
add address=45.90.30.0 name=dns.nextdns.io
add address=2a07:a8c0:: name=dns.nextdns.io type=AAAA
add address=2a07:a8c1:: name=dns.nextdns.io type=AAAA
/ip firewall filter
add action=accept chain=forward in-interface=zerotier1
add action=accept chain=input in-interface=zerotier1
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=drop chain=forward comment="Bloqueo entre Vlans" in-interface=\
    bridge1-BSE out-interface=bridge60-Loapi
add action=drop chain=forward in-interface=bridge1-BSE out-interface=\
    bridge70-Wifi2
add action=drop chain=forward in-interface=bridge1-BSE out-interface=\
    bridge80-Cripto
add action=drop chain=forward in-interface=bridge60-Loapi out-interface=\
    bridge1-BSE
add action=drop chain=forward in-interface=bridge60-Loapi out-interface=\
    bridge70-Wifi2
add action=drop chain=forward in-interface=bridge60-Loapi out-interface=\
    bridge80-Cripto
add action=drop chain=forward in-interface=bridge70-Wifi2 out-interface=\
    bridge1-BSE
add action=drop chain=forward in-interface=bridge70-Wifi2 out-interface=\
    bridge60-Loapi
add action=drop chain=forward in-interface=bridge70-Wifi2 out-interface=\
    bridge80-Cripto
add action=drop chain=forward in-interface=bridge80-Cripto out-interface=\
    bridge1-BSE
add action=drop chain=forward in-interface=bridge80-Cripto out-interface=\
    bridge60-Loapi
add action=drop chain=forward in-interface=bridge80-Cripto out-interface=\
    bridge70-Wifi2
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
/system identity
set name=RouterLoapi
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN

El Codigo del Swicht:
Código:
# feb/22/2022 13:25:18 by RouterOS 7.1.3
# software id = KC43-W1DL
#
# model = CRS109-8G-1S-2HnD
# serial number = D250080DFDA8
/interface bridge
add ingress-filtering=no name=bridge60-Loapi protocol-mode=none \
    vlan-filtering=yes
add ingress-filtering=no name=bridge70-WifiCams protocol-mode=none \
    vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] name=ether1-<Router
set [ find default-name=ether2 ] name=ether2-PC1
set [ find default-name=ether3 ] name=ether3-NASLOAPI
set [ find default-name=ether4 ] name=ether4-PC2
set [ find default-name=ether5 ] disabled=yes
set [ find default-name=ether6 ] name=ether6-PC3
set [ find default-name=ether7 ] name=ether7-IMPRESORA
set [ find default-name=ether8 ] disabled=yes
set [ find default-name=sfp1 ] disabled=yes
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n channel-width=20/40mhz-XX \
    default-authentication=no default-forwarding=no disabled=no frequency=\
    auto installation=indoor mode=ap-bridge ssid=Distri-Loapi wps-mode=\
    disabled
/interface vlan
add interface=ether1-<Router name=vlan60-Loapi vlan-id=60
add interface=ether1-<Router name=vlan70-Wifi2 vlan-id=70
add disabled=yes interface=ether1-<Router name=vlan80-Cripto vlan-id=80
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa2-psk,wpa2-eap \
    group-ciphers=tkip,aes-ccm mode=dynamic-keys supplicant-identity=MikroTik \
    unicast-ciphers=tkip,aes-ccm
add authentication-types=wpa2-psk,wpa2-eap eap-methods="" mode=dynamic-keys \
    name=Wifi-Cams supplicant-identity=""
/interface wireless
add disabled=no keepalive-frames=disabled mac-address=CE:2D:E0:9A:15:84 \
    master-interface=wlan1 multicast-buffering=disabled name=wlan-Cams \
    security-profile=Wifi-Cams ssid=Loapi-Cams wds-cost-range=0 \
    wds-default-cost=0 wps-mode=disabled
/port
set 0 name=serial0
/interface bridge port
add disabled=yes interface=ether1-<Router
add bridge=bridge60-Loapi interface=ether2-PC1
add bridge=bridge60-Loapi interface=vlan60-Loapi
add bridge=bridge60-Loapi interface=ether4-PC2
add bridge=bridge60-Loapi interface=ether6-PC3
add bridge=bridge60-Loapi interface=ether7-IMPRESORA
add bridge=bridge60-Loapi interface=wlan1
add bridge=bridge60-Loapi interface=ether3-NASLOAPI
add bridge=bridge70-WifiCams interface=wlan-Cams
add bridge=bridge70-WifiCams interface=vlan70-Wifi2
/ip dhcp-client
add interface=ether1-<Router
/lcd
set backlight-timeout=never default-screen=stats-all
/lcd interface pages
set 0 interfaces="ether1-<Router,ether2-PC1,ether3-NASLOAPI,ether4-PC2,ether5,\
    ether6-PC3,ether7-IMPRESORA,ether8,sfp1"
/system clock
set time-zone-name=Europe/Madrid
/system identity
set name=SwichtLoapi

He de decir que me he leido los Post que hay de Vlan´s aqui en el foro y no he sido capaz de hacerlo funcionar tal y como se explica y esta es la unica forma que he conseguido de que funcionen, supongo que por el echo de como lo tengo todo conectado.

Un Saludo
 
Uff compi, esas dos configuraciones no hay por dónde cogerlas.

Para el 4011: usa bridge-vlan-filtering, ni más ni menos. Y, si todo el tema vlans lo vas a manejar a nivel de switch, ni eso, simplemente taggea las vlans que vayas a usar sobre el puerto trunk y andando. Si quieres un manual de cómo hacer bridge vlan filtering, lo tienes en este mismo sub.

Para el CRS109: lo tienes explicado en la página de ayuda de mikrotik. Y sí, puedes hacer VLANs basadas en la MAC de quien se conecte, en ese equipo concreto, aunque yo empezaría por lo más sencillo, el "port based vlan": https://help.mikrotik.com/docs/page...RS1xx/2xxseriesswitchesexamples-PortBasedVLAN

Si quieres que te eche una mano con un ejemplo práctico sencillo, dibújame en un papel el setup al que quieres llegar, y te doy el arranque.

Saludos!
 
Wenasss, sigo intentando configurarlo como se explica en el manual, lo estoy intentando en un pequeño laboratorio que me he montado.
Captura de pantalla 2022-02-24 231759.png

He conseguido configurar el Router para que asigne bien los rangos de IP pero no llega al swicht y por mas vueltas que le doy no consigo ver donde cometo el error o que es lo que me falta, igual es tambien por todas la veces que lo he reseteado y estoy olvidando algo basico, pero no se por que. Os paso los codigos de ambos y aver si me podeis ayudar y que pueda conseguir entender como funcionan bien las Vlans en Mikrotik.

La Config del Router:

Código:
# feb/24/2022 23:16:06 by RouterOS 6.49.2
# software id =
#
#
#
/interface bridge
add name=bridge-Vlans vlan-filtering=yes
add name=bridge1
/interface ethernet
set [ find default-name=ether1 ] disable-running-check=no
set [ find default-name=ether2 ] disable-running-check=no
set [ find default-name=ether3 ] disable-running-check=no
set [ find default-name=ether4 ] disable-running-check=no
set [ find default-name=ether5 ] disable-running-check=no
set [ find default-name=ether6 ] disable-running-check=no
set [ find default-name=ether7 ] disable-running-check=no
set [ find default-name=ether8 ] disable-running-check=no
/interface vlan
add interface=bridge-Vlans name=vlan500 vlan-id=500
add interface=bridge-Vlans name=vlan600 vlan-id=600
add interface=bridge-Vlans name=vlan700 vlan-id=700
/interface list
add name=WAN
add name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.1.2-192.168.1.254
add name=dhcp_pool1 ranges=192.168.1.2-192.168.1.254
add name=dhcp_pool2 ranges=192.168.50.2-192.168.50.254
add name=dhcp_pool3 ranges=192.168.60.2-192.168.60.254
add name=dhcp_pool4 ranges=192.168.70.2-192.168.70.254
/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=bridge1 lease-time=1m name=\
    dhcp1
add address-pool=dhcp_pool2 disabled=no interface=vlan500 lease-time=1m name=\
    dhcp2
add address-pool=dhcp_pool3 disabled=no interface=vlan600 lease-time=1m name=\
    dhcp3
add address-pool=dhcp_pool4 disabled=no interface=vlan700 lease-time=1m name=\
    dhcp4
/interface bridge port
add bridge=bridge-Vlans interface=ether2
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=ether4
add bridge=bridge-Vlans interface=ether5 pvid=500
add bridge=bridge-Vlans interface=ether6 pvid=600
add bridge=bridge-Vlans interface=ether7 pvid=700
/interface bridge vlan
add bridge=bridge-Vlans tagged=bridge-Vlans,ether2 untagged=ether5 vlan-ids=\
    500
add bridge=bridge-Vlans tagged=bridge-Vlans,ether2 untagged=ether6 vlan-ids=\
    600
add bridge=bridge-Vlans tagged=bridge-Vlans,ether2 untagged=ether7 vlan-ids=\
    700
/interface list member
add interface=ether1 list=WAN
add interface=bridge1 list=LAN
/ip address
add address=192.168.1.1/24 interface=bridge1 network=192.168.1.0
add address=192.168.50.1/24 interface=vlan500 network=192.168.50.0
add address=192.168.60.1/24 interface=vlan600 network=192.168.60.0
add address=192.168.70.1/24 interface=vlan700 network=192.168.70.0
/ip dhcp-client
add disabled=no interface=ether1 use-peer-dns=no
/ip dhcp-server network
add address=0.0.0.0/24 gateway=0.0.0.0 netmask=24
add address=192.168.1.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=192.168.1.1
add address=192.168.50.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=192.168.50.1
add address=192.168.60.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=192.168.60.1
add address=192.168.70.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=192.168.70.1
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
/system identity
set name=RoutberLab

La config del Swicht:

Código:
# feb/24/2022 23:26:04 by RouterOS 6.49.2
# software id =
#
#
#
/interface bridge
add name=bridge-vlans vlan-filtering=yes
/interface ethernet
set [ find default-name=ether1 ] disable-running-check=no
set [ find default-name=ether2 ] disable-running-check=no
set [ find default-name=ether3 ] disable-running-check=no
set [ find default-name=ether4 ] disable-running-check=no
set [ find default-name=ether5 ] disable-running-check=no
set [ find default-name=ether6 ] disable-running-check=no
set [ find default-name=ether7 ] disable-running-check=no
set [ find default-name=ether8 ] disable-running-check=no
/interface vlan
add interface=ether1 name=vlan500 vlan-id=500
add interface=ether1 name=vlan600 vlan-id=600
add interface=ether1 name=vlan700 vlan-id=700
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/interface bridge port
add bridge=bridge-vlans interface=vlan500
add bridge=bridge-vlans interface=vlan600
add bridge=bridge-vlans interface=vlan700
add bridge=bridge-vlans interface=ether2 pvid=500
add bridge=bridge-vlans interface=ether3 pvid=500
add bridge=bridge-vlans interface=ether4 pvid=600
add bridge=bridge-vlans interface=ether5 pvid=600
add bridge=bridge-vlans interface=ether6 pvid=700
add bridge=bridge-vlans interface=ether7 pvid=700
/interface bridge vlan
add bridge=bridge-vlans tagged=bridge-vlans,ether1 untagged=ether2,ether3 \
    vlan-ids=500
add bridge=bridge-vlans tagged=bridge-vlans,ether1 untagged=ether4,ether5 \
    vlan-ids=600
add bridge=bridge-vlans tagged=bridge-vlans,ether1 untagged=ether6,ether7 \
    vlan-ids=700
/ip dhcp-client
add disabled=no interface=ether1
/system identity
set name=SwichtLab

Un Saludo.

Nota: Si a alguien le interesa el laboratorio asi con routers Mikrotik, podria hacer un tutorial de como montarlo desde 0 para poder trastear lo que se quiera, asi podria aportar algo ya que me habeis ayudado tanto.
 
Buenas!

¿Llegaste a leerte lo que te mandé? La configuración del router es buena. De hecho, si conectas a ether2 un equipo final y sobre ese equipo le dices que etiquete el tráfico con cualquiera de las 3 vlans que salen en modo trunk por ese puerto, verás que las estás mandando correctamente, y coges una IP de ese segmento.

Pero, con el switch, no sé lo que has hecho. Estás redefiniendo de nuevo las vlans (en un switch no es necesario, sólo las filtra) y metes vlans como puertos en los bridges, junto con puertos ethernet (configuración incorrecta de capa 2)... Siguiendo lo que ya te mandé el otro día, y a sabiendas del equipo que tienes (tienes un CRS1XX, no CRS3XX y pico, la manera de filtrar VLANs a nivel hardware en ese equipo NO es bridge-vlan-filtering, a menos que lo estés usando como router), tendrías algo así (copio y pego de lo que ya te mandé)

Partiendo de que el switch no tiene conifguración (o de que simplemente tiene un bridge con todos los puertos dentro, si es así, omite el primer paso).

Paso 1: tener un bridge con todos los puertos, es decir, un switch
Código:
/interface bridge
add name=bridge

/interface bridge port
add bridge=bridge interface=ether1
add bridge=bridge interface=ether2
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether5
add bridge=bridge interface=ether6
add bridge=bridge interface=ether7
add bridge=bridge interface=ether8

Paso 2: Definir los puertos de acceso. En esos puertos, en ingress (entrada de tráfico al switch), lo que venga con la vlan por defecto 0, lo traducimos a la VLAN correspondiente (en egress hará justo lo opuesto). Es decir, etiquetamos el tráfico que venga sin VLANs en la VLAN que tenga que llevar en ese puerto, correspondiente a su acceso:
[coce]
/interface ethernet switch ingress-vlan-translation
add ports=ether2 customer-vid=0 new-customer-vid=500
add ports=ether3 customer-vid=0 new-customer-vid=500
add ports=ether4 customer-vid=0 new-customer-vid=600
add ports=ether5 customer-vid=0 new-customer-vid=600
add ports=ether6 customer-vid=0 new-customer-vid=700
add ports=ether7 customer-vid=0 new-customer-vid=700
[/code]

Paso 3: Lo mismo que lo anterior, pero en eggress (salida del switch al router) y para el puerto trunk, etiquetando el tráfico a la salida del mismo sobre el puerto que te engancha con el router (o con otro switch, si tuvieras más de un puerto trunk)
Código:
/interface ethernet switch egress-vlan-tag
add tagged-ports=ether1 vlan-id=500
add tagged-ports=ether1 vlan-id=600
add tagged-ports=ether1 vlan-id=700

Paso 4: apañado como entra y sale el tráfico del switch, definimos cómo se comportará cuando esté dentro. Es decir, definimos la tabla de VLANs y qué puertos van a estar involucrados con ellas (bien sea de entrada o de salida, cosa que ya tenemos cubierta en el pasos anteriores)
Código:
/interface ethernet switch vlan
add ports=ether1,ether2,ether3 vlan-id=500
add ports=ether1,ether4,ether5 vlan-id=600
add ports=ether1,ether6,ether7 vlan-id=700

Paso 5: Para nota, no necesario para un laboratorio. Una vez hemos definido esto, impedimos que tráfico que no vaya dirigido a estos puertos con las vlans que hemos definido pase por el switch
Código:
/interface ethernet switch
set drop-if-invalid-or-src-port-not-member-of-vlan-on-ports=ether1,ether2,ether3,ether4,ether5,ether6,ether7

Paso 6: muy aconsejable: definir una VLAN de management, y que sólo esa VLAN tenga acceso al switch. Esta te la dejo para que la investigues tú, que lo tienes también en la wiki.

Saludos!
 
Arriba