Understanding networking is one of the most important skills for a DevOps Engineer, Site Reliability Engineer (SRE), Cloud Engineer, or System Administrator.
We often work with Kubernetes, Docker, AWS, Load Balancers, Ingress Controllers, and CI/CD pipelines. But behind all these technologies is a fundamental process: communication between computers.
Before learning how to troubleshoot a production environment, we need to understand what actually happens when one computer sends information to another computer.
In this article, we will start from the very beginning. Even if you have no technical background, you should be able to understand how network communication works.
1. How Does a Computer Know How to Communicate?
Imagine that you buy a new computer and install an operating system such as Linux, Windows, or macOS.
How does this computer already know how to communicate with other computers?
The answer is that modern operating systems already implement networking protocols.
Inside the operating system, there is a component called the Kernel.
The Kernel is the core of the operating system. It manages communication between software and hardware.
The Kernel is responsible for managing:
- CPU
- Memory
- Processes
- File systems
- Hardware devices
- Network communication
- System resources
Inside the Kernel, there is a networking subsystem commonly called the TCP/IP Network Stack.
This subsystem provides the computer with the ability to communicate using networking protocols.
However, having the ability to establish a connection does not mean a connection is already established.
TCP connections are created when applications need them.
2. What Is Inside a Computer?
Let's divide a computer into three major areas:
- User Space
- Kernel Space
- Hardware
+----------------------------------------+
| COMPUTER |
| |
| +----------------------------------+ |
| | USER SPACE | |
| | | |
| | Browser, NGINX, Python, Java | |
| | Node.js, Applications | |
| | HTTP, TLS, DNS Client | |
| +----------------------------------+ |
| | |
| System Calls |
| | |
| +----------------------------------+ |
| | KERNEL SPACE | |
| | | |
| | Socket Interface | |
| | TCP / UDP | |
| | IP / Routing Table | |
| | ARP / Neighbor Table | |
| | Network Device Drivers | |
| +----------------------------------+ |
| | |
| +----------------------------------+ |
| | HARDWARE | |
| | | |
| | CPU, RAM, Disk, NIC | |
| +----------------------------------+ |
+----------------------------------------+
|
Network
User Space
User Space is where regular applications run.
Examples include:
- Google Chrome
- NGINX
- Apache
- Python applications
- Java applications
- Node.js applications
- PostgreSQL
- Redis
An application understands what information it wants to send or receive.
For example, a browser wants to request a web page from a web server.
However, most applications do not directly control the physical network card. They communicate with the operating system using a socket interface.
Kernel Space
Kernel Space is where the core operating system operates.
In a traditional Linux networking architecture, the Kernel manages TCP, UDP, IP routing, network interfaces, packet processing, and network drivers.
When an application needs to establish a TCP connection, it can use system calls such as:
socket()
connect()
The Kernel performs the underlying networking operations.
Hardware
Hardware includes the physical components of the computer.
For networking, one of the most important components is the Network Interface Card, also known as NIC.
3. What Are the Seven Layers of the OSI Model?
The OSI Model is a conceptual framework that helps us understand how network communication works.
The seven layers are not seven separate programs installed inside the Kernel.
Instead, they describe different responsibilities in network communication.
| Layer | Name | Examples and responsibilities |
|---|---|---|
| Layer 7 | Application | HTTP, DNS, SSH |
| Layer 6 | Presentation | Encoding, encryption, data representation |
| Layer 5 | Session | Managing communication sessions |
| Layer 4 | Transport | TCP, UDP, ports |
| Layer 3 | Network | IP addresses, routing |
| Layer 2 | Data Link | Ethernet, MAC addresses, frames |
| Layer 1 | Physical | Electrical signals, light, radio waves |
Where Are These Layers Located Inside a Computer?
USER SPACE
--------------------------------
Layer 7 - Application
Layer 6 - Presentation
Layer 5 - Session
--------------------------------
System Calls
--------------------------------
KERNEL SPACE
--------------------------------
Layer 4 - TCP / UDP
Layer 3 - IP / Routing
Layer 2 - Ethernet processing
Network Drivers
--------------------------------
HARDWARE
--------------------------------
Layer 2 - NIC frame processing
Layer 1 - Physical signals
--------------------------------
This is a simplified representation of a traditional Linux networking architecture.
Real implementations do not always follow these boundaries exactly. Some networking operations can be performed in hardware or User Space.
For example, HTTP/3 uses QUIC over UDP, with QUIC commonly implemented in User Space.
The OSI model helps us understand responsibilities rather than exact software implementation boundaries.
4. What Is a Network Interface Card (NIC)?
NIC stands for Network Interface Card.
A NIC allows a computer to send and receive information through a network.
A computer can have multiple network interfaces:
- Ethernet interface
- Wi-Fi interface
- Virtual network interface
- Loopback interface
A physical network interface communicates through a physical medium, while virtual interfaces operate through software.
Examples of physical transmission include:
| Connection type | How information travels |
|---|---|
| Ethernet copper cable | Electrical signals |
| Fiber optic cable | Light signals |
| Wi-Fi | Radio waves |
The information is represented as digital data and transmitted using signals.
The receiving device converts those signals back into digital information.
Does the NIC Establish TCP Connections?
Normally, no.
The NIC sends and receives network traffic, while the operating system's networking subsystem manages TCP connections.
A single NIC can carry traffic belonging to thousands of TCP connections.
Some modern network cards support hardware offloading, but the traditional model is that the Kernel maintains TCP connection state.
Think about it this way:
The NIC is the door through which information enters and leaves the computer. The Kernel manages the communication passing through that door.
5. What Is a MAC Address?
MAC stands for Media Access Control.
A MAC address is an identifier associated with a network interface at the data link layer.
Example:
00:1A:2B:3C:4D:5E
Physical network interfaces commonly have a manufacturer-assigned MAC address. Operating systems can also configure or randomize MAC addresses.
A MAC address is used for communication within a local data link network.
When information travels through an Ethernet network, an Ethernet frame contains a source MAC address and a destination MAC address.
A common misunderstanding is that a switch gives computers their MAC addresses.
A switch does not normally assign MAC addresses.
Instead, it learns MAC addresses from network traffic.
6. What Is an IP Address?
IP stands for Internet Protocol.
An IP address identifies a network interface for communication at the IP layer.
Example:
192.168.1.10
While MAC addresses are used for communication within a local link, IP addresses allow traffic to be routed between different networks.
Consider the following analogy:
- IP address: the destination address for delivery.
- MAC address: the local delivery recipient on the current part of the journey.
- Router: the distribution center that forwards the delivery toward its destination.
- NIC: the entrance and exit through which the delivery passes.
MAC Address vs. IP Address
| MAC Address | IP Address |
|---|---|
| Layer 2 | Layer 3 |
| Used within a local link | Used for communication across networks |
| Used when forwarding Ethernet frames | Used when routing IP packets |
| Associated with a network interface | Configured on a network interface |
| Can change or be randomized | Can change through DHCP or manual configuration |
MAC addresses are generally replaced as traffic passes through routers onto new Ethernet links.
IP addresses generally identify the original network endpoints, although NAT can translate them.
7. What Is DHCP?
When you connect your laptop to your home Wi-Fi, you normally do not manually configure an IP address.
How does your computer receive its network configuration?
Through DHCP.
DHCP stands for Dynamic Host Configuration Protocol.
A DHCP server can provide the computer with information such as:
- IP address
- Subnet mask
- Default gateway
- DNS servers
- Lease duration
Example:
IP Address: 192.168.1.10
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
DNS Server: 192.168.1.1
In a typical home network, the router also operates as a DHCP server.
In enterprise environments, DHCP may run on dedicated infrastructure.
MAC addresses and IP addresses are different. DHCP normally provides IP configuration, not the physical NIC's manufacturer-assigned MAC address.
8. Understanding Switches, Routers, Gateways, and Modems
These devices are essential to understanding how traffic travels between computers.
A typical home network looks like this:
Laptop / Computer
|
Wi-Fi / Cable
|
Switch / Wi-Fi Access Point
|
Router
(Default Gateway)
|
Modem / ONT
|
ISP
|
Internet
|
Remote Server
8.1. What Is a Switch?
A switch connects devices inside a local network.
For example, imagine three computers connected to the same switch.
Computer A Computer B Computer C
| | |
+----------------+----------------+
|
Switch
The switch learns source MAC addresses from incoming Ethernet frames and associates them with its ports.
It maintains a MAC address table.
Example:
| MAC Address | Switch Port |
|---|---|
| AA:AA:AA:AA:AA:01 | Port 1 |
| AA:AA:AA:AA:AA:02 | Port 2 |
| AA:AA:AA:AA:AA:03 | Port 3 |
When Computer A sends an Ethernet frame to Computer B, the switch uses its MAC address table to determine the appropriate outgoing port.
If the destination MAC address is unknown, the switch may flood the frame within the relevant local network.
A traditional Layer 2 switch forwards Ethernet frames.
8.2. What Is a Router?
A router connects different IP networks.
Imagine these two networks:
Network A Network B
192.168.1.0/24 192.168.2.0/24
Computer A Computer B
192.168.1.10 192.168.2.20
| |
+------- Router ------+
The computers belong to different IP networks.
A router allows traffic to move between them by examining destination IP addresses and consulting its routing table.
A router may connect:
- A home network to the internet
- Different office networks
- Data center networks
- Cloud networks
- Different subnets
A router does not necessarily provide internet access. It can also route traffic between private networks.
8.3. What Is a Default Gateway?
A default gateway is the next-hop router that a computer uses when there is no more specific route to a destination.
For example:
Computer IP: 192.168.1.10
Default Gateway: 192.168.1.1
If the computer needs to communicate with a destination outside its local network, the operating system may send the packet through its default gateway.
The default gateway is a role performed by a router, not necessarily a separate physical device.
8.4. What Is a Wi-Fi Access Point?
A Wi-Fi Access Point connects wireless devices to a network.
It allows laptops, smartphones, and other wireless devices to communicate using radio signals.
An access point can bridge wireless traffic into a wired local network.
A standalone access point does not necessarily perform routing.
8.5. What Is a Modem?
A modem provides connectivity using an access technology supported by an internet service provider.
For fiber connections, a device called an Optical Network Terminal (ONT) is commonly used instead.
A modem and a router perform different responsibilities.
In many homes, the following components are combined into one physical device:
- Router
- Ethernet switch
- Wi-Fi access point
- Modem
- DHCP server
- NAT
- Firewall
This is why people often use the terms router and modem interchangeably, even though they are not the same thing.
8.6. What Is an ISP?
ISP stands for Internet Service Provider.
The ISP connects your home or business network to wider networks and the internet.
The internet itself is a massive collection of interconnected networks.
There is no single router controlling the entire internet.
9. What Is a Routing Table?
A routing table tells the operating system where to send IP packets.
Every standard Linux computer with IP networking has routing information.
Example:
Destination Next Hop Interface
192.168.1.0/24 Direct eth0
0.0.0.0/0 192.168.1.1 eth0
The first route tells the computer that devices in the local network can be reached directly.
The second route is the default route.
If no more specific route matches the destination, traffic is forwarded to the default gateway.
On Linux, we can inspect the routing table:
ip route
We can also ask which route the Kernel would use for a particular destination:
ip route get 8.8.8.8
This is extremely useful for troubleshooting connectivity problems.
10. What Is ARP?
ARP stands for Address Resolution Protocol.
In an IPv4 Ethernet network, ARP helps a computer discover the MAC address associated with a neighboring IP address.
Imagine that your computer knows the following information:
Computer IP: 192.168.1.10
Router IP: 192.168.1.1
The computer knows the router's IP address but does not yet know its MAC address.
To send an Ethernet frame, it needs the destination MAC address.
The computer sends an ARP request to the local network.
Computer:
Who has IP address 192.168.1.1?
Please tell 192.168.1.10.
The router responds:
Router:
192.168.1.1 is my IP address.
My MAC address is AA:BB:CC:DD:EE:FF.
The computer can store this information in its neighbor cache.
IP Address MAC Address
192.168.1.1 AA:BB:CC:DD:EE:FF
On Linux:
ip neigh
On macOS:
arp -a
The computer does not need to perform a new ARP exchange before every packet. Previously learned information can be reused.
For IPv6 networks, Neighbor Discovery Protocol performs related functions instead of ARP.
11. Where Does TCP Live Inside the Computer?
TCP stands for Transmission Control Protocol.
In a traditional Linux network stack, TCP is implemented inside the Kernel.
The Kernel maintains information about TCP connections in memory.
For each connection, information may include:
- Source IP address
- Source port
- Destination IP address
- Destination port
- Connection state
- Sequence numbers
- Acknowledgment numbers
- Send and receive buffers
- Retransmission timers
- Flow and congestion control information
Example:
Source IP: 192.168.1.10
Source Port: 52341
Destination IP: 203.0.113.20
Destination Port: 443
Connection State: ESTABLISHED
A TCP connection is a logical communication relationship between two endpoints.
It is not a physical cable, a NIC, a switch, or a router.
The operating systems on both sides normally maintain their own state for that connection.
Where Is TCP Implemented in Linux Source Code?
Linux is an open-source operating system Kernel.
We can examine its actual networking implementation.
Some important source code locations include:
| Linux source file | Responsibility |
|---|---|
net/socket.c |
Socket interface |
net/ipv4/tcp.c |
Main TCP implementation |
net/ipv4/tcp_input.c |
Incoming TCP processing |
net/ipv4/tcp_output.c |
Outgoing TCP processing |
net/ipv4/udp.c |
UDP implementation |
net/ipv4/route.c |
IPv4 routing |
net/ipv4/arp.c |
ARP implementation |
net/core/dev.c |
Network device processing |
drivers/net/ |
Network device drivers |
Official Linux source repository:
https://github.com/torvalds/linux/tree/master/net
This shows that TCP/IP networking is not just a theoretical concept. It is implemented as real software inside the operating system.
12. Why Do We Establish a TCP Connection Before Sending an HTTP Request?
Imagine two people communicating over a phone.
Before starting a conversation, one person calls the other person.
The other person answers, and communication begins.
TCP works in a conceptually similar way.
For a normal new TCP connection, the client and server perform a process called the TCP Three-Way Handshake.
CLIENT SERVER
| |
|------------- SYN --------------->|
| |
|<---------- SYN-ACK --------------|
| |
|------------- ACK --------------->|
| |
| TCP CONNECTION ESTABLISHED |
| |
Step 1: SYN
The client initiates the connection and communicates its initial sequence number.
Step 2: SYN-ACK
The server acknowledges the client's sequence information and provides its own.
Step 3: ACK
The client acknowledges the server's sequence information.
The connection is now established after successful completion of this exchange.
The handshake helps synchronize the endpoints and establish connection state.
TCP subsequently provides reliable, ordered byte-stream delivery, retransmitting missing data when necessary.
An established TCP connection does not guarantee that the application is healthy. It confirms that the transport connection was successfully established.
13. TCP vs. UDP
TCP and UDP are transport-layer protocols.
Both provide communication using ports, but they behave differently.
| TCP | UDP |
|---|---|
| Connection-oriented | Connectionless transport |
| Standard connection handshake | No transport handshake |
| Reliable, ordered byte stream | Datagram-based delivery |
| Retransmission built into TCP | No built-in delivery retransmission |
| Flow and congestion control | No equivalent built-in mechanisms |
| Used by SSH, HTTP/1.1, HTTP/2 | Used by traditional DNS queries, QUIC, streaming applications |
UDP does not guarantee that a datagram will arrive, nor does it guarantee delivery order.
However, applications and protocols built on UDP can implement their own reliability mechanisms.
For example, QUIC provides reliable streams and security over UDP.
14. Complete Traffic Flow: From One Computer to Another
Now let's connect everything we have learned.
Imagine opening your browser and typing:
https://example.com
For this example, assume:
- IPv4 networking
- A new connection
- HTTPS using HTTP/1.1 or HTTP/2 over TCP
- A typical home network
- No VPN or proxy
The addresses below are illustrative.
Client Computer
IP Address: 192.168.1.10
MAC Address: AA:AA:AA:AA:AA:01
Default Gateway: 192.168.1.1
Home Router
Private IP: 192.168.1.1
Public IP: 198.51.100.10
MAC: AA:AA:AA:AA:AA:02
Remote Web Server
IP Address: 203.0.113.20
Port: 443
Application: NGINX
Step 1: The Browser Needs to Find the Server
Humans remember domain names.
Computers use IP addresses to route network traffic.
The browser or operating system uses DNS to resolve the domain name, unless the address is already cached.
DNS stands for Domain Name System.
Example:
example.com → 203.0.113.20
DNS itself also requires network communication when a cached answer is unavailable.
Now the browser knows the destination IP address.
Step 2: The Application Requests a TCP Connection
The browser requests a connection to the destination:
203.0.113.20:443
The operating system creates a socket and prepares the TCP connection.
The Kernel selects or uses an appropriate local IP address and source port.
Example:
192.168.1.10:52341 → 203.0.113.20:443
Step 3: The Kernel Checks the Routing Table
The destination IP address is outside the local network.
The Kernel determines that traffic should be sent through the default gateway.
Default Gateway: 192.168.1.1
The browser does not need to understand every router between the client and server.
The operating system and network infrastructure handle the forwarding process.
Step 4: The Kernel Resolves the Router's MAC Address
The computer needs the MAC address of its next-hop router.
If the neighbor cache does not already contain it, the computer performs ARP resolution.
Notice something important:
The destination IP address is the remote server's IP address, but the initial destination Ethernet MAC address belongs to the local router.
The computer does not need to know the remote server's MAC address.
Step 5: Encapsulation
The operating system prepares the TCP SYN segment.
Different networking layers add their own information before transmission.
+------------------------------------------+
| Ethernet Frame |
| |
| Source MAC: Computer |
| Destination MAC: Local Router |
| |
| +------------------------------------+ |
| | IP Packet | |
| | | |
| | Source IP: 192.168.1.10 | |
| | Destination IP: 203.0.113.20 | |
| | | |
| | +------------------------------+ | |
| | | TCP Segment | | |
| | | Source Port: 52341 | | |
| | | Destination Port: 443 | | |
| | | Flag: SYN | | |
| | +------------------------------+ | |
| +------------------------------------+ |
+------------------------------------------+
This process is called encapsulation.
Each networking layer has a different responsibility.
- TCP contains transport information.
- IP contains network addressing information.
- Ethernet contains local-link addressing information.
The initial SYN does not normally contain the HTTP request.
Step 6: The NIC Sends the Information
The network driver and NIC prepare the information for transmission.
Depending on the network medium, it travels using:
- Electrical signals
- Optical signals
- Radio waves
If the computer is using Wi-Fi, the wireless link uses Wi-Fi framing rather than ordinary Ethernet framing on that radio link.
The access point can bridge the traffic into the wired network.
Step 7: The Switch Forwards the Frame
If an Ethernet switch exists between the computer and router, it examines the destination MAC address.
The switch forwards the frame toward the appropriate port.
A traditional Layer 2 switch does not need to establish a TCP connection with the client.
Its responsibility is local frame forwarding.
Step 8: The Router Processes the IP Packet
The router receives the frame and examines the IP packet.
It checks the destination IP address and selects the next route.
A typical home router also performs NAT.
NAT stands for Network Address Translation.
For example:
Before NAT:
192.168.1.10:52341
|
v
203.0.113.20:443
After NAT:
198.51.100.10:61000
|
v
203.0.113.20:443
The router translates the private source address and may also translate the source port.
It maintains translation information so that returning traffic can be forwarded to the correct internal computer.
Step 9: Traffic Travels Through the Internet
The packet may travel through multiple networks and routers.
Client
|
Home Router
|
ISP Router
|
Internet Router
|
Data Center Router
|
Remote Server
Each router makes a forwarding decision based on its routing information.
The link-layer headers are replaced as packets move between different links.
The destination IP address usually remains the remote server's IP address unless another translation mechanism modifies it.
The return path does not necessarily use exactly the same routers.
Step 10: The Remote Server Receives the SYN
The remote server's network interface receives the traffic.
Its network driver passes the information into the operating system's network stack.
The Kernel processes the incoming traffic.
Remote Server
NIC
|
Network Driver
|
Ethernet Processing
|
IP Layer
|
TCP Layer
|
Socket
|
Application
This incoming processing is conceptually the reverse of encapsulation.
If a TCP socket is listening on the destination port and network policies allow communication, the server can respond with SYN-ACK.
Step 11: TCP Connection Is Established
The server sends SYN-ACK.
The client responds with ACK.
The TCP connection is established once both sides complete the necessary state transitions.
Browser Kernel Server Kernel
SYN ------------------------>
<-------------------- SYN-ACK
ACK ------------------------>
TCP ESTABLISHED
Both sides now have transport connection state.
Step 12: TLS Handshake
Because the URL uses HTTPS, the client and server need secure communication.
For this traditional HTTPS-over-TCP example, the TLS handshake takes place after establishing TCP.
TLS provides mechanisms for:
- Encryption
- Server authentication
- Data integrity
- Establishing cryptographic keys
The browser validates the server's certificate according to its trust and identity verification rules.
A successful TCP connection does not mean TLS will succeed.
For example, the TCP connection may work while the TLS handshake fails because of a certificate problem.
Step 13: The Browser Sends the HTTP Request
Once the secure connection is ready, the browser sends its HTTP request.
An illustrative HTTP/1.1 request:
GET / HTTP/1.1
Host: example.com
The request is transmitted as encrypted application data when using HTTPS.
It travels through the established connection.
Step 14: The Server Processes the Request
The operating system makes the received application data available through a socket.
The web server, such as NGINX, reads the request.
Depending on the architecture, NGINX may:
- Return a static web page
- Forward the request to a backend
- Perform reverse proxy operations
- Apply access rules
- Return an error
The backend may also communicate with a database, cache, or another service.
Those downstream communications may establish their own independent network connections.
Step 15: The Server Returns a Response
The server sends an HTTP response.
Example:
HTTP/1.1 200 OK
Content-Type: text/html
The response data travels back toward the client.
The client's operating system receives and processes it.
The browser interprets the HTTP response and displays the website.
All of this can happen within milliseconds or seconds.
Connections can also be reused for multiple requests, so a new TCP and TLS handshake is not necessary for every HTTP request.
15. The Complete Communication Architecture
CLIENT COMPUTER
=================================
Browser / Application
|
DNS
|
Socket Interface
|
TCP / IP Stack
|
Routing Decision
|
ARP / Neighbor Lookup
|
Network Driver
|
NIC
=================================
|
Wi-Fi / Cable
|
Switch / Access Point
|
Router / Default Gateway
|
NAT
|
Modem / ONT
|
ISP
|
Internet
|
Data Center Network
|
=================================
REMOTE SERVER
NIC
|
Network Driver
|
Ethernet / IP
|
TCP
|
Socket
|
NGINX / Application
|
Backend Application
|
Database / Cache
=================================
The physical journey and protocol sequence are related, but they are not the same thing.
The logical TCP connection exists between transport endpoints.
Switches and routers provide the network path that allows TCP segments to travel between those endpoints.
16. How Does This Connect to Cloud Computing?
When we move from a home network to AWS, Azure, Google Cloud, or a private data center, the fundamental networking concepts remain relevant.
The difference is that many infrastructure components are virtualized or managed by the cloud provider.
| Traditional networking | AWS example |
|---|---|
| Network interface | Elastic Network Interface (ENI) |
| Local network | VPC subnet |
| Private network environment | VPC |
| Routing table | VPC Route Table |
| Internet connectivity | Internet Gateway |
| Outbound access from private networks | NAT Gateway |
| Traffic filtering | Security Groups and Network ACLs |
| Request distribution | Load Balancer |
| Computer / Server | EC2 Instance |
These are conceptual comparisons, not exact one-to-one hardware equivalents.
What Is an AWS Internet Gateway?
An Internet Gateway is a managed VPC component that supports communication between a VPC and the internet.
For an EC2 instance to communicate directly with the internet over IPv4, it generally needs:
- An appropriate route to the Internet Gateway
- A public IPv4 address or Elastic IP
- Appropriate security rules
- A functioning operating system and application
Example route:
Destination Target
10.0.0.0/16 local
0.0.0.0/0 igw-xxxxxxxx
Attaching an Internet Gateway alone does not automatically make every instance publicly accessible.
What Is an AWS NAT Gateway?
A public NAT Gateway commonly allows resources in private subnets to initiate outbound IPv4 internet communication.
It does not normally allow unsolicited inbound internet connections to those resources.
Example:
Private EC2 Instance
|
Private Subnet Route Table
|
NAT Gateway
|
Internet Gateway
|
Internet
The application running inside EC2 still uses TCP/IP networking through its operating system.
Cloud networking does not replace the TCP/IP stack.
It provides the infrastructure through which that traffic travels.
17. How Does This Connect to Kubernetes?
Kubernetes creates another layer of networking abstraction.
However, Kubernetes networking also depends on fundamental networking concepts.
A typical request to a Kubernetes application might follow this architecture:
External Client
|
DNS
|
External Load Balancer
|
Kubernetes Ingress / Gateway
|
Kubernetes Service
|
Application Pod
|
Backend / Database
The exact traffic path depends on the networking implementation and load balancer configuration.
For example, an AWS Application Load Balancer configured with IP targets can forward traffic directly to Pod IP addresses.
The Kubernetes Ingress resource itself is configuration. It does not directly forward packets.
An Ingress Controller implements or configures infrastructure based on those routing rules.
Does a Pod Have Its Own Kernel?
A standard Linux container does not have its own independent operating system Kernel.
Containers share the host's Kernel.
Linux network namespaces allow containers or Pods to have isolated networking environments.
A Pod typically has:
- Network namespace
- Network interface
- IP address
- Routing information
- Access to the host Kernel's networking implementation
Containers within the same Pod normally share the Pod's network namespace.
A Container Network Interface (CNI) implementation configures Pod networking.
Example:
KUBERNETES WORKER NODE
=================================
Pod A Pod B
Application Application
Network Namespace Network Namespace
Virtual Interface Virtual Interface
| |
+----------+-----------+
|
Host Linux Kernel
|
CNI Data Plane
|
Node Networking
|
Network
=================================
Kubernetes does not invent TCP, UDP, IP, MAC addresses, or routing.
It uses and extends existing networking mechanisms to provide communication between distributed applications.
18. Why Is This Important for DevOps and SRE Engineers?
Imagine that you are an SRE Engineer responsible for a production application.
At 2 AM, you receive an alert:
Production application is unavailable.
Users cannot access the website.
What should you do?
A common mistake is to immediately restart the application or Kubernetes Pods without understanding where the problem is.
But a production failure can occur anywhere along the communication path.
The problem could be:
- DNS resolution
- Network interface failure
- Missing route
- Incorrect firewall configuration
- Failed TCP handshake
- TLS certificate error
- Load balancer configuration
- Kubernetes Service configuration
- Unhealthy backend
- Application failure
- Database connectivity
A DevOps or SRE Engineer should understand the request path and systematically isolate the failing component.
19. Troubleshooting by Networking Layer
| Layer | Potential problem | Troubleshooting tools |
|---|---|---|
| Physical | Disconnected cable, link failure |
ethtool, ip link
|
| Data Link | VLAN or ARP problems |
ip neigh, tcpdump
|
| Network | Incorrect IP address, missing route |
ip addr, ip route, ping, traceroute
|
| Transport | Port unavailable, failed handshake |
ss, nc, tcpdump
|
| TLS | Certificate or handshake failure |
openssl, curl -v
|
| Application | HTTP errors, application failure |
curl, application logs |
| DNS | Hostname resolution failure |
dig, getent
|
These mappings are troubleshooting starting points rather than strict boundaries.
For example, DNS is an application-layer protocol, but DNS problems can themselves be caused by lower-layer network failures.
20. Practical Troubleshooting Commands
The following commands help engineers inspect how networking works inside an operating system.
Check Network Interfaces
ip link
This displays network interfaces and their link state.
An interface being administratively UP does not always mean its physical connection is healthy.
Check IP Addresses
ip addr
This displays assigned IP addresses and network interfaces.
Check Routing Information
ip route
This displays routing information and can help identify a missing or incorrect default route.
Check Neighbor Information
ip neigh
This shows IP-to-link-layer address mappings and neighbor states.
Test DNS Resolution
dig example.com
This tests whether a DNS server can resolve a domain name.
To test the operating system's normal hostname resolution path on Linux:
getent hosts example.com
Test IP Connectivity
ping example.com
A successful ping indicates ICMP reachability.
However, a failed ping does not necessarily mean the server is unavailable. ICMP traffic may be blocked.
Test TCP Connectivity
nc -vz example.com 443
This attempts to establish a TCP connection to the destination port.
A successful connection does not prove that HTTPS or the application is working.
Check Listening Ports
sudo ss -lntp
This shows listening TCP sockets and, when permissions allow, their associated processes.
Check Established TCP Connections
ss -tan state established
This shows established TCP connections.
Check UDP Sockets
ss -uan
Inspect TCP Sockets and Internal Information
ss -tin
This can display TCP connection information, including details useful for investigating transport performance.
Test TLS
openssl s_client \
-connect example.com:443 \
-servername example.com \
-verify_hostname example.com \
-verify_return_error
This helps investigate the HTTPS server's certificate and TLS handshake.
Test HTTP and HTTPS
curl -v https://example.com
This provides useful information about:
- Destination address
- TCP connection
- TLS handshake
- HTTP request
- HTTP response
Inspect Network Packets
sudo tcpdump -i any -nn 'tcp port 443'
This displays TCP traffic involving port 443.
We can inspect TCP flags such as:
[S] SYN
[S.] SYN-ACK
[.] ACK
[R] RST
[F.] FIN-ACK
Packet captures should only be performed on environments that you are authorized to inspect.
21. Understanding Common Production Errors
| Error | Possible meaning | What to investigate |
|---|---|---|
| Could not resolve host | DNS resolution failure | DNS configuration, resolver, DNS records |
| No route to host | Routing or reachability problem | Routes, network interfaces, firewall |
| Connection timed out | Expected network response did not arrive | Packet loss, routing, firewall, server |
| Connection refused | TCP connection was actively rejected | Listening port, application, firewall reject |
| Connection reset | Established or attempted connection was reset | Application, peer, proxy, firewall |
| Certificate error | TLS identity or trust verification problem | Certificate chain, hostname, expiration |
| HTTP 400 | Request rejected as invalid | Request format and parameters |
| HTTP 401 | Valid authentication credentials required | Authentication configuration |
| HTTP 403 | Request is understood but refused | Authorization, policies |
| HTTP 404 | Resource not found or not disclosed | URL, routing, application |
| HTTP 500 | Unexpected server-side condition | Application logs, dependencies |
| HTTP 502 | Gateway received an invalid upstream response | Proxy, backend, upstream protocol |
| HTTP 503 | Service temporarily unavailable | Backend health, capacity, maintenance |
| HTTP 504 | Gateway did not receive a timely upstream response | Backend latency, network, timeouts |
An error message provides evidence about a failure, but it does not automatically identify its root cause.
For example, an HTTP 503 response proves that some HTTP-speaking component responded. It does not prove that the intended backend received the request.
22. Real-World SRE Scenario: Application Is Unavailable
Incident Description
You are working as an SRE Engineer.
A production website is unavailable, and users receive the following error:
504 Gateway Timeout
The architecture is:
Client
|
DNS
|
Load Balancer
|
Ingress / Reverse Proxy
|
Backend Application
|
Database
Initial Troubleshooting
First, confirm the symptom.
curl -v https://example.com
Check whether DNS resolution works.
dig example.com
Check TCP connectivity.
nc -vz example.com 443
Check TLS and HTTP response information.
curl -v https://example.com
If the client receives an HTTP 504 response, we have evidence that it reached an HTTP-speaking gateway.
Now investigate communication between the gateway and its upstream backend.
Kubernetes Troubleshooting
If the application runs in Kubernetes:
kubectl get nodes
kubectl get pods -n production -o wide
kubectl get svc -n production
kubectl get ingress -n production
kubectl get endpointslice -n production
Investigate application logs:
kubectl logs deployment/backend \
-n production \
--tail=100
Inspect the backend Pod:
kubectl describe pod BACKEND_POD \
-n production
From an authorized diagnostic container, test the internal Service:
curl -v --max-time 10 \
http://backend.production.svc.cluster.local:5001/health
Investigate:
- Are healthy backend endpoints available?
- Is the backend listening on the correct port?
- Is the Kubernetes Service configured correctly?
- Are Network Policies blocking communication?
- Are requests taking longer than the configured timeout?
- Can the backend connect to its database?
- Is the backend experiencing CPU or memory pressure?
- Did a recent deployment introduce a problem?
The engineer should use evidence from each component to locate the failure.
Restarting a Pod without understanding the problem may temporarily hide a symptom while leaving the root cause unresolved.
23. Real-World SRE Scenario: One Kubernetes Worker Node Is NotReady
Imagine that a production Kubernetes cluster contains three worker nodes.
NAME STATUS
worker-1 Ready
worker-2 Ready
worker-3 NotReady
Networking knowledge is essential here.
Possible causes include:
- Physical or virtual network interface failure
- Routing problems
- Firewall configuration
- Kubelet unable to reach the API server
- CNI failure
- Container runtime failure
- Resource pressure
- Operating system failure
Start by collecting evidence:
kubectl get nodes -o wide
kubectl describe node worker-3
kubectl get pods -A -o wide
If you have authorized access to the affected Linux worker node:
ip link
ip addr
ip route
ip neigh
Check system services:
sudo systemctl status kubelet
sudo systemctl status containerd
Check logs:
sudo journalctl -u kubelet -n 100
sudo journalctl -u containerd -n 100
Check system resources:
bash
free -h
df
Top comments (0)