Skip to content

Lab 03-01 · Bridge: turn your router into one big network

MTCNA

Module 3 · Bridging of the MikroTik MTCNA course, official slides p136–149 (what a bridge is, collision and broadcast domains, the RouterOS bridge, wireless bridging and the LAB "Bridge" on p145–149).

Picture two classrooms next to each other, separated by a sliding wall. Each class has its own teacher, its own whiteboard and its own announcements. Now somebody slides the wall open. Suddenly it is one big room: everybody hears every announcement, and you can walk over to a student from the other class without asking anybody for permission.

Your MikroTik router normally keeps your laptop in its own little room (192.168.88.0/24), separated from the classroom network (10.0.0.0/24). To get out, every packet has to go through the router's "door" (routing and NAT). In this lab you slide the wall open: the router becomes a bridge, your laptop joins the classroom network directly, gets its address from the trainer's router, and can talk to your neighbour's laptop face to face.

What you will learn

  • Explain what a bridge does and why it works at Layer 2 (MAC addresses, not IP addresses).
  • Tell apart a collision domain from a broadcast domain, and say which one a bridge splits.
  • Turn a home router into a transparent bridge: add the Internet port to the LAN bridge.
  • Explain why your own DHCP server must be switched off first (the trap that breaks the whole class).
  • Explain why a bridge port cannot keep its own DHCP client, and where to move it.
  • Know the wireless variant (station bridge) used when no cable is available.

The analogy: sliding the wall open

Keep this picture for the whole lab.

Classroom Network What it means
A room with walls A LAN (one broadcast domain) Everybody inside hears each other's "shouts"
The door with a doorman A router Lets people out to other rooms, writing down who went where
Sliding the wall open Making the router a bridge Two rooms become one; no doorman any more
The teacher handing out seat numbers A DHCP server Only ONE teacher should do it in the big room
Students' names MAC addresses What a bridge looks at to deliver frames

What is a bridge?

A bridge is a device that joins several network segments into one network. It works at Layer 2 (the data link layer of the OSI model): it forwards frames by looking at their MAC addresses, and it does not change them.

The slides stress three ideas:

  • It is transparent. The bridge does not rewrite anything. Your laptop does not even know it is there.
  • It learns. The bridge keeps a table of "which MAC address lives behind which port" (the host table, WinBox Bridge → Hosts). A frame for a known MAC goes out of that port only; a frame for an unknown MAC, or a broadcast, goes out of every port.
  • It joins different physical media. In RouterOS a bridge can join Ethernet ports, WiFi interfaces, tunnels... into a single network. A switch chip can only join the ports wired to that same chip.

Where does the word come from?

Early Ethernet (the 1980s) was one long coaxial cable shared by every computer. When it got too busy, engineers cut it in two and put a box in the middle that only passed a frame across if the destination was on the other side. It "bridged" the two halves. The classic standard for bridges is IEEE 802.1D (its content now lives inside IEEE 802.1Q); a modern switch is just a bridge with many ports and dedicated hardware.

Collision domain vs broadcast domain

Two words appear on slides p137–139 and on the exam.

Collision domain Broadcast domain
What it is The devices that could talk "on top of each other" on a shared medium The devices that receive a broadcast (a frame "for everybody", like a DHCP Discover)
Old shared cable, or a hub One for everybody One for everybody
After a bridge / switch Split: one per port Still one: the bridge forwards broadcasts everywhere
After a router Split Split: routers do not forward broadcasts

So a bridge separates collision domains but keeps a single broadcast domain. That is exactly why your laptop will receive the trainer's DHCP answer after this lab: the DHCP Discover is a broadcast, and now it crosses your router.

The bridge inside your router

A MikroTik home router already uses a bridge: the factory configuration puts all LAN ports into one bridge (called bridge1 in our virtual lab, bridge on a real hAP). A port inside a bridge is a bridge port (RouterOS also says slave, flag S). The slides warn: an interface inside a bridge must not be treated individually any more. Addresses, DHCP servers and DHCP clients go on the bridge, never on its ports.

flowchart TB
    subgraph BEFORE["Before: a router (two rooms)"]
        direction LR
        L1["pc1<br>192.168.88.254"] --- B1["bridge1<br>192.168.88.1"]
        B1 -.->|"routing + NAT"| W1["ether2<br>10.0.0.x"]
        W1 --- C1["class network<br>10.0.0.0/24"]
    end
    subgraph AFTER["After: a bridge (one big room)"]
        direction LR
        L2["pc1<br>10.0.0.x"] --- B2["bridge1<br>ether3 + ether2"]
        B2 --- C2["class network<br>10.0.0.0/24"]
    end

The scenario

flowchart LR
    INET["<b>internet</b><br>198.51.100.10<br>web server"]
    CAP["<b>class-ap</b><br>trainer's router<br>10.0.0.1 · DHCP 10.0.0.100-200"]
    subgraph R1["r1 · your router"]
        R1W["ether2<br>Internet port"]
        R1B["<b>bridge1</b><br>192.168.88.1/24"]
    end
    subgraph R2["r2 · neighbour's router"]
        R2W["ether2<br>Internet port"]
        R2B["<b>bridge1</b><br>192.168.89.1/24"]
    end
    PC1["<b>pc1</b><br>your laptop"]
    PC2["<b>pc2</b><br>neighbour's laptop"]
    INET ---|"198.51.100.0/24"| CAP
    CAP ---|"ether2 · 10.0.0.0/24"| R1W
    CAP ---|"ether4 · 10.0.0.0/24"| R2W
    R1B ---|"ether3"| PC1
    R2B ---|"ether3"| PC2
Node Role Address
internet "The Internet": answers ping, serves a web page 198.51.100.10/24
class-ap The trainer's router: class gateway, DHCP server, DNS, NAT 10.0.0.1/24 (class), 198.51.100.1/24
r1 Your router: ether2 = Internet port, ether3 = LAN port in bridge1 WAN by DHCP · LAN 192.168.88.1/24
r2 Your neighbour's router, same factory setup WAN by DHCP · LAN 192.168.89.1/24
pc1, pc2 The two laptops (Linux), MACs 02:00:00:00:01:01 and 02:00:00:00:02:01 By DHCP

Why ether2 and not ether1?

On a real hAP the Internet port is ether1. In the virtual lab ether1 is reserved for the lab itself (containerlab uses it to manage the router), so the Internet port is ether2 and the LAN ports start at ether3. Never touch ether1 in these labs. In the classroom your hAP's ether1 is plugged by cable into the trainer's router, exactly like ether2 here.

You will configure both routers: r1 is yours, r2 plays your neighbour. In class, your neighbour does r2 on their own hAP.

Start the lab

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

sudo containerlab deploy -t topology.clab.yml

Three RouterOS routers have to boot: give it two or three minutes. Then open one terminal per device:

ssh admin@clab-mtcna-03-01-r1            # password: admin   (also r2)
docker exec -it clab-mtcna-03-01-pc1 bash   # also pc2

At any moment you can run CLAB_EXEC="docker exec" ./check.sh to see which parts are already solved.

Step 1 · Look at the two rooms (and make a backup)

The slides say it twice: be careful when connecting networks and make a backup before starting. One wrong click in this lab can hand out wrong addresses to the whole classroom.

On r1 (WinBox: Files → Backup, then Bridge → Ports, IP → DHCP Server, IP → DHCP Client):

/system backup save name=before-bridge
/interface bridge port print
/ip dhcp-server print
/ip dhcp-client print

Expected: bridge1 has one port, ether3. A DHCP server defconf runs on bridge1. A DHCP client on ether2 is bound to an address 10.0.0.x (you may also see a client on ether1: that is the lab's own management port, ignore it).

On pc1, ask for an address and look at where you are:

dhclient -v eth1
ip -br address show eth1

You should get 192.168.88.254/24: an address from your router's room.

Check yourself

  1. Who gave pc1 its address right now: r1 or class-ap? How do you know from the address alone?
  2. What does a backup file let you do if the class network breaks during the lab?

Done when the backup before-bridge.backup is listed in /file print and pc1 has a 192.168.88.x address.

Step 2 · Switch off your DHCP server

In one big room there must be one teacher handing out seat numbers. If your router kept its DHCP server running after joining the class network, it would answer the DHCP Discover of every laptop in the classroom, handing out 192.168.88.x addresses that lead nowhere. This is called a rogue DHCP server, and it is the number-one way to break a classroom network in this lab.

WinBox: IP → DHCP Server, select defconf, click the red X (disable).

/ip dhcp-server disable defconf
/ip dhcp-server print

Expected: the server shows the flag X (disabled). Disabled, not removed: you can switch it back on later.

Check yourself

  1. Why must the DHCP server be disabled before you add the Internet port to the bridge, and not after?

Done when /ip dhcp-server print shows defconf with the X flag.

Step 3 · Add the Internet port to the bridge

This is the "slide the wall open" moment. You make ether2 (the cable to the trainer's router) a port of bridge1, next to ether3 (your laptop). From now on, frames flow between them without being routed.

WinBox: Bridge → Ports → +, Interface ether2, Bridge bridge1.

/interface bridge port add bridge=bridge1 interface=ether2
/interface bridge port print

Expected: two ports in bridge1, ether3 and ether2.

Now look at the DHCP client again:

/ip dhcp-client print

The client on ether2 now carries the flag I (invalid) and the comment DHCP client can not run on slave or passthrough interface! ether2 has handed its traffic over to the bridge, so it cannot have an IP configuration of its own any more.

Check yourself

  1. After this step, is ether2 still a separate "room"? Which interface represents the whole big room now?

Done when bridge1 has the ports ether2 and ether3.

Step 4 · Move the router's DHCP client to the bridge

The slides stop at Step 3, but the invalid DHCP client shows a loose end: your router itself lost its classroom address. Give the router a seat in the big room too, by asking DHCP on the bridge. That way you can still reach it, and it can still reach the Internet for itself (updates, NTP...).

WinBox: IP → DHCP Client, remove the invalid entry on ether2, then +, Interface bridge1.

/ip dhcp-client remove [find interface=ether2]
/ip dhcp-client add interface=bridge1
/ip dhcp-client print

Expected after a few seconds: a client on bridge1, status bound, with an address 10.0.0.x.

The bridge-port trap, again

The rule from Module 2 still holds: IP addresses, DHCP servers and DHCP clients go on the bridge, never on a bridge port. If you see the flag I (invalid) or S (slave) on something Layer 3, it is sitting on a port.

Done when the DHCP client on bridge1 is bound.

Step 5 · Do the same on your neighbour's router

Repeat Steps 1 to 4 on r2 (in class, your neighbour does it on their own hAP):

/system backup save name=before-bridge
/ip dhcp-server disable defconf
/interface bridge port add bridge=bridge1 interface=ether2
/ip dhcp-client remove [find interface=ether2]
/ip dhcp-client add interface=bridge1

Done when r2's bridge1 also has the ports ether2 and ether3, and its DHCP server is disabled.

Step 6 · Renew the laptops and talk to your neighbour

The slides say: renew your laptop's IP address; it must get its address from the trainer's router. Ask your neighbour for their laptop's address and ping it.

On pc1 and on pc2:

dhclient -r eth1          # give the old address back
dhclient -v eth1          # ask again
ip -br address show eth1
ip route

Expected: an address between 10.0.0.100 and 10.0.0.200, and default via 10.0.0.1. The DHCP answer came from class-ap, through your router, which did not even notice.

Now, from pc1, ping your neighbour's laptop (use the address pc2 got) and open a web page:

ping -c 3 10.0.0.1xx      # pc2's address
curl http://www.mikrotik.com/

ping must answer, and curl prints Welcome to the Internet.

Finally, on r1, look at the bridge's host table (WinBox Bridge → Hosts):

/interface bridge host print

You will see 02:00:00:00:01:01 (pc1) learned on ether3, and pc2's MAC 02:00:00:00:02:01 plus the other routers learned on ether2. The bridge knows who sits on which side.

Check yourself

  1. Run traceroute -n 10.0.0.1 on pc1. How many hops do you see? Why does your router not appear as a hop any more?
  2. On class-ap, /ip dhcp-server lease print lists pc1 and pc2. Why could it never see them before this lab?

Done when both laptops have 10.0.0.x addresses, pc1 pings pc2, and curl works. Run CLAB_EXEC="docker exec" ./check.sh: every line must say PASS.

Backup: no cable available?

In our classroom every router reaches the trainer's router by cable (ether1 on the hAP). WiFi is only the backup. The course slides (p142–147) show this lab over WiFi, and WiFi has a catch: by the 802.11 rules, a normal WiFi client (station mode) only sends frames with its own MAC address, so it cannot carry your laptop's frames into a bridge. RouterOS solves it with special modes:

Mode Works with How
station bridge RouterOS AP to RouterOS station 4-address frames: the frame carries the laptop's MAC too
station pseudobridge Any AP The router translates MAC addresses (works for IPv4, with limits)
station WDS RouterOS to RouterOS A WDS link, like a cable through the air

For station bridge the AP must allow it (Bridge Mode enabled on the trainer's AP, the default). On the hAP ac² (driver wireless): Wireless → wlan1 → Mode: station bridge, then the same Steps 2–4 with wlan1 instead of ether1. The full configuration is in final/r1-wifi-backup.rsc. On a hAP ax² (driver wifi) the mode is configuration.mode=station-bridge, and both ends must use the same driver family (wifi with wifi, wireless with wireless).

If something goes wrong

Symptom Likely cause Fix
Laptops all over the class get 192.168.88.x Somebody's DHCP server is still enabled after bridging /ip dhcp-server disable defconf on that router
pc1 keeps 192.168.88.254 It still holds its old lease dhclient -r eth1 then dhclient -v eth1
dhclient waits and gives up ether2 is not in the bridge, or the cable/port is down /interface bridge port print; add ether2 to bridge1
DHCP client shows I (invalid) It sits on ether2, now a bridge port Remove it and add it on bridge1
You cannot reach the router at 192.168.88.1 any more Your laptop is now in 10.0.0.0/24, another network Use the router's new 10.0.0.x address, or WinBox by MAC address
Ping to the neighbour fails but the Internet works The neighbour has not bridged yet, or you pinged their old address Ask for the address they got after renewing
Real class: the whole network goes down A loop: two cables between the same switches Unplug the extra cable; RSTP (on by default) normally blocks loops

Clean up

sudo containerlab destroy -t topology.clab.yml --cleanup

Key takeaways

  • A bridge joins segments into one network at Layer 2, forwarding frames by MAC address without changing them.
  • A bridge splits collision domains but keeps one broadcast domain; a router splits both.
  • Adding the Internet port to the LAN bridge turns the router into a transparent bridge: laptops get addresses from the upstream DHCP server.
  • Disable your own DHCP server first, or you become a rogue DHCP server for the whole class.
  • Addresses and DHCP clients go on the bridge, never on a bridge port.
  • Over WiFi, a plain station cannot bridge; RouterOS uses station bridge (RouterOS to RouterOS) or station pseudobridge.

Quick check

1. At which layer of the OSI model does a bridge work?
  • Layer 1, physical: it only repeats electrical signals
  • Layer 2, data link: it forwards frames by MAC address
  • Layer 3, network: it forwards packets by IP address
  • Layer 4, transport: it forwards segments by port number

A bridge works at Layer 2. It reads the destination MAC address of each frame and looks it up in its host table. It never looks at, or changes, IP addresses.

2. Two laptops are connected to the same bridge. What do they share?
  • The same collision domain and different broadcast domains
  • Nothing: a bridge separates them completely
  • The same broadcast domain, but separate collision domains
  • The same IP address and the same MAC address

A bridge forwards broadcasts to every port, so both laptops are in one broadcast domain (both hear a DHCP Discover). But each port is its own collision domain. Only a router splits broadcast domains.

3. Why must you disable the router's DHCP server before adding the Internet port to the bridge?
  • Because a bridge cannot have more than one port while a DHCP server is running
  • Because it would answer the DHCP requests of every laptop in the class network
  • Because the DHCP server would change the MAC addresses of the bridge ports
  • Because RouterOS refuses to add a port while a DHCP server is enabled

Once bridged, your router is inside the classroom's broadcast domain. Its DHCP server would answer everybody's DHCP Discover with 192.168.88.x addresses: a rogue DHCP server that breaks the network for the whole class.

4. After adding ether2 to bridge1, the DHCP client on ether2 shows the flag I. Why?
  • Because the class DHCP server has run out of addresses
  • Because the bridge disabled ether2 to avoid a loop
  • Because ether2 is now a bridge port and cannot hold its own IP configuration
  • Because DHCP clients only work on wireless interfaces

A bridge port (slave) hands all its traffic to the bridge. Layer 3 settings on it are invalid. The DHCP client must move to the bridge itself, bridge1.

5. Why can't a WiFi interface in plain station mode be added to a bridge and carry your laptop's traffic?
  • Because WiFi is too slow for bridging
  • Because WiFi frames have no MAC addresses at all
  • Because a normal 802.11 station only sends frames with its own MAC address
  • Because a bridge can only contain Ethernet ports

In the 802.11 standard a plain station uses frames with room for its own MAC only. To carry other devices' frames, RouterOS uses station bridge (4-address frames, RouterOS to RouterOS) or station pseudobridge (MAC translation, any AP).

6. You bridged your router and renewed your laptop's lease. Pick the two things that are now true.
  • Your laptop got its address from the trainer's router
  • Your router now does NAT for your laptop's traffic
  • Your laptop can reach your neighbour's laptop without any route
  • Your laptop still uses 192.168.88.1 as its gateway

The router is now a transparent bridge: the DHCP Discover crossed it and class-ap answered. Both laptops are in the same network 10.0.0.0/24, so they talk directly at Layer 2. No routing and no NAT happen inside your router any more.

7. Which slide warning is the reason to save a backup before this lab?
  • Bridging deletes the router's configuration
  • Joining networks by mistake can break the whole classroom network
  • The router reboots when a port is added to a bridge
  • The DHCP server cannot be enabled again once disabled

Bridging joins your network to everybody's. A mistake, like a forgotten DHCP server or a loop, affects the whole class, so a backup lets you return to a known good state fast.

Next: the bridge you just built works in software. In the next lab you measure how fast it can go, and what Fast Path, Fast Forward and hardware offloading change.