DEV Community

Cover image for Networking Fundamentals for Developers: The Only Concepts You Need to Get Started
Hamidreza
Hamidreza

Posted on

Networking Fundamentals for Developers: The Only Concepts You Need to Get Started

Networking can feel overwhelming with many protocols, devices, and concepts to learn. This guide focuses on the networking fundamentals that are most useful for developers, Linux users, and beginners in cybersecurity. It covers the essential concepts needed to understand how devices communicate, how data travels across networks, and how common networking technologies work.

Table of Contents


Network Fundamentals

1. Why Do We Need Networks?

A network allows devices to communicate and share data.

Examples:

  • Your PC accessing the Internet
  • Two computers sharing files
  • A phone connecting to a Wi-Fi router

Devices can connect in different ways:

  • Ethernet (LAN cable)
  • Wi-Fi (Wireless)

2. MAC Address

Every network interface (Ethernet or Wi-Fi) has a unique MAC address assigned by the manufacturer.

Example:

00:1A:2B:3C:4D:5E
Enter fullscreen mode Exit fullscreen mode

Think of it as a hardware serial number.

When devices communicate inside the same local network, they use MAC addresses.

Important:

  • MAC addresses normally don't change.
  • They are only useful inside a local network (LAN).

3. Switch

If we have two devices, they can connect directly to each other.

But what about 200 devices? This is where a switch becomes useful.

A switch is a device that connects multiple devices together.

PC1 ----------     Switch     ---------- PC3
PC2 ----------                 ---------- PC4
Enter fullscreen mode Exit fullscreen mode

The switch remembers the MAC address of each connected device and forwards traffic only to the correct destination.


4. IP Address

MAC addresses work only inside local networks.

But what about large networks or the Internet?

This is where IP addresses are used.

Example:

192.168.1.80
Enter fullscreen mode Exit fullscreen mode

5. Static vs. DHCP

Every device needs an IP address.

You can assign one manually. This is called a Static IP.

But what about a large network? Assigning every IP address manually would be difficult.

This is where DHCP comes in.

A DHCP server automatically assigns IP addresses to devices.

Flow:

Client ----DHCPDISCOVER----> Server
Client <-----DHCPOFFER------ Server
Client -----DHCPREQUEST----> Server
Client <------DHCPACK------- Server
Enter fullscreen mode Exit fullscreen mode

Steps

Discovery

The client sends a DHCPDISCOVER message to find DHCP servers.

It's like asking:

"Is there a DHCP server available?"

Offer

The DHCP server receives the DHCPDISCOVER message and offers an available IP address.

Note: A device may receive the same IP address it had previously. DHCP does not always assign a different address.

Request

The client requests the offered IP address.

It's like saying:

"Can I use this IP address?"

Acknowledgement

The DHCP server receives the request and sends a DHCPACK message.

This includes information such as:

  • Lease duration
  • Subnet mask
  • Default gateway
  • DNS servers

6. Subnet

A subnet divides a large network into smaller networks.

Example:

192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode

This means the following addresses are in the same subnet:

192.168.1.1
192.168.1.2
...
192.168.1.254
Enter fullscreen mode Exit fullscreen mode

7. Router

Devices in the same local network can communicate directly.

But what about communication with devices outside the local network?

This is where routers are used.

A router is like a switch, but instead of connecting devices, it connects networks.

  • A switch connects devices within the same network.
  • A router connects different networks.

When you open YouTube:

  1. Your PC sends packets to the router.
  2. The router decides where to forward them.
  3. Eventually, they reach Google's servers.

Routers make these decisions using routing tables.


8. Default Gateway

A computer can communicate directly only with devices in the same local network.

If it needs to communicate with another network (such as the Internet), it sends the packet to its Default Gateway, which is usually the router.

Example:

PC

"I want to reach 8.8.8.8."

PC

"That IP isn't in my local subnet."

PC

"I'll send the packet to my Default Gateway."

Router

"I know where to forward it."


9. DNS (Domain Name System)

Imagine you want to call Jane Doe.

You don't memorize her phone number. Instead, you look it up in your contacts.

DNS works the same way.

When you type youtube.com, your browser doesn't know its IP address.

It asks a recursive DNS server, which finds the IP address and returns it.

Your browser then connects to that IP address.

Note: A recursive DNS server accepts client requests and looks up the IP address of a domain.


10. Recursive vs. Authoritative Server

  • Recursive Server: The seeker. It searches the Internet to find the IP address requested by your device.

  • Authoritative Server: The source. It stores the official DNS records for a domain.

Main Difference

The recursive server asks the questions.

The authoritative server provides the answers.


11. TCP vs. UDP

TCP and UDP are transport layer protocols.

  • TCP: Reliable and ordered. It establishes a connection using a three-way handshake before sending data.
  • UDP: Faster, but does not guarantee delivery or ordering.

Usage

TCP

  • File downloads
  • Web browsing
  • Text messaging

UDP

  • Live streaming
  • Online games
  • Voice and video calls

A simple rule:

  • Use TCP when reliability is more important.
  • Use UDP when speed and low latency are more important.

12. Port

Imagine you enter a cinema.

If you want to buy a ticket, you go to the ticket counter—not the movie theater or the restroom.

Ports work similarly.

They tell incoming network traffic which service or application should receive it.

Common ports:

  • 80 → HTTP
  • 443 → HTTPS
  • 22 → SSH

13. One Important Question

Switches use MAC addresses, but applications communicate using IP addresses.

So how does a switch know where to send packets?

The answer is ARP.

Flow

PC1 (192.168.1.1)

"I want to send a packet to 192.168.1.2, but I don't know its MAC address."

PC1 sends an ARP Request as an Ethernet broadcast.

Destination MAC:

FF:FF:FF:FF:FF:FF
Enter fullscreen mode Exit fullscreen mode

The switch forwards the broadcast to every device on the LAN.

All devices receive:

"Who has 192.168.1.2?
Tell 192.168.1.1."

PC2 replies:

"That's me!
My MAC address is BB:BB:BB:BB:BB:BB."

PC1 stores the MAC address in its ARP cache.

Now PC1 can send Ethernet frames directly to PC2.


14. ARP

ARP (Address Resolution Protocol) maps IP addresses to MAC addresses.

Imagine you want to send data to:

192.168.1.20
Enter fullscreen mode Exit fullscreen mode

Your PC knows the IP address, but Ethernet uses MAC addresses.

So how do we find the MAC address?

That's ARP's job.

Flow:

Need to reach
192.168.1.20

↓

ARP Request
"Who has 192.168.1.20?"

↓

Target replies

↓

MAC learned

↓

Normal communication begins
Enter fullscreen mode Exit fullscreen mode

Security Note: ARP has no built-in authentication. Any device can claim to own an IP address, making ARP spoofing (ARP poisoning) possible.


15. Tunneling

Tunneling is the process of encapsulating one packet inside another so it can travel across a different network.


16. OSI Model (Open Systems Interconnection)

The OSI model describes seven layers that computers use to communicate over a network.

Layer 7 — Application

(User interaction, protocols, and application services)

This layer interacts directly with applications such as web browsers and email clients.

Protocols include:

  • HTTP
  • HTTPS
  • FTP
  • SMTP

Layer 6 — Presentation

(Encryption, compression, translation)

This layer translates, encrypts, and compresses data so that the application layer can understand it.


Layer 5 — Session

(Managing communication sessions)

This layer establishes, maintains, and closes communication sessions between devices.


Layer 4 — Transport

(Segmentation, transport, reassembly)

Responsible for end-to-end communication.

It breaks data into segments before transmission and reassembles them at the destination.

Protocols:

  • TCP
  • UDP

Layer 3 — Network

(Routing and packet forwarding)

Responsible for moving packets between different networks.

Protocols:

  • IPv4
  • IPv6
  • ICMP

Devices:

  • Routers

Layer 2 — Data Link

(MAC addressing and local communication)

Responsible for communication within the same LAN.

Protocols:

  • Ethernet
  • Wi-Fi

Devices:

  • Switches

Layer 1 — Physical

(Bits on the wire)

The lowest layer.

It transmits raw bits using electrical, optical, or radio signals.

Devices:

  • Cables
  • Repeaters
  • Hubs

Learn more about OSI Model. What is the OSI Model


17. Network Protocols

A network protocol is a set of rules that defines how data is transmitted, received, and interpreted between devices.

HTTP (HyperText Transfer Protocol)

HTTP allows clients and servers to exchange resources such as:

  • HTML
  • CSS
  • JavaScript
  • Images
  • Videos
  • JSON
      ----Request---->

Client                Server

      <---Response----
Enter fullscreen mode Exit fullscreen mode

HTTPS (HyperText Transfer Protocol Secure)

HTTPS is HTTP with encryption.

It is used by websites that require secure communication, such as login pages, banking websites, and chat applications.


WebSocket

Unlike HTTP, which follows a request/response model, WebSocket provides a persistent, real-time connection.

Client ----Connection---- Server
Enter fullscreen mode Exit fullscreen mode

Best suited for:

  • Online games
  • Chat applications
  • Live dashboards

Downside:

If the connection is lost, reconnecting is generally more complex than making a new HTTP request.


TCP (Transmission Control Protocol)

TCP ensures reliable, ordered delivery of data across the Internet.

Best suited for:

  • Web browsing
  • File transfers
  • Email

UDP (User Datagram Protocol)

UDP sends packets without establishing a connection or guaranteeing delivery.

Best suited for:

  • Live streaming
  • Voice calls
  • Online gaming

FTP (File Transfer Protocol)

FTP is used to transfer files between a client and a server.

It uses separate connections for:

  • Control commands
  • Data transfer

Conclusion

Understanding network fundamentals is an essential step for anyone interested in Linux, backend development, cybersecurity, or software engineering. These concepts provide the foundation for understanding how computers communicate and how modern systems work. However, networking is a vast field, and this guide only covers the basics. The best way to improve your knowledge is through continuous learning, exploring real-world examples, reading documentation, and experimenting with network tools.

Top comments (0)