← 🔌 Medium Access & LANs
Subtopic 3 of 4

4.3Hubs, bridges, switches and VLANs

The idea

Hubs repeat everything to every port. Switches and bridges learn which MAC lives on which port and forward selectively. A VLAN divides one switch into several broadcast domains.

Think of it like this: A hub is a loudspeaker, a switch is a receptionist who remembers where everyone sits and walks messages straight to their desk.

Why it exists

GATE asks for collision and broadcast domain counts and for what a switch does with a given frame.

How it works

  1. Learn: record the source MAC and the arrival port.
  2. Forward: if the destination is known on another port, send only there.
  3. Flood: if unknown or broadcast, send to all ports except the arrival one.
  4. Filter: if the destination is on the same port, drop.

Worked example: Frame A → B arrives on port 1 and B is unknown.

Learn A = port 1; flood to ports 2, 3 and 4. When B replies from port 2, B = port 2 is learned and later frames go straight there.

Now play with it

  • →Step through the example and watch the MAC table fill in.
  • →Look at the last frame: a broadcast is flooded even though all MACs are known.

A 4-port learning switch. Hosts A, C are on ports 1 and 3; B and D share port 2 (through a hub). The switch learns source addresses and decides using the destination.

MAC table
MACport
empty
  • Frame A → B arrives on port 1: learn A = port 1; flood to ports 2, 3, 4
  • Frame B → A arrives on port 2: learn B = port 2; forward to port 1 only
  • Frame C → A arrives on port 3: learn C = port 3; forward to port 1 only
  • Frame A → C arrives on port 1: learn A = port 1; forward to port 3 only
  • Frame D → B arrives on port 2: learn D = port 2; filter (destination is on the same port, drop)
  • Frame B → D arrives on port 2: learn B = port 2; filter (destination is on the same port, drop)
  • Frame C → broadcast arrives on port 3: learn C = port 3; flood to ports 1, 2, 4
DeviceLayerCollision domainsBroadcast domains
Hub / repeater1one for all portsone
Bridge / switch2one per portone (unless VLANs)
Switch with VLANs2one per portone per VLAN
Router3one per portone per port

Check yourself

Which device creates a separate collision domain per port but keeps one broadcast domain?

Remember: Switch learns from source, forwards by destination, floods unknown. Router splits broadcast domains.
Exam notes (the dense version)

A hub repeats bits to all ports: one collision domain and one broadcast domain. A bridge or switch is a learning device: it notes the source MAC and port of each frame, forwards to the known port, floods if the destination is unknown or broadcast, and filters if it lies on the same port. Each switch port is its own collision domain; the broadcast domain still spans the whole switch. A VLAN splits one switch into several broadcast domains; routers (layer 3) separate broadcast domains. Connecting n machines with k-port switches in a tree needs ⌈(n − 2)/(k − 2)⌉ switches.

Previous year questions: Medium Access & LANs (5)

PYQs are grouped by topic, so this is the full set for Medium Access & LANs; try the ones that match this subtopic. Open all 5 on the topic page.