What is collision domain and broadcast domain ?
Collision Domain is a group of Ethernet or Fast Ethernet devices in a CSMA/CD LAN
that are connected and compete for access on the network. Only one device in the collision domain may transmit at any one time, and the other devices in the domain listen to the network in order to avoid data collisions. A collision domain is sometimes referred to as an Ethernet segment.
Broadcast Domain, broadcasting sends a message to everyone on the local network (subnet). An example for Broadcasting would be DHCP Request from a Client PC. The Client is asking for a IP Address, but the client does not know how to reach the DHCP Server. So the client sends a DHCP Discover packet to EVERY PC in the local subnet (Broadcast). But only the DHCP Server will answer to the Request. Another simple example is if we have LAN segment 192.168.100.0/24, then we can say that all IP addresses range of 192.168.100.0/24 are in the same broadcast domain.
How to count Collision and Broadcast Domain ?
Please refer to post 1.1 Difference Between Switch and Hub for basic understanding about switch and hub.
Collision Domain on Switch :
Each connection from a single PC to a Layer 2 switch is ONE Collision domain. For example, if 2 PCs are connected with separate cables to a switch, so we have 2 Collision domains. If this switch is connected to another switch or a router, we have one collision domain more (3 collision domain in total). Please refer to figure 1.1.1.
Collision Domain on Hub :
If 2 Devices are connected to a Hub, this is ONE Collision Domain. Each device that is connected to a Layer 1 device (repeater, hub) will reside in ONE single collision domain. If a hub or repeater connected to a switch on LAN, the collision domain on LAN will remain the same. Hub or repeater just extend collision domain from switch’s port connected to it. Please refer to figure 1.1.2.
Broadcast Domain :
No matter how many hosts or devices are connected together, if they are connected with a repeater, hub, switch or bridge, all these devices are in ONE Broadcast domain (assuming a single VLAN). A Router is used to separate Broadcast-Domains (we could also call them Subnets - or call them VLANs). So, if a router stands between all these devices, we have TWO broadcast domains. Please refer to figure 1.1.3