Sub topic 1
Why segment a switched network
Prerequisites
This chapter assumes you already know the following:
- How Ethernet frames are built and how MAC addresses identify interfaces.
- How a Layer 2 switch learns source MAC addresses and then forwards, floods or filters frames.
- IPv4 addressing, subnet masks and CIDR notation.
- Basic command-line use on a switch or router. This chapter has no switch configuration. Later chapters configure VLANs.
The problem: one switch, one broadcast domain
A switch with no VLAN configuration forwards frames based on its MAC address table. Unicast frames to a known destination go out of one port. Some frames cannot be handled that way, so the switch floods them out of every other port:
- Broadcast frames, with destination
ff:ff:ff:ff:ff:ff. - Unknown unicast frames, where the destination MAC is not in the table.
- Multicast frames, unless the switch has a feature such as IGMP snooping to limit them.
The set of devices that receive a broadcast frame sent by any one of them is a broadcast domain. Switches connected to each other with ordinary links, and no router between them, form one broadcast domain. A switch does not divide it. A router does, because a router does not forward Layer 2 broadcasts.
Do not confuse this with a collision domain. On modern full-duplex switched links, every port is already its own collision domain, so collisions are not the concern. The concern is how far flooded traffic travels.
What generates broadcast traffic
Hosts send broadcasts as part of normal operation:
- ARP requests. A host that wants to reach an IPv4 neighbor asks "who has 192.168.1.20?" in a broadcast frame.
- DHCP discovery. A booting client broadcasts
DHCPDISCOVERbecause it has no address and does not know the server. - Name and service discovery. Protocols such as NetBIOS name service, mDNS (multicast), SSDP and some vendor discovery protocols announce or query on the local segment.
- Application and cluster traffic. Some software uses broadcast for heartbeats, license discovery or wake-on-LAN.
IPv6 has no broadcast, but it does not escape the problem. Neighbor Discovery uses multicast to solicited-node addresses, and router advertisements use all-nodes multicast. A switch without multicast filtering floods those frames to every port in the domain as well.
Each host in the broadcast domain must receive each broadcast frame and let its network stack look at it. A well-behaved host discards irrelevant frames quickly, but the work is not zero, and it scales with the number of devices.
Costs of a large flat network
Wasted capacity and host load
The broadcast load on each host grows roughly with the number of hosts in the domain, because each host contributes its own ARP, DHCP and discovery traffic and every host receives all of it. A few dozen hosts rarely notice. Thousands of hosts, some of them low-power devices such as printers, IP phones and sensors, can spend measurable CPU time handling frames meant for others. Wireless clients feel this more, because broadcasts are sent at low data rates.
A large blast radius for faults
A fault inside the domain affects everything in it:
- A Layer 2 loop with no working spanning tree causes a broadcast storm. Flooded frames circulate and multiply until links and switch CPUs saturate. In a flat network, one miscabled desktop switch can take down every user.
- A host with a failing NIC, or software that floods broadcasts, hurts every other host in the domain.
- A rogue DHCP server answers clients anywhere in the domain.
Security exposure
Anything on the same segment can see flooded traffic and can send frames directly to any other host at Layer 2. That makes ARP spoofing, rogue DHCP and MAC flooding possible between any two devices. A guest laptop and a database server sharing a domain have no network device between them that can enforce a policy. Dividing the network gives you a point, a router or firewall, where you can write rules about what may cross.
No place to apply policy
Access control lists, firewalls, quality-of-service markings and logging work at Layer 3 and above, at the boundary between domains. If everything sits in one domain, there is no boundary to attach policy to. Segmentation creates those boundaries.
How segmentation fixes this
Segmenting means splitting one large broadcast domain into several smaller ones and connecting them with a router or Layer 3 switch. Each domain gets its own IP subnet. Broadcasts stay inside their own domain. Traffic between domains is routed, so you can filter, log and rate-limit it.
The diagram contrasts the two designs.
There are two ways to build the segments:
| Approach | How it works | Drawback |
|---|---|---|
| Separate physical switches per segment | Each group of hosts plugs into its own switch, and each switch has an uplink to the router. | More hardware, more cabling and ports. Moving a user to another segment means recabling. |
| VLANs | One physical switch infrastructure is divided in software into several logical Layer 2 networks. | Needs configuration and careful design. A mistake can silently merge or isolate segments. |
VLANs give you the same separation as separate switches without separate hardware. The next chapter defines them. The rest of this tutorial covers how they are built and secured.
The one-subnet-per-domain rule
A broadcast domain and an IP subnet should map one to one. Consider why.
A host decides whether a destination is local by comparing it to its own address and mask. If the destination is inside its subnet, it ARPs for the destination directly and expects the answer on the same broadcast domain. If it is outside, the host sends the frame to its default gateway. So the subnet defines which hosts a device expects to reach at Layer 2. If the broadcast domain is larger or smaller than the subnet, ARP fails for some pairs of hosts.
Two cases show up in practice:
- Two subnets sharing one broadcast domain. This works only because hosts in different subnets reach each other through the router, and it wastes the isolation you wanted. Broadcasts from both subnets still reach everyone, and a host can bypass the router.
- One subnet split across two broadcast domains that are not bridged together. Hosts on the two sides cannot ARP for each other and cannot communicate, though their addresses look local.
A short Python check shows how subnet size bounds the number of hosts in one domain:
import ipaddress
for prefix in (24, 22, 20):
net = ipaddress.ip_network(f"10.0.0.0/{prefix}")
usable = net.num_addresses - 2 # minus network and broadcast addresses
print(f"/{prefix}: {usable} usable host addresses")This prints 254, 1022 and 4094 usable addresses. The mask limits the domain's size, but nothing stops you from filling it with devices. A /20 holding thousands of hosts is exactly the situation segmentation is meant to avoid.
Deciding where to draw the lines
There is no single correct size. These criteria are commonly used to choose segment boundaries:
- Function. Users, servers, printers, voice, cameras and management interfaces behave and need protection differently.
- Trust level. Guests, contractors and unmanaged devices go in their own segments, separated from internal systems.
- Traffic type. Voice and storage traffic benefit from their own segments, where you can apply QoS and limit unrelated broadcasts.
- Compliance scope. Systems that handle payment card or health data are easier to audit when they sit in a small, clearly bounded segment.
- Size. Many designs keep user segments to a few hundred hosts, often a /24. This is a convention, not a protocol limit.
Over-segmenting has costs too. Every extra segment is another subnet to plan, another gateway, more routing and firewall rules, and more places where a configuration can be wrong. Services that rely on broadcast discovery, such as printer discovery, stop working across segments unless you add a relay or a discovery proxy. DHCP is the standard example: broadcasts do not cross the router, so each segment needs either a local DHCP server or a relay agent on the gateway that forwards requests to a central server.
Common misconceptions
- "Segmentation is the same as security." Separation creates a place to enforce policy, but if the router allows all traffic between segments, nothing is protected. Later chapters show how VLAN configuration mistakes can also let traffic leak.
- "A bigger switch means a bigger problem." The problem is the size of the broadcast domain, not the number of ports. A large switch with many small VLANs is fine.
- "Routers never forward broadcasts." A router does not forward Layer 2 broadcasts. It can forward specific broadcast-based services such as DHCP when configured with a relay, and some devices can be set to forward directed broadcasts, which is usually disabled for security reasons.
- "IPv6 removes the issue." IPv6 replaces broadcast with multicast, but unfiltered multicast is still flooded within a domain.
Exercise
A company has 600 devices on one flat /22 network. Users complain of slowness, and a miscabled switch once took the whole office offline. Give two reasons segmentation helps, and say what is needed so devices in different segments can still communicate.
Show answer
Segmentation reduces the broadcast and multicast traffic each device must process, because ARP, DHCP and discovery frames stay inside a smaller domain. It also limits the blast radius of faults such as broadcast storms and rogue DHCP servers, so a problem in one segment does not affect the others. (Creating a policy enforcement point between segments is another valid reason.) For devices in different segments to communicate, a router or Layer 3 switch must route between the subnets, with each segment having its own subnet and a default gateway.
Exercise
A host at 10.1.1.10/24 has a gateway at 10.1.1.1. Another host, 10.1.1.20/24, sits on a switch that is not connected to the first host's broadcast domain. Why does the first host fail to reach it, even though the addresses are in the same subnet?
Show answer
The first host sees 10.1.1.20 as local, so it sends an ARP broadcast instead of using its gateway. The broadcast cannot cross to the other domain, so no ARP reply arrives, and the host never learns the destination MAC address. A subnet must map to exactly one broadcast domain.