IP Addresses — IPv4, IPv6 and DNS
Every TCP connection and UDP datagram so far has quietly needed one thing: an address for the other end. The Manja Arena client knows only a name, mumbai.manja-arena.example. Getting from that name to a machine in Mumbai takes two ideas, IP addresses and DNS.
The rule
Names are for people, addresses are for routers; DNS translates between them.
An IP address identifies a network interface on the internet. Two versions are in use:
- IPv4 — 32 bits, written as four numbers from 0 to 255:
203.0.113.10. That allows about 4.3 billion addresses, which is not enough for every device on Earth. - IPv6 — 128 bits, written as eight groups of four hex digits separated by colons. Leading zeros in a group may be dropped, and one run of all-zero groups may be shortened to
::, so2001:0db8:0000:0000:0000:0000:0000:0007becomes2001:db8::7. The::may appear only once, or nobody could tell how many zeros each one hides.
DNS, the Domain Name System, turns names into addresses. The client asks about a name and gets back records: an A record holds an IPv4 address and an AAAA record holds an IPv6 address. Answers are cached for as long as each record says, so repeat lookups are almost instant.
Most homes have a single public IPv4 address shared by many devices. The home router performs NAT, network address translation: it rewrites each outgoing packet's private source address, such as 192.168.1.23, into its own public one, and it often changes the source port as well. The Mumbai server therefore sees the router's address and a port the router chose. If the router restarts, or forgets a mapping that sat idle, that port can change in the middle of a match.
The shortcut
To reach a server: name → DNS → addresses → try them in turn. To recognise a player: use a session token, never the address alone.
Resolve
The client asks DNS about
mumbai.manja-arena.exampleand gets an A record,203.0.113.10, and an AAAA record,2001:db8::7.
Drills
Answer fast — trust the rule.
How many bits are in an IPv4 address?
Which of these is a valid IPv6 address?
Which DNS record type holds an IPv6 address?
A player's laptop has the address 192.168.1.23 on their home network. Which address does the Mumbai server see?
Why does Manja Arena recognise players by a session token rather than by address and port alone?
Remember
- Names are for people, addresses are for routers; DNS translates between them.
- IPv4 is 32 bits in dotted decimal; IPv6 is 128 bits in hex, with at most one
::. - Trap: using address and port as a player's identity when NAT can change them.
