Obsidean_VM/01-Documentation/Routers/Mikrotik - Network Redes/Mikrotik - Zerotier - zero_...

7.0 KiB


For enable more nodes:


!Pasted image 20250429124724.png

  • Authorize
  • (1) can change the name

For the first Setup - the steps needed on the Router are:


Based on your current configuration and what you need to do, here are the necessary steps:

  1. Add the ZeroTier interface to the LAN list:

    /interface list member add interface=ap2 list=LAN
    
  2. Assign the ZeroTier IP address to the router (I don't see this address assigned in the configuration):

    /ip address add address=192.168.193.62/24 interface=ap2
    
  3. Configure routes on the router for correct routing from ZeroTier to local subnets:

    /ip route add dst-address=10.1.20.0/24 gateway=bridge
    /ip route add dst-address=10.1.33.0/24 gateway=bridge
    
  4. Add NAT rules to mask traffic between networks (similar to what you already have for the VPN network):

    /ip firewall nat add action=masquerade chain=srcnat src-address=192.168.193.0/24 dst-address=10.1.20.0/24
    /ip firewall nat add action=masquerade chain=srcnat src-address=192.168.193.0/24 dst-address=10.1.33.0/24
    
  5. Ensure firewall rules allow ZeroTier traffic to internal networks:

    /ip firewall filter add action=accept chain=forward place-before=12 src-address=192.168.193.0/24 dst-address=10.1.20.0/24
    /ip firewall filter add action=accept chain=forward place-before=12 src-address=192.168.193.0/24 dst-address=10.1.33.0/24
    

Layer 2 - Setup on the Router


Para habilitar el acceso a nivel de capa 2 (Layer 2) a través de ZeroTier en su router MikroTik, necesitará configurar un puente entre su interfaz ZeroTier y su red local. Esto permitirá que el tráfico de Ethernet (capa 2) pase a través de ZeroTier, permitiendo cosas como descubrimiento de dispositivos, broadcast, multicast, etc.

Aquí está la configuración que necesita para habilitar la funcionalidad de capa 2 en su router MikroTik con ZeroTier:

  1. Primero, asegúrese de que su red ZeroTier tenga habilitada la función de Ethernet bridging en el panel de control ZeroTier Central

  2. Configure la interfaz ZeroTier para permitir el bridge:

    /zerotier interface set ap2 allow-ethernet=yes
    
  3. Añada la interfaz ZeroTier al bridge existente:

    /interface bridge port add bridge=bridge interface=ap2
    
  4. Configure las funciones de bridge apropiadas para permitir el tráfico de broadcast y multicast:

    /interface bridge settings set use-ip-firewall=yes use-ip-firewall-for-pppoe=yes use-ip-firewall-for-vlan=yes
    
  5. Asegúrese de que la interfaz ZeroTier esté en la lista LAN (como ya habíamos discutido):

    /interface list member add interface=ap2 list=LAN
    
  6. Configure el firewall para permitir el tráfico de bridge:

    /ip firewall filter add action=accept chain=forward place-before=12 in-interface=ap2 out-interface=bridge
    /ip firewall filter add action=accept chain=forward place-before=12 in-interface=bridge out-interface=ap2
    
  7. Es posible que necesite ajustar o crear reglas DHCP para permitir que los dispositivos en la red ZeroTier obtengan direcciones IP:

    /ip dhcp-server set defconf disabled=no
    

Esta configuración permite que:

  1. El tráfico de capa 2 (como broadcast y multicast) pase entre su red ZeroTier y su red local
  2. Los dispositivos conectados a través de ZeroTier aparezcan como si estuvieran físicamente en su LAN
  3. Se permita el descubrimiento de dispositivos y servicios que utilizan protocolos de capa 2

Consideraciones importantes:

  • El bridging a nivel de capa 2 aumenta significativamente el tráfico en la red ZeroTier, ya que todo el tráfico de broadcast se transmitirá a través de ella
  • Si tiene muchos dispositivos en su LAN, puede experimentar cierta latencia o degradación del rendimiento
  • La seguridad es una consideración importante: al habilitar el bridging de capa 2, está extendiendo su red local a todos los dispositivos ZeroTier, así que asegúrese de que todos los dispositivos conectados sean confiables

Esta configuración debería permitirle acceder a su red local a nivel de capa 2 a través de ZeroTier, lo que le proporcionará una experiencia de red más integrada y completa, como si estuviera físicamente conectado a su LAN.

Enable - Disable Layer 2


Opción 1: Utilizando comandos directos para activar/desactivar

Para activar el bridging de Layer 2:

/interface bridge port add bridge=bridge interface=ap2

Para desactivar el bridging de Layer 2:

/interface bridge port remove [find interface=ap2]

Use a port with a different IP range - Port5 with 192.168.1.x


# Quitar ether5 del bridge actual
/interface bridge port remove [find interface=ether5]

# Crear nuevo bridge para ether5
/interface bridge add name=bridge_ether5 protocol-mode=none
/interface bridge port add bridge=bridge_ether5 interface=ether5

# Asignar IP al nuevo bridge
/ip address add address=192.168.1.1/24 interface=bridge_ether5

# Configurar NAT
/ip firewall nat add action=masquerade chain=srcnat src-address=192.168.1.0/24
/ip firewall nat add action=masquerade chain=srcnat dst-address=192.168.1.0/24 src-address=192.168.193.0/24

# Agregar reglas de firewall para permitir tráfico entre interfaces
/ip firewall filter add action=accept chain=forward in-interface=bridge_ether5 out-interface=bridge
/ip firewall filter add action=accept chain=forward in-interface=bridge out-interface=bridge_ether5

# Agregar ruta
/ip route add dst-address=192.168.1.0/24 gateway=bridge_ether5

IP4 - Layer 3 - Rules on Zero-Tier server

#
# This is a default rule set that allows IPv4 and IPv6 traffic but otherwise
# behaves like a standard Ethernet switch:

 drop
	not ethertype ipv4
	and not ethertype arp
	and not ethertype ipv6
;

# Accept anything else. This is required since default is 'drop':

accept;

# For more information on how rules work visit: https://docs.zerotier.com/rules/

Layer 2 - Rules on Zero-Tier server

# Permitir PROFINET (ethertype 0x8892)
accept ethertype 0x8892;
accept ethertype 0x0806;

# Permitir LLDP (ethertype 0x88CC)
accept ethertype 0x88CC;

# Permitir direcciones multicast específicas para LLDP
accept macdest 01:80:C2:00:00:0E;  # Multicast principal para LLDP
accept macdest 01:80:C2:00:00:00;  # Multicast alternativa que algunos dispositivos usan
accept macdest 01:80:C2:00:00:03;  # Otra multicast alternativa

# Permitir protocolos básicos necesarios
accept ethertype arp;      # ARP (necesario para IPv4)
accept ethertype ipv4;     # IPv4 (probablemente necesario para configuración)
accept ethertype 0x800;    # IPv4 (forma alternativa)

# Opcional: permitir multicast PROFINET 
accept macdest 01:0E:CF:00:00:00;  # PROFINET DCP multicast

# Opcional: permitir tráfico de descubrimiento PROFINET (multicast)
accept chr multicast;

# Rechazar todo lo demás
#drop;