Networks and the web
TCP/IP and Ports: How Services Listen on Your Machine
A port is a numbered door on your machine. Learn how TCP and UDP use ports, then start, find and test a local server on 127.0.0.1.
How DNS turns names into addresses: resolvers, authoritative servers, TTL caching, the A, AAAA, CNAME, MX and TXT records, and a safe lookup.
DNS (Domain Name System) maps names such as example.com to the data a client needs next, most often an IP address. Applications ask for a name, and DNS returns records. DNS is not a web server, a browser or an encryption layer. It answers lookup questions and nothing more.
When you type a name into a browser, the operating system or the browser checks its own cache first. If there is no usable answer, the client sends a query to a recursive resolver. That resolver is often run by your internet provider, your employer or a public service such as 8.8.8.8.
The resolver answers from its cache when it can. If it cannot, it walks the DNS hierarchy. It asks a root server which servers handle the top-level domain (such as .com), asks that server which nameservers the domain uses, and then asks one of those authoritative nameservers for the record. The authoritative server holds the real data. The resolver stores the answer for as long as the record's TTL allows, then returns it to the client.
Real traffic adds more steps: CNAME chains, DNSSEC validation, entries in a local hosts file, encrypted DNS transports and several cache layers. After DNS finishes, the browser still has to open a connection, negotiate TLS and wait for the server to respond.
| Record | What it holds | Beginner note |
|---|---|---|
A |
An IPv4 address for a name | One name can have several A records. The answer can change with load balancing, location or cache state. |
AAAA |
An IPv6 address for a name | Defined in RFC 3596. The name stays the same, and the address family changes. |
CNAME |
Another name that this name is an alias for | The resolver follows it. A name with a CNAME cannot also hold other data (DNSSEC records are the exception). |
MX |
Mail servers for the domain, with a preference value | Shows where mail should go. It says nothing about how well the mail servers are secured. |
TXT |
Free text, used for verification and policies such as SPF | It shows what the owner published. It does not prove every related control is configured or enforced. |
Use a domain you own or manage. If you only want practice, example.com is one of the names reserved for documentation (RFC 2606). Stick to names you are allowed to look up, and avoid scanning hosts you have no permission to test.
On Linux or macOS, with dig installed:
dig example.com A
dig example.com AAAA
dig example.com MXOn Windows, nslookup is included with the operating system:
nslookup example.com
nslookup -type=AAAA example.com
nslookup -type=MX example.comThe output below was captured on a Windows machine on 2026-11-08 with nslookup, using the machine's default resolver (dns.google, 8.8.8.8). The answer came from that resolver, not from the domain's authoritative server. The machine printed its labels in Portuguese. They are shown here in English. The values are a snapshot and will differ on your machine and on later runs.
Non-authoritative answer:
Server: dns.google
Address: 8.8.8.8
Name: example.com
Addresses: 2606:4700:10::ac42:93f3
2606:4700:10::6814:179a
172.66.147.243
104.20.23.154The same resolver returned an MX record for the domain:
example.com MX preference = 0, mail exchanger = (root)A mail exchanger of (root) means the target is a single dot. That is a null MX, which tells senders the domain accepts no mail (RFC 7505).
Finally, a TXT query for the same name:
Non-authoritative answer:
Server: dns.google
Address: 8.8.8.8
example.com text =
"_k2n1y4vw3qtb4skdx9e7dxt97qrmmq9"
example.com text =
"v=spf1 -all"The second string is an SPF policy. -all says no server is authorized to send mail for this domain, which fits the null MX above. The first string is an opaque value; strings like it are commonly used to prove ownership of a domain to a service. As the table says, a TXT record shows what the owner published and proves nothing more.
Two details from this run. The line Non-authoritative answer confirms the reply came from a resolver's cache or lookup, not from the domain's own server. And the IPv6 addresses came first, but the order is not something to depend on: a later run may list them differently or return different addresses.
To watch caching, use dig. It prints a TTL number before each record. Run the same query twice within the TTL window. If a resolver cached the answer, the second number will be lower than the first.
Every record carries a TTL, a time in seconds that tells resolvers how long they may keep the answer. A short TTL lets the owner move a service quickly, and it also means more queries reach the authoritative servers. A long TTL reduces load, and it means old answers can survive for a while after a change.
So one answer is a snapshot. Two resolvers can disagree during a change, and both can be correct for their own cache. When you need to know what the owner published, ask an authoritative nameserver directly, for example with dig example.com A @<nameserver> using a server listed in the domain's NS records, or follow the chain with dig +trace example.com A.
Looking up public DNS records for a domain is a normal first step in an asset inventory. A company can review its own names, its own mail records and the addresses behind them. Researchers often combine this data with certificate transparency logs and ownership information.
Two things do not follow from a DNS answer. First, a record in a search result is not permission to scan the host it points to. Second, an IP address does not identify who operates the machine. Hosting providers, CDNs and shared servers mean one address can serve many unrelated sites.
A suspicious record is also not proof of an attack. Misconfigurations, expired services and abandoned names are common. Check the authoritative answer, the change history and the domain owner before you draw a conclusion. Cache poisoning and spoofing are separate problems with separate evidence.
DNS is one step in a web request. Next, learn how HTTP and TLS handle what happens after the name becomes an address, using the RFCs and documentation listed in the sources. Then read the next article in this track, on OSINT, before you run any queries as part of reconnaissance. Keep your practice to domains and systems you own or have written permission to test.
Networks and the web
A port is a numbered door on your machine. Learn how TCP and UDP use ports, then start, find and test a local server on 127.0.0.1.
Networks and the web
Read a real HTTP exchange line by line: methods, URLs, headers, status code classes and cookies, tested with curl against a local server.
Networks and the web
TLS 1.3 gives HTTPS confidentiality, integrity and server authentication. Learn the handshake, certificate chains and what the padlock does not prove.