A basic network flow
When you visit a site, your machine resolves a name with DNS, chooses a route through a network interface, opens a connection to an IP address and port, exchanges packets, and hands data to an application.
Networking becomes manageable when you separate name resolution, local interface state, routing, remote reachability, listening services, firewall policy, and application behavior.
IP addresses, localhost, and DNS
An IP address identifies a network endpoint. IPv4 addresses look like 192.168.1.20; IPv6 addresses are longer, such as 2001:db8::1. localhost points back to your own machine, usually 127.0.0.1 for IPv4 and ::1 for IPv6.
DNS turns names such as example.com into IP addresses. If an IP ping works but a hostname fails, DNS is a strong suspect.
Interfaces and routes
A network interface is a point where the system connects to a network: Ethernet, Wi-Fi, loopback, VPN, bridge, or virtual container interface. Routes decide where packets go next.
ip addr shows addresses. ip route shows routing decisions. The default route is where traffic goes when no more specific route matches.
ip -brief addr
ip routePorts, TCP vs UDP, and sockets
A port identifies a service endpoint on a machine. SSH commonly listens on TCP port 22, HTTP on TCP port 80, and HTTPS on TCP port 443. A socket combines protocol, local address, local port, remote address, and remote port.
TCP is connection-oriented and handles ordered reliable delivery. UDP is datagram-oriented and is useful when applications manage timing, loss, or simplicity differently, such as DNS queries, voice/video, and some game traffic.
ss -tulpenping, curl, wget, and practical checks
ping tests ICMP reachability, not whether a website works. curl tests application-layer protocols such as HTTP. wget is convenient for downloads. ss tells you what your machine is listening on or connected to.
ping -c 4 1.1.1.1curl -I https://example.comwget https://example.com/file.tar.gzFirewall basics and troubleshooting flow
A firewall filters traffic by rules. On Linux, distributions may expose firewall management through ufw, firewalld, nftables, or cloud provider rules. A service can be running locally but unreachable because a firewall blocks the port.
Troubleshoot in order: confirm local interface address, confirm route, test DNS, test remote IP, test port, inspect local service, inspect firewall, then inspect application logs.
- 1Check your address with ip -brief addr.
- 2Check route with ip route.
- 3Test DNS by comparing ping 1.1.1.1 and ping example.com.
- 4Test the service with curl or ssh -v.
- 5Check listening sockets with ss -tlnp.
- 6Read service logs with journalctl -u service-name.