Extend Ethernet only when routing is insufficient
During a host migration, retaining an existing IP can create a need that ordinary routing does not meet. VXLAN carries Ethernet across an IP path so two locations can share a Layer 2 segment. This lab joins two routers and their clients, then checks MAC learning and MTU. ARP, DHCP and broadcasts cross the segment too; routing distinct branch prefixes is usually simpler to control.
VLAN, VXLAN and EoIP boundaries
| Method | Identifier and transport | Broadcast scope and overhead | Security and fit |
|---|---|---|---|
| 802.1Q VLAN | 12-bit VID; usable VLAN IDs 1–4094; Ethernet trunk | One L2 domain per VLAN; 4-byte tag per tagged frame | Local segmentation; no encryption; cannot cross a routed hop alone |
| VXLAN | 24-bit VNI; Ethernet over UDP/IP; conventionally UDP 4789 | One L2 domain per VNI when bridging is isolated; 50 bytes above inner IP on untagged IPv4 | Routed fabric/overlay; no encryption or peer authentication |
| MikroTik EoIP | 16-bit tunnel-id; proprietary Ethernet encapsulation; IPv4 uses GRE | Point-to-point extension; 42 bytes above inner IP over IPv4 without extra tags | Two RouterOS endpoints; no encryption without a protected transport |
Before touching the routers
Use two spare routers or CHR instances with RouterOS 7.9 or newer for this lab. A maintained stable release is preferable. Commands are for an empty lab, not a production default configuration. Open WinBox New Terminal and use Safe Mode with Ctrl+X while changing connectivity.
/system resource print
/interface bridge port print
/ip address print
/ip route print
/export file=before-vxlanKeep the export off the router and secure. Inspect ether1 and ether2 first: ether1 must be a routed underlay port, ether2 a dedicated lab LAN port. If either is already in a bridge, stop and adapt the design. Do not remove your management interface blindly.
RouterOS 7.9 is the minimum for the FDB inspection used below, not a promise that every newer VXLAN feature is available. Confirm the target CLI offers each property before applying it. Do not treat the latest online manual as evidence that an older deployed build supports hardware offload.
What are we building?
This lab joins two isolated Ethernet LANs across an IPv4 routed link. Use Layer 2 extension only when an application needs it; ordinary access between different IP subnets is usually simpler with routing.
Each VXLAN endpoint is a VTEP: the point that wraps an Ethernet frame in UDP or unwraps it on receipt. The packet crosses the IP network to the other VTEP. VLAN 10 identifies a local switching network, while VNI—the VXLAN network identifier—10010 identifies the frame's overlay network. VLAN and VNI values need not match, but both tunnel ends must use the same VNI and UDP port.
Address plan and topology
PC-A 192.168.50.10/24 -- ether2 [R1] ether1 10.20.0.1/30
| IPv4 routed underlay |
PC-B 192.168.50.20/24 -- ether2 [R2] ether1 10.20.0.2/30
Overlay: vxlan10010 / VNI 10010 / UDP 4789
Endpoint MTU: 1450 (untagged IPv4 underlay MTU 1500)Connect the two ether1 ports directly in this lab. Give the PCs static unique addresses; no gateway is needed for their same-subnet test. Keep DHCP disabled in the lab. In a real routed underlay, replace the endpoint addresses and supply a route in each direction before building the overlay.
Step 1: verify the IP underlay
# R1
/ip address add address=10.20.0.1/30 interface=ether1 comment="VXLAN-LAB-underlay"
/ping 10.20.0.2 src-address=10.20.0.1 count=5
# R2
/ip address add address=10.20.0.2/30 interface=ether1 comment="VXLAN-LAB-underlay"
/ping 10.20.0.1 src-address=10.20.0.2 count=5Prepare only the IP underlay first. Run each block on its named router and repeat ping after addressing both ends; the connected /30 is sufficient for this example. Resolve link, IP or ICMP issues here. A successful underlay ping does not yet establish UDP transport or overlay health.
Purpose: Establish a routed /30 before Ethernet encapsulation.
Expected result: 10.20.0.1 and .2 reply using ether1 after both addresses exist.
Verification: Repeat source-address pings on R1 and R2.
Failure analysis: Check port membership, subnet mask, link and ICMP policy.
Rollback: Remove only the VXLAN-LAB-underlay address from each routed port.
Step 2: permit only the peer
For an existing firewall, put the peer-specific accept before any input drop that would match this traffic, and before the rule rejecting traffic outside LAN. Check rule order instead of appending blindly. The following drop applies only to VXLAN UDP on ether1. Preserve management and established-connection rules.
# R1: insert these in this order before matching input drops
/ip firewall filter add chain=input action=accept in-interface=ether1 src-address=10.20.0.2 dst-address=10.20.0.1 protocol=udp dst-port=4789 comment="VXLAN-LAB-peer"
/ip firewall filter add chain=input action=drop in-interface=ether1 protocol=udp dst-port=4789 comment="VXLAN-LAB-deny-other"
# R2: same placement requirement
/ip firewall filter add chain=input action=accept in-interface=ether1 src-address=10.20.0.1 dst-address=10.20.0.2 protocol=udp dst-port=4789 comment="VXLAN-LAB-peer"
/ip firewall filter add chain=input action=drop in-interface=ether1 protocol=udp dst-port=4789 comment="VXLAN-LAB-deny-other"
/ip firewall filter print statsA static remote VTEP entry is not an access-control rule. VXLAN provides no encryption. Use a trusted private transport; across the Internet, first build an authenticated encrypted path such as WireGuard or IPsec and use its reachable endpoint addresses, then recalculate MTU.
Step 3: configure R1
/interface bridge add name=br-vxlan protocol-mode=rstp mtu=1450 comment="VXLAN-LAB"
/interface vxlan add name=vxlan10010 vni=10010 port=4789 local-address=10.20.0.1 mtu=1450 comment="VXLAN-LAB"
/interface vxlan vteps add interface=vxlan10010 remote-ip=10.20.0.2 comment="VXLAN-LAB"
/interface bridge port add bridge=br-vxlan interface=ether2 comment="VXLAN-LAB"
/interface bridge port add bridge=br-vxlan interface=vxlan10010 comment="VXLAN-LAB"This bridge joins the test LAN to VXLAN; include only the LAN port and tunnel interface. Ether1 remains the IP transport path and must not join that bridge. The result carries one untagged Ethernet segment over the separate IP underlay.
Purpose: Connect PC-A and VNI 10010 in one isolated bridge.
Expected result: R1 bridge has ether2/vxlan10010; its VTEP points to .2.
Verification: Print bridge ports, VXLAN detail and VTEPs before connecting the PC.
Failure analysis: A port already in another bridge is a stop condition, not permission to detach it.
Rollback: Disable vxlan10010, then use the scoped lab cleanup in Operations.
Step 4: configure R2
/interface bridge add name=br-vxlan protocol-mode=rstp mtu=1450 comment="VXLAN-LAB"
/interface vxlan add name=vxlan10010 vni=10010 port=4789 local-address=10.20.0.2 mtu=1450 comment="VXLAN-LAB"
/interface vxlan vteps add interface=vxlan10010 remote-ip=10.20.0.1 comment="VXLAN-LAB"
/interface bridge port add bridge=br-vxlan interface=ether2 comment="VXLAN-LAB"
/interface bridge port add bridge=br-vxlan interface=vxlan10010 comment="VXLAN-LAB"Now connect PC-A and PC-B to ether2 on their respective routers. Set both endpoint NICs to MTU 1450 for this lab. Reducing only the tunnel MTU does not tell a bridged PC to stop sending 1500-byte packets.
Purpose: Complete the matching remote Ethernet endpoint.
Expected result: R2 VNI/port match R1 and remote-ip points back to .1.
Verification: Inspect R2 objects, then generate PC-A to PC-B ARP/ping.
Failure analysis: Check VNI mismatch, bridge ports and received UDP before host firewalls.
Rollback: Disable only the R2 lab VXLAN and restore original port/host MTU settings.
What the two forwarding tables tell you
The tables describe different mappings: the bridge host table associates a MAC with a local port, while VXLAN FDB associates it with a VTEP IP. Static VTEPs receive copies of broadcast, unknown-unicast and multicast traffic. This lab has no EVPN; adding peers increases replication rather than creating automatic isolation.
/interface bridge host print
/interface vxlan fdb print
/interface vxlan vteps print detailExpected result: after PC traffic, remote MACs appear on vxlan10010 and the correct remote endpoint. Failure analysis: an empty table before traffic is harmless; MACs alternating between ports suggest a loop or duplicate MAC. Rollback: disable the added VXLAN port while investigating rather than flushing every bridge table.
Step 5: test MTU and end-to-end traffic
For untagged inner Ethernet over IPv4, plan 50 bytes above the inner IP MTU. A 1500-byte path therefore leaves 1450 for the endpoints. Keeping inner MTU 1500 requires at least 1550 across the entire underlay, with suitable Layer 2 capacity. Tags or an additional VPN require more room.
# Linux PC-A: replace enp1s0 with the actual LAN NIC
sudo ip link set dev enp1s0 mtu 1450
ping -c 5 192.168.50.20
ping -M do -s 1422 -c 5 192.168.50.20
# Windows PC-A, elevated terminal: replace Ethernet if needed
netsh interface ipv4 set subinterface "Ethernet" mtu=1450 store=persistent
ping 192.168.50.20
ping -f -l 1422 192.168.50.20Apply the NIC MTU on PC-B too. In this IPv4 test, 1422 bytes of payload plus 28 bytes of IP/ICMP headers makes 1450. Confirm small and full-size pings, then test the actual application and a file transfer. Allow ICMP on the PC firewall where required.
Purpose: Keep the bridged host packet within the actual underlay capacity.
Expected result: 1450-byte inner IPv4 probes pass on a 1500-byte IPv4 path.
Verification: Use both small and DF probes plus an application transfer.
Failure analysis: If only large packets fail, check every hop and extra tags/VPN overhead.
Rollback: Restore recorded NIC MTU only after disabling the lab overlay.
Optional: map VLAN 10 to VNI 10010
After the basic lab works, the following modifies its existing bridge on BOTH routers. ether2 and vxlan10010 become untagged access ports in VLAN 10. Configure the VLAN table first and enable filtering last. Keep management on a separate interface. This maps one VLAN to one VNI rather than transporting a tagged trunk.
/interface bridge port set [find where bridge=br-vxlan interface=ether2] pvid=10 ingress-filtering=yes frame-types=admit-only-untagged-and-priority-tagged
/interface bridge port set [find where bridge=br-vxlan interface=vxlan10010] pvid=10 ingress-filtering=yes frame-types=admit-only-untagged-and-priority-tagged
/interface bridge vlan add bridge=br-vxlan vlan-ids=10 untagged=ether2,vxlan10010 comment="VXLAN-LAB"
/interface bridge set [find where name=br-vxlan] vlan-filtering=yes
/interface bridge vlan printFor a second isolated segment, allocate another LAN port, VLAN and VXLAN interface with a different VNI and a peer entry on both routers. Do not put unrelated VNIs in an unrestricted bridge. Never create parallel Layer 2 paths without a loop-prevention design.
Purpose: make ether2 and the overlay two access ports in VLAN 10. Expected result: a single untagged VLAN membership and matching PVIDs. Verification: inspect /interface bridge vlan print and repeat ARP/ping. Failure analysis: enabling filtering before the membership table can disconnect a port; tagged traffic is intentionally rejected. Rollback: turn vlan-filtering off in Safe Mode, then restore only the changed PVID/membership entries.
Operations and safe rollback
Keep one DHCP authority per stretched segment, document the broadcast domain and monitor CPU during real transfers. Hardware acceleration depends on the device, software version and topology; do not infer it from the bridge H flag alone. This guide makes no hardware-offload performance claim.
/interface vxlan disable [find where name=vxlan10010]
/interface bridge port remove [find where bridge=br-vxlan interface=vxlan10010]
/interface bridge port remove [find where bridge=br-vxlan interface=ether2]
/interface bridge vlan remove [find where comment="VXLAN-LAB"]
/interface vxlan vteps remove [find where interface=vxlan10010]
/interface vxlan remove [find where name=vxlan10010]
/interface bridge remove [find where name=br-vxlan]
/ip firewall filter remove [find where comment="VXLAN-LAB-peer"]
/ip firewall filter remove [find where comment="VXLAN-LAB-deny-other"]
/ip address remove [find where comment="VXLAN-LAB-underlay"]Rollback commands remove only the objects created for this empty lab; inspect matching entries before running. Restore endpoint NIC MTU to its original value (usually 1500) and restore any port membership you changed from the saved export. Keep a separate management session throughout.
For capacity planning, check the exact switch chip and release offload matrix. Software encapsulation consumes CPU; a bridge H flag only describes that bridge port. Measure CPU, drops and throughput using the intended packet sizes, number of VNIs and encrypted transport. Avoid stretching storage or latency-sensitive clusters across a WAN without their vendor latency/failure-domain requirements.
Troubleshooting checklist
/interface vxlan print detail
/interface vxlan vteps print detail
/interface vxlan fdb print
/interface bridge host print
/interface bridge port print
/interface bridge vlan print
/ip firewall filter print stats
/tool sniffer quick interface=ether1 ip-protocol=udp port=4789Start below the overlay: verify VTEP IP reachability and inspect UDP counters and a sniffer while the client pings. Missing UDP can point to the bridge or peer setup; one-way traffic calls for route and firewall-order checks. If UDP arrives but ARP fails, inspect VNI, bridge membership, PVID and VLAN tables. An empty FDB before traffic is not itself a failure.
Small pings working while large packets fail points to MTU. Intermittent access can be duplicate IPs, multiple DHCP servers, or a loop. A running interface flag alone is not proof of remote connectivity. Capture only the traffic needed and stop the sniffer after diagnosis.
Questions from deployment reviews
Is the VNI an access-control boundary?
No. It identifies an overlay. Protect VTEP reachability and keep unrelated VNIs in separate forwarding domains.
Can endpoint MTU stay at 1500?
Only when the complete transport carries the encapsulated frame, or when you have explicitly designed and tested fragmentation. A smaller tunnel MTU does not negotiate host NIC MTU.
Official references
Archived RouterOS VXLAN reference