Networking fundamentals
Goal
Explain how a request reaches a service. Identify addresses, routes, and DNS results on your VM.
Concepts
| Layer | Purpose | Examples and checks |
|---|---|---|
| 1: Physical | Carries signals | Cable, fiber, radio, link state |
| 2: Data link | Moves frames within a local network | Ethernet, MAC addresses, switches, VLANs |
| 3: Network | Moves packets between IP networks | IPv4, IPv6, ICMP, routing |
| 4: Transport | Identifies application endpoints and transports data | TCP, UDP, ports |
A switch forwards Ethernet frames using MAC addresses. A router forwards IP packets between networks using routes.
A VLAN separates a layer-2 broadcast domain. An access port normally carries one VLAN for an endpoint; a trunk carries multiple tagged VLANs.
An IPv4 address with /24 has a 24-bit network prefix. For 192.168.50.10/24, the network is 192.168.50.0/24.
For that example, ordinary host addresses range from .1 to .254; .255 is the broadcast address. Do not apply that rule to every prefix length.
The default route handles destinations without a more specific matching route. Local-subnet traffic normally does not need the default gateway.
ARP resolves IPv4 neighbor addresses to MAC addresses on a local link. IPv6 uses Neighbor Discovery. Inspect cached neighbors with ip neigh.
TCP provides an ordered byte stream with retransmission. Its connection handshake is SYN, SYN-ACK, ACK. UDP carries datagrams without built-in delivery or ordering guarantees.
DNS resolves names and other records. DHCP can supply an address, prefix, router, and DNS settings. DNS and DHCP are application-layer protocols, not layer 4.
Common defaults: SSH uses TCP 22, HTTP TCP 80, and HTTPS TCP 443. HTTP/3 uses QUIC over UDP, commonly port 443. DNS uses UDP and TCP 53.
Ports to remember
Learn the service, transport, and purpose together. These are common defaults, not guarantees about a particular server.
| Port | Common transport | Service and purpose |
|---|---|---|
| 22 | TCP | SSH remote access; SFTP also uses SSH |
| 53 | UDP and TCP | DNS name resolution |
| 67 / 68 | UDP | DHCPv4 server / client |
| 80 | TCP | HTTP |
| 443 | TCP; UDP for HTTP/3 | HTTPS |
| 123 | UDP | NTP time synchronization |
| 161 / 162 | UDP | SNMP monitoring / notifications |
| 445 | TCP | SMB file sharing |
| 3389 | TCP and UDP | RDP remote desktop |
Recognize TCP 179 for BGP and port 554 for RTSP streaming control. RTSP control and media transport are separate concepts.
Ping uses ICMP, not a TCP or UDP port. A client normally uses a temporary source port when connecting to a server's listening port.
For example, PC:52314 -> VM:80 identifies two endpoints. Port 52314 is illustrative; the actual client port varies.
Reference: IANA service and port registry.
Worked inspection
ip -br addr
ip route
ip neigh
cat /etc/resolv.conf
dig example.com
curl -I --connect-timeout 3 --max-time 10 https://example.com
Interface names and addresses vary. lo is loopback. 127.0.0.1 refers to the machine running the command.
In ip route, find default via, its gateway, and its interface. Also find the directly connected subnet.
In dig output, inspect the status, ANSWER section, and SERVER line. SERVER identifies the resolver contacted, which may be a local stub.
If /etc/resolv.conf points to a local stub, it may not reveal upstream DNS servers. If systemd-resolved is active, inspect resolvectl status.
Do not assume every Debian installation uses systemd-resolved. Ask your mentor which component manages this VM's DNS configuration.
Curl's -I requests response headers using HEAD. A response shows that this request reached an HTTP-speaking endpoint. It does not prove every application feature works.
Ping tests ICMP echo responses and round-trip time. A failed ping alone does not prove the host is down.
Independent exercise
Record your address and prefix, connected subnet, default gateway, and contacted DNS resolver. Request the lab server by IP.
Draw the path from client to server. Explain whether their traffic needs a router. Explain which extra step a hostname requires.
Explain aloud
- What is the difference between a MAC address, IP address, and port?
- Why can DNS work while HTTP fails?
- What does a default route do?
- How are TCP and UDP different?
Completion check
Identify actual values in your VM's output. Explain one request from name resolution through connection and HTTP response.