What a network is, starting with two computers in one room
What a network is, starting with two computers in one room
Field note. Two computers in a room is the simplest model. Your game server is a slightly bigger version of that: your machine and your players' machines all having a conversation. Most hosting problems are network problems, and they're rarely the part you can see.
Before there was an internet, there were networks. Before there were networks, there were two computers in a lab connected by a wire.
That's literally where it started. And it's the right place for us to start too, because every concept in the internet (which has billions of computers) is a recombination of the concepts that worked when there were just two.
The two-computer problem
You have two computers. You want them to share data. What do you need?
- A physical connection. A wire, a radio signal, something that lets bits travel from one to the other.
- An agreement on what the bits mean. Otherwise one sends voltages and the other doesn't know what they're for.
- A way to address each other. Even with two computers, each needs a name or number so they know "this message is for me."
- A way to handle errors. Wires have static. Bits flip. Messages need a way to be checked or resent.
That's it. Those four needs explain almost everything in networking. The internet is just these four problems solved at colossal scale.
Step one: the physical layer
Two computers connected by a single wire. The wire carries electrical signals: high voltage means a one, low voltage means a zero. The sender produces a pattern of high and low; the receiver reads it.
This is the physical layer. In modern terms it's an ethernet cable, a Wi-Fi radio, or a fiber optic strand. The physics differ, but the job is the same: get bits from here to there.
Physical-layer details rarely matter to ordinary users. You plug in the cable. The bits move. If it works, you ignore it. If it doesn't, you replace the cable.
Step two: agreeing on what the bits mean
Two computers can't just emit bits and hope. They need a shared protocol: a precise rulebook saying "the first 6 bytes are the destination address, the next 6 are the source, the next 2 say what kind of message this is, then the actual data, then a 4-byte checksum at the end."
For ethernet (the most common wire-based protocol in the world), that's roughly what happens. The protocol is called Ethernet, and the structured chunks of bits it sends are called frames.
If both computers agree on the protocol, they can talk. If they don't, the receiver gets nonsense.
Step three: addresses
With two computers on one wire, you might think addresses are unnecessary. But even two computers benefit from them, because:
- Sometimes message A is for one program on the receiver, and message B is for a different program. We'll get to ports later, which solve that.
- More importantly: if you add a third computer to the wire, you suddenly need to say which one you're talking to.
Ethernet gives each network card a unique 48-bit MAC address, burned into the hardware. Something like 00:1A:2B:3C:4D:5E. When you send a frame, you put the destination MAC in the header. Every computer on the wire sees the frame, but only the one with the matching MAC pays attention.
This works for a small wire-shared "local network." It does not scale to the entire internet. We need another addressing scheme on top of MAC addresses for that, and that's where IP addresses come in. Next article.
Step four: handling errors
Wires are imperfect. Cosmic rays flip bits. Connectors corrode. Wi-Fi suffers interference. Some percentage of frames arrive corrupted or not at all.
Every networking protocol has some answer to this:
- Checksums: a small number computed from the data so the receiver can verify nothing got mangled. If the checksum doesn't match, discard the frame.
- Acknowledgments: the receiver tells the sender "I got it." If the sender doesn't hear back, it resends.
- Sequence numbers: when sending many messages, number them so the receiver knows what arrived in what order, and can detect what's missing.
Ethernet itself doesn't bother with acknowledgments. It just checksums and drops bad frames. Higher-level protocols (like TCP, which we'll get to) handle the retransmission. The division of labor is intentional: each layer does one job.
What "a network" really is
So: a network is a set of computers that share a way to send bits, agree on how to interpret them, can address each other, and have some answer to errors.
Two computers on one cable: that's a network.
Five computers sharing a Wi-Fi router: that's a network.
A million computers connected through dozens of internet providers across continents: also a network. Or more accurately, a network of networks. Which is the etymology of "internet."
The layered model
The deep idea in networking: each layer should do one thing and not care what the others do.
If you understand this layering, the rest of networking is comprehensible. If you don't, things look mysterious because the magic seems to happen all at once.
The key insight: when your game client sends a position update to the server, the actual journey involves all five layers, each ignorant of what the others are doing. Your game says "send this position to the server's IP." The OS wraps that in a TCP segment with a port. The IP layer wraps that in a packet with addresses. The link layer wraps that in an Ethernet frame with MACs. The physical layer turns it into electrical signals. The signals travel a wire to your router, which strips off the Ethernet layer, reads the IP layer, decides where to send it next, and re-wraps it for the next link.
This unwrap-and-rewrap happens at every hop. By the time your packet reaches the server, it's been re-framed dozens of times, but the IP, TCP, and application layers above stayed intact end-to-end.
The hop concept
When two computers share a wire, communication is direct: bits travel from one to the other without an intermediary.
When more computers are involved, or when computers in different rooms need to talk, you need an intermediary device. The standard ones:
- Switch: connects computers in the same local network. Receives a frame on one port, sends it to the port the destination is on. Smart enough to learn which MAC is on which port.
- Router: connects different networks. Has a foot in two or more networks. Receives a packet on one side, forwards it to the appropriate next network.
A switch and a router look similar in your home (often combined in one box), but they do different jobs. Switches glue one network together. Routers connect different networks to each other. The internet is a giant chain of routers handing packets between networks.
Each step a packet takes through a router is called a hop. A packet from your computer to a server across the country might take 15 to 25 hops, each adding a tiny bit of latency.
Where we go from here
The next 14 articles in this series build up on this foundation. We'll cover what IP addresses look like, how DNS turns names into addresses, what TCP and UDP actually do, how routers find paths across the world, and what HTTPS adds on top.
Every concept we'll cover is a refinement of one of the four needs we listed at the top: physical transport, shared protocol, addressing, error handling. Modern networking is millions of engineer-years of work spent making those four ideas reliable, fast, and global.
Once you have the model, the internet stops feeling like magic. It starts looking like a remarkable but understandable machine.
Hosting your game server with AndroHost means we handle most of what's in this post for you automatically: tier sizing, SRV records, off-site backups, DDoS protection.
Keep reading
Why your server's IP being public is fine, and when it isn't
A game server has an IP address. Players connect to it. The IP is, by definition, reachable from the internet. Many server owners feel uneasy about their IP being known, often because they don't know what risk it actually represents.
What a DDoS actually looks like to a Minecraft server, and what protection means
"DDoS protection" is on every hosting marketing page. Most people who pay for it don't know what it does, how attacks actually work, or what level of protection is enough. This article explains, in honest terms, what to expect.
Why "ping to server" can lie, and how to measure properly
The number next to a server in your game's server list (the "ping" or latency display) is convenient. It's also frequently misleading. This article explains what it actually measures, when it's wrong, and how to get a real number.