It can be really confusing as we know "port" as in TCP/UDP context, but here in layer 2 (data link) context, a "port" is equivalent to an "interface" in Linux language.
When we talk about ports of a bridge, we are talking about different interfaces that may share the same physical network interface.
Similarly, an "address" in layer 2 context represents a MAC address of an interface/port.
Layer 2 is defined in OSI model as data link layer
In layer 2 context, we have:
- Interface/port represented by MAC address
- Ethernet protocol (IEEE 802.3) whose (max) length is defined by MTU, we use MAC addresses in Ethernet frames
- Other protocols shown in the picture
The equivalent of "packets" in layer 2, strictly speaking, "packets" are of layer 3 which is network layer, instead of transport layer.
Switch is a data-link layer device, where it recodes all the MAC addresses of all the devices connected to it, then create a dedicated link when forward data from one port to another port.
Bridge is a data-link layer device, where it usually connects two LANs to reduce the size of collision domains when the data-link protocol share the communication media.
So basically why do we need bridges? Because we need more than one interface/port on one physical network interface, for example:
We need two networks on eth0, without a bridge there will be collision in data link layer.
A bridge connects networks together, whereas a switch connects nodes (or interfaces) together.
So here comes STP (Spanning Tree Protocol), used by switches to turn a redundant topology into a spanning tree
In STP, switches decide which port/interface to use for inter-switch connection.