Skip to content

Lab 03-02 · Bridge performance: Fast Path, Fast Forward and hardware offloading

MTCNA

Module 3 · Bridging of the MikroTik MTCNA course, official slides p150–158 (bridge firewall, Fast Path, Bridge Fast Forward, switch hardware offloading, performance comparison, loopback bridge and the LAB "Prueba rendimiento Bridge con y sin Fast Forward" on p158).

Real hardware lab

This lab is done in class on a real MikroTik hAP ac² with two laptops, not in containerlab. We tried it in the virtual lab and it does not show anything useful there: the free licence of the virtual router (CHR) limits every interface to 1 Mbit/s, and its virtual network cards do not use the bridge Fast Path, so every counter stays at 0. The starting and final configurations are in initial/hap-ac2.rsc and final/hap-ac2.rsc.

Think about airport security. A normal passenger queues, puts the bag on the belt, walks through the scanner and maybe gets searched. A frequent flyer uses the fast track: same checks, fewer of them. The crew walks through a staff door with a quick badge check. And a plane changing gates never enters the terminal at all: it is towed across the tarmac.

A RouterOS bridge has the same four lanes for every frame that crosses it. Which lane a frame takes decides how much work the router's processor does, and so how fast the bridge can go. In this lab you put two laptops on a bridge, push as much traffic as you can between them, and switch the lanes on and off one by one.

What you will learn

  • Name the four ways a RouterOS bridge can forward a frame, from slowest to fastest: slow path, Fast Path, Fast Forward, hardware offloading.
  • Explain why Fast Forward needs a bridge with exactly two ports, and why the factory bridge never qualifies.
  • Turn each mechanism on and off and prove which one is working with the bridge counters and the port H flag.
  • Measure throughput with iperf3 and CPU load with /tool profile, and explain why the numbers can look equal while the CPU tells a different story.
  • Explain what Use IP Firewall on a bridge costs.
  • Create a loopback bridge (a bridge with no ports) and say what it is good for.

The analogy: four lanes through the airport

Airport Bridge Who does the work
Full security check, maybe a search Slow path The CPU runs every check in the Linux kernel (firewall, queues, MAC learning...)
Fast track Fast Path The CPU, skipping most kernel processing
Crew door with a badge Fast Forward The CPU, skipping even more checks (MAC learning included)
Plane towed across the tarmac Hardware offloading The switch chip: the CPU never sees the frame

The slides summarise it on p156: Hardware offloading > Fast Forward > Fast Path > Slow Path.

The four lanes, one by one

Slow path: the full check

The slow path is the normal way a frame crosses a RouterOS bridge: it goes through the whole Linux network stack of the router, so every feature (firewall, queues, sniffer...) can see it.

It is the most flexible lane and the slowest. You fall back into it as soon as you use a feature that needs to inspect every frame.

Fast Path: the fast track

Fast Path forwards packets without the extra processing of the Linux kernel. The slides say it "significantly improves forwarding speeds".

It only works when the interfaces support it and nothing needs to look at the traffic. The slides (p152) list the conditions for routed (IPv4) traffic: no firewall rules, no simple queues, no torch or sniffer, no HotSpot. For bridged traffic the MikroTik manual (Packet Flow in RouterOS) gives its own list:

  • no bridge firewall rules (bridge filter or NAT) are configured, and Use IP Firewall is off,
  • sniffer, torch and traffic generator are not running,
  • DHCP snooping is not enabled on the bridge, and a few more.

Fast Forward: the crew door

Fast Forward is a special case of Fast Path for a bridge with exactly two running ports. It can skip several bridge checks, including MAC address learning, so it is even faster.

The slides (p154) list every condition. The ones you will touch in this lab:

Condition Why it matters here
The bridge has fast-forward=yes The switch you flip (it is the default in RouterOS 7)
The bridge has only 2 running ports The factory bridge on a hAP has 6 ports: never Fast Forward
Both ports support Fast Path, and Fast Path is active Fast Forward is built on top of it
Bridge hardware offloading is disabled If the switch chip does the work, the CPU lanes are not used at all
VLAN filtering and DHCP snooping are disabled They need to inspect frames

The full list also requires the flooding options at their defaults (unknown-unicast-flood, unknown-multicast-flood, broadcast-flood = yes), horizon=none on both ports, and the bridge's MAC address matching one of its ports (the default, auto-mac=yes, does that).

Hardware offloading: never entering the terminal

Hardware offloading lets the router's switch chip forward frames between its own ports. The CPU is not involved, so the speed is the full speed of the ports.

In RouterOS a bridge port shows the flag H (hardware-offloaded) when this is happening. It only works between ports of the same switch chip, and only on models whose chip RouterOS supports for it, which is why the slides (p140) call it limited. The slides (p155) also mention L3 hardware offloading (L3HW, "IP switching"): some bigger switch chips can even do routing in hardware. A hAP is not one of them.

Use IP Firewall: a door back to the slow lane

A bridge normally forwards frames without asking the IP firewall. With Bridge → Settings → Use IP Firewall (slide p150) the bridged traffic also goes through the IP firewall rules, which is useful to filter between bridged devices, and costs you the fast lanes: every frame takes the slow path.

A bridge with no ports: the loopback

Slide p157 shows a trick: a bridge with no ports at all. A real interface goes down when its cable is unplugged, taking its IP address with it. A port-less bridge is never "unplugged", so an address on it is always up. That is useful as a stable identity for the router, for example for routing protocols such as OSPF (MTCRE course). This bridge is called a loopback bridge.

The scenario

flowchart LR
    A["<b>Laptop A</b><br>172.16.0.1/24<br>iperf3 client"]
    subgraph HAP["hAP ac² · your router"]
        E4["ether4"]
        BT["<b>bridge-test</b><br>exactly 2 ports<br>fast-forward=yes"]
        E5["ether5"]
        LO["<b>loopback</b><br>no ports<br>10.255.255.1/32"]
        E4 --- BT --- E5
    end
    B["<b>Laptop B</b><br>172.16.0.2/24<br>iperf3 server"]
    A ---|"cable"| E4
    E5 ---|"cable"| B
Device Role Address
hAP ac² The router under test. ether4 and ether5 leave the factory bridge and form bridge-test No address needed on bridge-test (pure Layer 2)
Laptop A Sends traffic (iperf3 -c) 172.16.0.1/24, on its wired card
Laptop B Receives traffic (iperf3 -s) 172.16.0.2/24, on its wired card

Work in pairs: one hAP, two laptops with an Ethernet port (or a USB adapter), two cables.

Start the lab

Download the lab files and unzip them: 03-02-bridge-fast-forward.zip. Open a terminal inside the 03-02-bridge-fast-forward folder.

  1. Reset the hAP to the factory configuration (System → Reset Configuration, keep "No Default Configuration" unticked), or start from the router you used in the previous labs.
  2. Connect WinBox from a third device to ether2 (it stays in the factory bridge), or by MAC address.
  3. Plug Laptop A into ether4 and Laptop B into ether5.
  4. On both Ubuntu laptops, install iperf3 and give the wired card a fixed address (find its name with ip -br link):

    sudo apt install -y iperf3
    sudo ip addr add 172.16.0.1/24 dev enp0s31f6     # Laptop B: 172.16.0.2/24 (use your card's name)
    

Step 1 · See why the factory bridge never uses Fast Forward

WinBox: Bridge → Bridge, double-click bridge, look at Fast Forward; then Bridge → Ports.

/interface bridge print
/interface bridge port print
/interface bridge monitor bridge once

Expected: fast-forward=yes is already set, but the bridge has ether2, ether3, ether4, ether5, wlan1 and wlan2: far more than two ports. Fast Forward can never be active on it.

Check yourself

  1. Which condition of the Fast Forward list does the factory bridge break?

Done when you can explain why the factory bridge cannot use Fast Forward.

Step 2 · Build a two-port test bridge

Take ether4 and ether5 out of the factory bridge and put them into a new bridge of their own. Set hw=no for now, so the switch chip stays out of the game and you can study the CPU lanes first.

WinBox: Bridge → Ports, remove ether4 and ether5; Bridge → +, Name bridge-test, Fast Forward ticked; Bridge → Ports → + twice, untick Hw. Offload.

/interface bridge port remove [find interface=ether4]
/interface bridge port remove [find interface=ether5]
/interface bridge add name=bridge-test fast-forward=yes
/interface bridge port add bridge=bridge-test interface=ether4 hw=no
/interface bridge port add bridge=bridge-test interface=ether5 hw=no
/interface bridge monitor bridge-test once

Expected: port-count: 2 and fast-forward: yes in the monitor. From Laptop A, ping -c 3 172.16.0.2 must answer.

Done when the monitor of bridge-test says fast-forward: yes.

Step 3 · Measure the four lanes

For every row of the table below: change one setting, run the test, read the counters, write the result.

On Laptop B (leave it running): iperf3 -s

On Laptop A, for each row: iperf3 -c 172.16.0.2 -t 10

On the router, during the test (WinBox Tools → Profile, and Bridge → Settings):

/tool profile duration=8s
/interface bridge settings print

The bridge settings show four counters that only ever grow: bridge-fast-path-packets, bridge-fast-forward-packets (and their -bytes). Note them before and after each test: the one that grew tells you which lane your frames took.

Row Setting to change (only this one) Expected lane How you prove it
1 Starting point: hw=no, fast-forward=yes Fast Forward bridge-fast-forward-packets grows
2 /interface bridge set bridge-test fast-forward=no Fast Path bridge-fast-path-packets grows, Fast Forward does not
3 /interface bridge settings set use-ip-firewall=yes Slow path neither counter grows
4 Undo rows 2 and 3, then /interface bridge port set [find bridge=bridge-test] hw=yes Hardware offloading (if the chip can) ports show flag H; counters do not grow; CPU stays near 0 %

Undo row 3 with /interface bridge settings set use-ip-firewall=no and row 2 with /interface bridge set bridge-test fast-forward=yes.

Fill in your own table in the report:

Row Lane iperf3 result (Mbit/s) CPU load during the test (%) Counter that grew
1
2
3
4

Why several rows may show the same speed

The hAP's ports and your laptops are Gigabit Ethernet, so a TCP test cannot go much above about 940 Mbit/s whatever the router does. If two lanes both reach that ceiling, the speed column cannot tell them apart, but the CPU load column can: the faster lane does the same job with less work. That is exactly what the "performance" on slide p156 means.

Check yourself

  1. Which row used the most CPU, and which the least? Does it match the order on slide p156?
  2. In row 4, did your ports show the H flag? What does that tell you about the switch chip of your router?

Done when your table has all four rows filled in.

Step 4 · Create a loopback bridge

Create a bridge with no ports and give it an address. It is always running, even with every cable unplugged.

WinBox: Bridge → +, Name loopback; IP → Addresses → +, 10.255.255.1/32, Interface loopback.

/interface bridge add name=loopback
/ip address add address=10.255.255.1/32 interface=loopback
/interface print where name=loopback

Expected: the loopback interface has the flag R (running) although it has no ports.

Check yourself

  1. Why is a /32 mask enough for a loopback address? How many addresses does a /32 contain?

Done when loopback is running with 10.255.255.1/32. Compare your router with final/hap-ac2.rsc.

If something goes wrong

Symptom Likely cause Fix
Laptop A cannot ping Laptop B Wrong card got the address, or a laptop is still on WiFi in the same range ip -br addr; put the address on the wired card
fast-forward: no in the monitor although it is set to yes A third port in the bridge, or a port not running (cable unplugged) Keep exactly two ports, both cables plugged
No counter grows in rows 1 and 2 Hardware offloading is still on (H flag), or a bridge filter/NAT rule exists hw=no on both ports; bridge Fast Path also needs no bridge firewall rules
iperf3: "unable to connect" The server is not running on Laptop B, or B's own firewall blocks port 5201 Start iperf3 -s; sudo ufw allow 5201/tcp
WinBox lost the router You were connected through ether4 or ether5 Connect through ether2, or by MAC address

Clean up

Put ether4 and ether5 back into the factory bridge and remove the test bridges:

/interface bridge remove [find name=bridge-test]
/interface bridge remove [find name=loopback]
/interface bridge port add bridge=bridge interface=ether4
/interface bridge port add bridge=bridge interface=ether5

Or simply restore the backup you made before the lab.

Key takeaways

  • A bridge forwards a frame through one of four lanes: slow path, Fast Path, Fast Forward or hardware offloading, from slowest to fastest.
  • Fast Path needs supporting interfaces and no feature that inspects traffic (bridge firewall rules, Use IP Firewall, sniffer, torch...).
  • Fast Forward additionally needs a bridge with exactly two running ports and hardware offloading disabled.
  • Hardware offloading (port flag H) lets the switch chip do the work; the CPU never sees the frame.
  • Use IP Firewall on a bridge sends every frame down the slow path.
  • A loopback bridge has no ports and is always up: a stable address for the router.

Quick check

1. Which order goes from the slowest to the fastest way of forwarding through a bridge?
  • Slow path, Fast Path, Fast Forward, hardware offloading
  • Fast Path, slow path, hardware offloading, Fast Forward
  • Hardware offloading, Fast Forward, Fast Path, slow path
  • Fast Forward, Fast Path, slow path, hardware offloading

Slide p156: hardware offloading > Fast Forward > Fast Path > slow path. The less work the CPU does per frame, the faster the bridge. With hardware offloading the CPU does no work at all.

2. Why can the factory bridge of a hAP never use Fast Forward?
  • Because Fast Forward is disabled by default in RouterOS 7
  • Because it has more than two ports
  • Because it has an IP address configured
  • Because it contains Ethernet ports

Fast Forward requires a bridge with exactly two running ports. The factory bridge joins several Ethernet ports and the WiFi interfaces, so it never qualifies, even with fast-forward=yes.

3. What does the flag H on a bridge port mean?
  • The port is hidden from WinBox
  • The port runs at half duplex
  • The switch chip forwards that port's traffic in hardware
  • The port is the bridge's root port in STP

H means hardware-offloaded: the switch chip forwards frames between those ports, so the CPU never sees them. It only works between ports of the same switch chip.

4. You enable Use IP Firewall on the bridge. What happens to the bridged traffic?
  • It is blocked until you add an accept rule
  • It moves to hardware offloading
  • It goes through the IP firewall and takes the slow path
  • It switches to Fast Forward automatically

Use IP Firewall makes bridged frames pass through the IP firewall rules. Inspecting every frame needs the full kernel processing, so the traffic loses the fast lanes and takes the slow path.

5. Two lanes both show about 940 Mbit/s in your iperf3 test. How can you still tell which one is better?
  • Run the test for one second instead of ten
  • Compare the CPU load the router needed during each test
  • Compare the MAC addresses learned by the bridge
  • Count how many ports each bridge has

Gigabit Ethernet caps TCP at roughly 940 Mbit/s, so both lanes hit the cable's ceiling. The faster lane does the same job with less CPU load, which leaves the processor free for everything else.

6. What is a loopback bridge useful for?
  • To connect two routers without a cable
  • To make Fast Forward work with three ports
  • To hold an address that stays up even when every cable is unplugged
  • To detect loops between switches

A loopback bridge has no ports, so it never goes down. An address on it is always reachable while the router reaches any network: a stable identity used, for example, by routing protocols.

Next module: routing. Instead of joining networks into one, you will keep them separate and teach the router how to travel between them.