Computer Networking for Beginners series — Part 9. This post continues Part 1: A Complete Guide to How Networks Work, Part 2: What Is the OSI Model?, Part 3: Networking Devices Explained, Part 4: CDNs, VPNs, QoS, and TTL, Part 5: Cloud Networking Explained, Part 6: Internet Protocol Explained, Part 7: What Are the Well-Known Port Numbers?, and Part 8: Network Protocols for Troubleshooting, Tunneling, and Security. Each post in the series takes one topic and covers it in depth. This one covers the four ways network devices send data to each other: unicast, broadcast, multicast, and anycast.
Network communication comes in four types, depending on who the sender wants to reach: unicast sends to one specific device, broadcast sends to every device on the local network, multicast sends to a chosen group, and anycast sends to the nearest device in a group that shares one address.
So far in this series, you have followed data from one device to another: a web page, an email, a ping. In almost every example, one device was talking to one other device. But that is not the only way networks communicate. Sometimes a device needs to shout to everyone nearby, like a computer asking “who has this address?” Sometimes a video has to reach thousands of viewers at once. And sometimes the same address exists in many places, and the network has to pick the closest one. This post explains the four delivery methods, when each one is used, and how you can see them at work.
Four Ways to Deliver a Message
Think about how people communicate:
- Unicast is a phone call. You dial one specific person, and only that person answers.
- Broadcast is a loudspeaker announcement in a building. Everyone who is in range hears it, whether they want to or not.
- Multicast is a group chat or a mailing list. Only the people who joined the group get the message.
- Anycast is calling a company’s support number: many call centers share the same number, and the phone network connects you to the nearest one.
Networks do all four. The difference is in the destination address of each packet and in how many devices receive it.
Unicast: One to One
Unicast is communication between one sender and one specific receiver. It is by far the most common type. When you load a web page, check your email, connect over SSH, or stream a video on demand, you are using unicast.
Each device has a unique address (an IP address at the network layer and a MAC address on the local link, as you saw in Part 1). The sender puts the receiver’s address in the packet, and the network delivers it to exactly that device.
Your laptop ──────────────► Web server
192.168.1.20 203.0.113.10
Unicast works with both TCP and UDP (see Part 6), so it supports connections, reliable delivery, and sessions. That is why almost every application you use is built on it.
Its weakness appears when many receivers want the same data. If a company streams a live video to 1,000 viewers with unicast, the sender has to send 1,000 separate copies of the stream. The load grows with every viewer, which is the problem multicast and CDNs were designed to solve.
Broadcast: One to Everyone on the Local Network
Broadcast sends one message to every device on the same local network segment, called a broadcast domain. Every device that receives it has to look at it, even if it does not care.
Broadcasts use special addresses:
| Level | Broadcast address | Meaning |
|---|---|---|
| Data link (Layer 2) | FF:FF:FF:FF:FF:FF | A frame for every device on the local network |
| IPv4, limited broadcast | 255.255.255.255 | Everyone on my local network |
| IPv4, directed broadcast | The last address of a subnet, such as 192.168.1.255 on 192.168.1.0/24 | Everyone on that specific subnet |
Where You See Broadcasts
- ARP (Address Resolution Protocol). To send a packet to
192.168.1.1, your computer needs that device’s MAC address. It broadcasts a question to the whole network: “Who has 192.168.1.1? Tell 192.168.1.20.” Only the owner answers, and the answer is sent back as a unicast. - DHCP. A device that just joined the network has no IP address yet, so it broadcasts a “DHCP Discover” message to
255.255.255.255to find a DHCP server (UDP ports 67 and 68; see Part 7).
Broadcast Domains and Devices
How far a broadcast travels depends on the devices from Part 3:
- A switch floods broadcasts out of all its ports, so every device in the same network (or VLAN) hears them.
- A router does not forward broadcasts by default. Each router interface is the edge of a broadcast domain.
That is why a very large flat network gets noisy. More devices means more broadcasts reaching everyone. Splitting a network into subnets or VLANs keeps each broadcast domain small.
Risks of Broadcasts
- Broadcast storms. If a network has a loop (for example, two switches connected with two cables) and no loop protection such as Spanning Tree Protocol, a broadcast can circulate forever and multiply until it overwhelms the network.
- Amplification attacks. In the past, attackers abused directed broadcasts by sending a spoofed request to a whole subnet, so every device replied to the victim. For this reason, routers today usually do not forward directed broadcasts.
IPv6 has no broadcast. It uses multicast for the jobs that IPv4 does with broadcasts, such as finding neighbors on the local network.
Multicast: One to a Group
Multicast sends one message to a group of devices that have asked to receive it. Devices that did not join the group ignore the traffic.
The sender transmits one copy of the data. The network copies it only where the path to different receivers splits, so the sender’s load stays the same whether there are 5 receivers or 5,000. This is what makes multicast efficient for live video, financial price feeds, and software distribution inside a company.
Multicast Addresses
IPv4 reserves the range 224.0.0.0 to 239.255.255.255 (224.0.0.0/4) for multicast. Some well-known addresses:
| Address | Used for |
|---|---|
224.0.0.1 | All hosts on the local network |
224.0.0.2 | All routers on the local network |
224.0.0.5 and 224.0.0.6 | OSPF routing protocol messages |
224.0.0.251 | mDNS (the “Bonjour” local name discovery) |
239.0.0.0/8 | Private multicast inside an organization |
In IPv6, multicast addresses start with ff, for example ff02::1 (all devices on the link) and ff02::2 (all routers).
On the local link, an IPv4 multicast address is mapped to a special MAC address that starts with 01:00:5E, so network cards and switches can recognize multicast frames.
How Devices Join a Group
Multicast needs a way to know who wants what:
- IGMP (Internet Group Management Protocol) lets a device tell its local router “I want to receive group 239.1.1.1.” IPv6 uses MLD for the same job.
- IGMP snooping lets a switch listen to these requests and send multicast traffic only to the ports that need it, instead of flooding it everywhere like a broadcast.
- Multicast routing protocols such as PIM move multicast traffic between networks.
Multicast uses UDP. TCP is a connection between two endpoints, so it cannot work with a group of receivers.
Where You See Multicast
- Routing protocols such as OSPF talking to neighboring routers
- Local service discovery (mDNS), used by printers, speakers, and smart TVs
- IPTV and live video inside a managed network
- Stock market data feeds
- Software and image distribution to many computers at once
Multicast is common inside organizations and service-provider networks, but it is generally not available across the public internet. That is why internet video services use CDNs (see Part 4) and unicast instead.
Anycast: One to the Nearest
Anycast is different from the other three. Many servers in different places share the same IP address, and the network delivers each packet to the nearest one.
Routers learn about the address from several locations, usually through the BGP routing protocol, and each router sends traffic along the best path. A user in Tokyo ends up at a server in Asia, and a user in Paris reaches a server in Europe, both by sending packets to the same address.
┌──► Server in Europe (203.0.113.53)
Users ────────┼──► Server in Asia (203.0.113.53)
└──► Server in America (203.0.113.53)
Each user reaches the nearest one
Why Use Anycast
- Speed. Users reach a nearby server, so responses are quicker.
- Resilience. If one location fails, routing sends users to the next nearest one.
- DDoS protection. An attack aimed at one address is spread across many locations instead of hitting a single server.
Where You See Anycast
- DNS. The root DNS servers and public resolvers such as
1.1.1.1and8.8.8.8use anycast. See what a domain name is. - CDNs and security providers, including Cloudflare, which use anycast to serve websites from a nearby location.
Things to Know About Anycast
- “Nearest” means the best path according to routing, which is not always the closest in physical distance.
- It is a deployment technique, not a separate kind of packet. In IPv4, an anycast address looks like any other unicast address. IPv6 defines a formal anycast address type.
- It works best for short, independent exchanges such as DNS queries. If routing changes in the middle of a long TCP connection, the packets may reach a different server, which can break that session, so operators design for that.
The Four Types Side by Side
| Unicast | Broadcast | Multicast | Anycast | |
|---|---|---|---|---|
| Sender to receivers | One to one | One to all on the local network | One to a chosen group | One to the nearest of a group |
| Destination address | A specific host address | 255.255.255.255, subnet broadcast, or FF:FF:FF:FF:FF:FF | 224.0.0.0/4 (IPv4), ff00::/8 (IPv6) | An address shared by several servers |
| Crosses routers? | Yes | No (by default) | Only with multicast routing | Yes, like normal traffic |
| Transport | TCP or UDP | UDP (or Layer 2, such as ARP) | UDP | TCP or UDP |
| Typical examples | Web, email, SSH | ARP, DHCP Discover | OSPF, mDNS, IPTV | DNS, CDN, DDoS protection |
| IPv6 support | Yes | No | Yes | Yes |
See Them in Action
Look at Your Own Network
On Windows, arp -a shows what your computer has learned about the local network, including broadcast and multicast entries. A trimmed example:
Interface: 192.168.1.20 --- 0x7
Internet Address Physical Address Type
192.168.1.1 aa-bb-cc-dd-ee-01 dynamic
192.168.1.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
255.255.255.255 ff-ff-ff-ff-ff-ff static
The addresses above are examples, and your output will differ. Notice the all-ff physical address for the broadcast entries and the 01-00-5e prefix for multicast. To see which multicast groups your computer has joined:
# Windows
netsh interface ip show joins
# Linux
ip maddr show
Most computers have joined at least 224.0.0.1, the all-hosts group.
Capture It with Wireshark
If you set up Wireshark in Part 2, try these display filters while you browse or connect a device:
| Filter | Shows |
|---|---|
eth.dst == ff:ff:ff:ff:ff:ff | Broadcast frames |
arp | ARP requests (broadcast) and replies (unicast) |
ip.dst == 224.0.0.0/4 | IPv4 multicast traffic |
igmp | Group membership messages |
dhcp | DHCP, including the broadcast Discover |
Watch an Anycast Address
Run a trace to a public anycast address, such as Cloudflare’s 1.1.1.1:
# Windows
tracert 1.1.1.1
# Linux and macOS
traceroute 1.1.1.1
The route stops at a server near you. Someone in another country running the same command reaches a different physical machine behind the same address. Use ping and traceroute as you learned in Part 8.
Try the Three Local Types in Python
This script sends one message of each kind on your own computer, so you can see who receives what. It uses only Python’s standard library:
import socket
import struct
import threading
import time
PORT = 50007
results = {}
def receiver(name, sock):
sock.settimeout(3)
try:
data, _ = sock.recvfrom(1024)
results[name] = [data.decode()]
except socket.timeout:
results[name] = []
# Unicast: one sender, one specific receiver
u = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
u.bind(("127.0.0.1", PORT))
t = threading.Thread(target=receiver, args=("unicast", u))
t.start()
time.sleep(0.2)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(b"hello, just you", ("127.0.0.1", PORT))
t.join()
u.close()
s.close()
# Broadcast: one sender, every listener on the local network
b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
b.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
b.bind(("", PORT + 1))
t = threading.Thread(target=receiver, args=("broadcast", b))
t.start()
time.sleep(0.2)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto(b"hello, everyone", ("255.255.255.255", PORT + 1))
t.join()
b.close()
s.close()
# Multicast: one sender, only the members of the group
GROUP = "224.1.1.1"
sockets, threads = [], []
for n in (1, 2): # two devices that join the group
m = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
m.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
m.bind(("", PORT + 2))
request = struct.pack("4s4s", socket.inet_aton(GROUP), socket.inet_aton("0.0.0.0"))
m.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, request)
th = threading.Thread(target=receiver, args=("member%d" % n, m))
th.start()
sockets.append(m)
threads.append(th)
nm = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # never joins the group
nm.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
nm.bind(("127.0.0.1", PORT + 2))
tn = threading.Thread(target=receiver, args=("non_member", nm))
tn.start()
time.sleep(0.3)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 1)
s.sendto(b"hello, group", (GROUP, PORT + 2))
for th in threads + [tn]:
th.join()
for sock in sockets + [nm, s]:
sock.close()
for name, messages in results.items():
print(name, messages)
unicast ['hello, just you']
broadcast ['hello, everyone']
member1 ['hello, group']
member2 ['hello, group']
non_member []
The unicast message reached only its one receiver. The broadcast reached every listener. The multicast message reached the two members that joined the group, but not the listener that did not. Anycast is not shown here because it depends on routing across many networks, not on a program.
A note: this was tested on a single Windows computer. Firewalls, VPNs, or unusual network settings can block broadcast and multicast traffic, so if a message does not arrive, check those first. Anycast cannot be shown in a local script for the same reason.
Common Misunderstandings
- “Broadcast works across the internet.” It does not. Routers stop broadcasts, so they stay inside one local network.
- “Multicast is the same as broadcast.” Broadcast reaches everyone on the network. Multicast reaches only devices that joined the group.
- “Anycast is a faster kind of packet.” It is a way of announcing one address from several places. Routing does the work.
- “IPv6 has broadcast too.” It does not. IPv6 replaced broadcast with multicast.
- “Streaming services use multicast over the internet.” Generally they use unicast with CDNs, because multicast is not routed across the public internet.
Quick Summary
- Unicast: one sender, one receiver. The most common type.
- Broadcast: one sender, everyone on the local network. Used by ARP and DHCP. Not forwarded by routers, and not in IPv6.
- Multicast: one sender, a group that joined. Efficient for many receivers. Managed with IGMP (IPv4) and MLD (IPv6).
- Anycast: many servers share one address, and routing picks the nearest. Used by DNS, CDNs, and DDoS protection.
What’s Next in This Series
You now know the four ways data can be addressed on a network. Upcoming posts in the Computer Networking for Beginners series will keep building on these foundations. To practice, look at your own arp -a output and see if you can find the broadcast and multicast entries, then trace a route to 1.1.1.1 and see where it ends.
Conclusion
Every packet has a destination, and what kind of destination it is changes how the network treats it. Unicast talks to one device, broadcast talks to everyone nearby, multicast talks to a group that asked to listen, and anycast talks to whichever copy of a service is closest. Knowing the difference helps you read network captures, understand why ARP and DHCP work the way they do, and see how DNS and CDNs serve the whole world quickly.
Computer Networking for Beginners series: Part 1: A Complete Guide to How Networks Work · Part 2: What Is the OSI Model? · Part 3: Networking Devices Explained · Part 4: CDNs, VPNs, QoS, and TTL · Part 5: Cloud Networking Explained · Part 6: Internet Protocol Explained · Part 7: Well-Known Port Numbers · Part 8: Protocols for Troubleshooting, Tunneling, and Security · Part 9: Network Communication
