↓ Skip to main content

Implementing an L2L Concentrator with MikroTik and EoIP

Daniel Lima
Author
Daniel Lima

L2L (LAN-to-LAN) services provide a way to transport native Ethernet frames across routed IP infrastructures, allowing devices at remote locations to share the same broadcast domain and network services (such as DHCP, ARP, and VLANs) as if they were physically connected to the same switch.

For internet service providers, interconnecting networks across different sites is an important service for enterprise customers that need to keep their networks connected at Layer 2. One way to provide this type of service is through Ethernet over MPLS circuits, such as VPWS and VPLS, where the provider is responsible for transporting frames between sites.

EoIP offers another option for this scenario. For an ISP, it makes it possible to establish Ethernet tunnels over its existing IP/MPLS infrastructure without having to provision an MPLS L2VPN for each connection. For companies looking to build their own interconnection infrastructure, it allows them to set up a concentrator and connect remote sites through different internet connections, including connections from different providers. This way, the company retains control over communication between its sites without relying exclusively on a Layer 2 service provided by a single carrier.

In this article, we will build an L2L concentrator using MikroTik and EoIP. By the end, we will have a Layer 2 network connecting all locations through EoIP tunnels.

Solution Architecture
#

For this scenario, we use a Hub-and-Spoke topology consisting of a central concentrator (Hub) and two remote locations (Spokes), represented by the Terra and Mar branch offices.

Topology
Topology with a concentrator and two branch offices

The branch offices connect to the internet through PPPoE connections and receive public IP addresses that allow them to communicate with the headquarters. In an ISP environment, however, public addresses are not required if all endpoints are within the provider’s infrastructure. If part of the customer’s network is hosted by another provider, reachable addresses between the tunnel endpoints are necessary, since EoIP uses GRE and does not work particularly well with NAT.

At the headquarters, local network devices are connected to a switch, which also connects the MATRIZ-SRV-01 server. At the branch offices, computers are distributed across two VLANs (10 and 20), representing separate segments of the local network.

Configuring EoIP
#

EoIP (Ethernet over IP) is a proprietary MikroTik protocol that transports Ethernet frames between two routers over an IP network. It uses GRE encapsulation, defined in RFCs 1701 and 1702, and updated by RFCs 2890 and 2784. This allows RouterOS to create a virtual Ethernet interface and extend a Layer 2 domain between separate locations.

When this interface is added to a bridge, the router forwards Ethernet frames through the tunnel, including broadcasts, multicast traffic, and protocols such as ARP. As a result, the networks connected at both ends can share the same broadcast domain. Each tunnel is identified by a tunnel-id, which must match on both routers.

Info

Since EoIP uses GRE (IP Protocol 47) to encapsulate Ethernet frames, this protocol must be allowed in the router’s firewall for the tunnels to be established.

Example rule allowing GRE connections from the addresses listed in ip-filiais:

/ip firewall filter
add chain=input action=accept protocol=gre \
    src-address-list=ip-filiais

Although EoIP can operate over any infrastructure that provides IP connectivity between the endpoints, it does not provide encryption of its own. To protect traffic transported over public networks, it can be combined with IPsec, which is covered in the Protecting EoIP Tunnels with IPsec section.

Warning

EoIP is a MikroTik proprietary protocol and does not have a cross-vendor interoperability standard. Although third-party implementations exist, compatibility with equipment from other vendors is not guaranteed.

Configuration is straightforward: simply specify the remote endpoint address and a tunnel ID. Although optional, I also recommend specifying the source IP address to avoid errors, especially when using loopback addresses.

Tunnel configuration on the concentrator:

EoIP configuration
/interface eoip
add local-address=203.0.113.1 name=eoip-tunnel-filial-mar \
    remote-address=198.51.100.1 tunnel-id=2
add local-address=203.0.113.1 name=eoip-tunnel-filial-terra \
    remote-address=192.0.2.1 tunnel-id=1
Important

To prevent connectivity issues in TCP applications caused by a reduced path MTU, TCP MSS Clamping should remain enabled. This mechanism adjusts the MSS advertised during TCP connection establishment (SYN packets), causing devices to use smaller segments that fit within the effective path MTU.

This is particularly important in scenarios where EoIP is combined with IPsec, since the additional overhead can significantly reduce the maximum size of transported packets.

Keep in mind that MSS clamping applies exclusively to TCP connections and does not solve MTU issues for protocols such as UDP and ICMP.

The configuration on the branch routers is identical; only the IP addresses change:

/interface eoip
add local-address=192.0.2.1 mac-address=FE:11:34:40:37:0C name=\
    eoip-tunnel-matriz remote-address=203.0.113.1 tunnel-id=1
Warning

When using EoIP, MTU requires careful consideration because of the substantial protocol overhead. We add 20 bytes for the outer IP header, 8 bytes for GRE, and another 14 bytes for the encapsulated Ethernet frame (18 bytes when VLAN tags are used). This results in 42 bytes of overhead, or 46 bytes with VLANs. If the connection uses PPPoE, another 8 bytes must be accounted for. With a 1500-byte MTU, the tunnel MTU would therefore be 1458 bytes in the first case. With VLANs and PPPoE, it would be 1446 bytes. When IPsec is used, the available MTU is reduced even further and may fall below 1390 bytes.

Note

Another important point is that the bridge MTU is not automatically constrained by the EoIP interface MTU. The bridge uses the l2mtu parameter to determine the maximum size of Ethernet frames it can forward. By default, the EoIP tunnel has l2mtu=65535, allowing frames larger than the tunnel’s effective MTU to reach it. In this scenario, with dont-fragment=no (the default), the outer IP packet may be fragmented to traverse the underlay network. Therefore, it is important to consider the MTU across the entire transport path, not just the MTU configured on the bridge or EoIP interface. Fragmentation should be avoided whenever possible, especially when transporting maximum-sized frames or jumbo frames.

To examine the encapsulation in practice, below is a packet capture taken while the EoIP tunnel was operating. It shows the outer IP header, GRE encapsulation, and the transported Ethernet frame.

EoIP packet
EoIP packet captured in Wireshark

I am also providing the original capture in PCAPNG format, so you can reproduce the analysis and inspect the packet fields directly in Wireshark.

Protecting EoIP Tunnels with IPsec
#

As mentioned earlier, EoIP does not include its own encryption mechanisms. To protect the traffic carried by the tunnel, RouterOS allows IPsec to be integrated directly into the EoIP interface through the ipsec-secret parameter, which uses a pre-shared key (PSK).

When this key is configured at both ends, RouterOS automatically creates a dynamic IPsec peer and policy to protect the communication, eliminating the need to configure these elements manually.

IPsec configuration
IPsec configuration on the EoIP interface

It is important to note that, on IPv4 EoIP interfaces, IPsec and Fast Path are incompatible. Therefore, Fast Path must be disabled by setting allow-fast-path=no before configuring ipsec-secret. Otherwise, RouterOS will reject the key configuration.

/interface eoip
add local-address=203.0.113.1 name=eoip-tunnel-filial-mar \
    remote-address=198.51.100.1 tunnel-id=2 \
    allow-fast-path=no ipsec-secret=@mikrotik
add local-address=203.0.113.1 name= eoip-tunnel-filial-terra \
    remote-address=192.0.2.1 tunnel-id=1 \
    allow-fast-path=no ipsec-secret=@mikrotik

Once the configuration has been applied at both ends, EoIP traffic is protected by IPsec using ESP (Encapsulating Security Payload). The capture below shows the ESP protocol carrying data between the routers’ IP addresses.

ESP packet
EoIP packet encapsulated by ESP

RouterOS also automatically creates the Security Associations (SAs), peers, and policies required for communication, as shown below.

IPsec configuration generated by EoIP
Security Associations generated by IPsec

Bridge and VLAN Configuration
#

With the EoIP tunnels established, the next step is to add them to a bridge so Ethernet frames can be forwarded between locations.

On the concentrator, we created a bridge named bridge-eoip, which connects the two EoIP tunnels and the physical ether2 interface used to connect to the headquarters’ local network.

The configuration uses VLAN Filtering to control traffic forwarding between bridge ports. VLANs 10, 20, and 99 were defined, allowing these segments to be transported between the branch offices and headquarters without sharing the same broadcast domain.

VLANs on the bridge
VLAN configuration on the bridge
Warning

In some situations, MSS clamping may not be applied correctly to tagged VLAN traffic, causing TCP connections to become slow or experience interruptions.

For the port configuration, frame-types=admit-only-vlan-tagged was used to allow tagged frames only. This makes the EoIP tunnels and physical interface operate as trunk ports, carrying the configured VLANs.

Bridge ports
Interfaces added to the bridge
/interface bridge
add igmp-snooping=yes name=bridge-eoip priority=0x7000 vlan-filtering=yes
/interface bridge port
add bridge=bridge-eoip frame-types=admit-only-vlan-tagged interface=\
    eoip-tunnel-filial-terra
add bridge=bridge-eoip frame-types=admit-only-vlan-tagged interface=\
    eoip-tunnel-filial-mar
add bridge=bridge-eoip frame-types=admit-only-vlan-tagged interface=ether2
/interface bridge vlan
add bridge=bridge-eoip tagged=\
    bridge-eoip,eoip-tunnel-filial-mar,eoip-tunnel-filial-terra,ether2 \
    vlan-ids=10,20,99
Info

Since EoIP tunnels participate in the same Layer 2 domain, they are susceptible to loops and broadcast storms. When connecting multiple tunnels to the same bridge, keep RSTP enabled to allow loops to be detected and prevented. It is also important to ensure that each EoIP interface has a unique MAC address to avoid problems with address learning on the bridge.

On the DHCP server configured on the headquarters router, we can see the devices’ leases. As shown below, devices at the different locations received IP addresses belonging to their respective networks.

DHCP leases

When running ping tests between devices connected at different locations, we can see that the TTL remains at 64 for devices in the same VLAN and at 63 for devices in different VLANs. This difference is caused by forwarding through the gateway when communicating between different networks. Connectivity between devices at the branch offices demonstrates that the VLANs are being transported correctly through the EoIP tunnels.

Ping test

Finally, we use traceroute to observe the TTL and the hops traversed by packets on their way to the destination, making it possible to see how gateways forward traffic between remote networks.

Traceroute

Conclusion
#

This implementation demonstrated how EoIP tunnels can be used to extend Ethernet connectivity between separate locations over an existing IP infrastructure. Using bridges with VLAN Filtering made it possible to transport different network segments while preserving logical traffic separation.

Although EoIP is a simple and flexible option for environments using MikroTik equipment, it has limitations related to scalability, encapsulation overhead, and dependence on the RouterOS ecosystem. In ISP infrastructures that use an MPLS backbone, technologies such as VPLS may be more suitable for providing Layer 2 transport services at a larger scale.

Related