If one switch is replaced by a hub with four PCs, that part, including its link to the router, becomes one collision domain: 4 PC ports and 1 link at the remaining switch plus 1 for the hub gives 6.
CSMA/CD: rules for a shared medium
In early Ethernet (coaxial cable, later hubs) everyone shared one cable. The rule for this is called CSMA/CD (Carrier Sense Multiple Access with Collision Detection, IEEE 802.3, Clause 4):
Listen (carrier sense): is the line free?
Send when it is free.
Detect a collision: if someone else sends at the same time, both stop and send a jam signal.
Wait a random time (backoff) and start again.
Today a switch connects every device through its own link in full duplex: there are no more collisions, CSMA/CD is switched off. Wi-Fi, by contrast, still has a shared medium (the radio cell); there CSMA/CA (collision avoidance) applies according to IEEE 802.11, because a radio cannot listen while it transmits.
Half and full duplex
Mode
Meaning
Where
Half duplex
send or receive in turn
hub, early Ethernet, Wi-Fi
Full duplex
send and receive at the same time
switch port, router interface, fibre
With full duplex the usable data rate doubles in total: 1 Gbit/s out and 1 Gbit/s back.
Autonegotiation
When plugged in, two Ethernet ports on copper negotiate which speed and which duplex both support and choose the best (IEEE 802.3, Clause 28; mandatory for 1000BASE-T). Classic mistake: one side is fixed at 100 Mbit/s full duplex, the other negotiates and falls back to half duplex. The network works, but slowly and with many errors (duplex mismatch). Fix: both sides on “auto” or both fixed to the same values.
Unicast, multicast, broadcast
Type
Destination
Example (MAC)
Unicast
exactly one device
02:00:00:00:01:00
Multicast
a group
01:00:5e:00:00:05 (OSPF), 33:33:00:00:00:01 (IPv6 all nodes)
A switch sends broadcasts and unknown destinations to all ports of the same VLAN (flooding). IPv6 no longer has broadcast and uses multicast instead (see Neighbor Discovery (NDP) and SLAAC).
In leyoNET
See the broadcast domain: start a ping to a new destination. The ARP request appears as a dot on all cables of the VLAN, the reply only on the way back.
leyoNET does not simulate collisions: all cable connections run in full duplex, as in today's networks. Instead, a loop without spanning tree shows how broadcasts multiply endlessly (demo “broadcast storm”, see Spanning tree (STP)).
With VLANs (VLANs and trunks) one switch becomes several broadcast domains; only a router or layer 3 switch connects them.
How to do it in leyoNET
The same text as in the app’s help (F1 key).
Switching
A switch records each frame's source MAC and port (MAC table, also called SAT for “source address table”). If it knows the destination it forwards only there, otherwise to all ports (flooding). Broadcasts such as ARP always go to every port in the same VLAN. If two devices share a MAC address, the switch learns it alternately on two ports («MAC flapping»): frames reach the wrong device and the switch console reports «MAC moves».
VLANs
VLANs split one switch into separate networks. An access port belongs to exactly one VLAN, a trunk carries several (Trunks).
Under Tools → VLANs each VLAN gets a name and a colour. The colour automatically tints every port of that VLAN on the canvas and in the port table. Between VLANs you need a router (Router on a stick) or a layer 3 switch.
Creating VLANs: a switch only forwards VLANs it knows (tab Switching → VLANs on this switch or vlan 20, name Training). Assigning a new VLAN to an access port creates it, as on Cisco. A switch in the middle with trunks only still needs the VLANs, otherwise it drops the frames (console: «VLAN 20 is not created»). no vlan 20 deletes a VLAN, its ports become inactive. Files before version 1.2 have no list: there all VLANs in use count as created.
See an example
Slow motion This is how it looks in the simulation: every dot is a frame on the cable.ARP and ping in the LAN
Three computers on a switch, all in 192.168.1.0/24.
PC 1 asks for PC 2's MAC with an ARP broadcast, then four ICMP echoes follow. The switch learns its MAC table.
Ethernet and MAC addressesHow frames are addressed in the local network, how a switch learns where to send them, and what happens when a MAC address appears twice.
SwitchConnects devices in the same network, learns MAC addresses, separates networks with VLANs and prevents loops with spanning tree.
VLANs and trunksOne switch, several separate networks: access ports, trunks with 802.1Q tag, native VLAN and routing between VLANs.