DEV Community

Cover image for Get Connected: Mastering Networking Concepts and Configuration in Linux
Marzena Pugo
Marzena Pugo

Posted on

1 1

Get Connected: Mastering Networking Concepts and Configuration in Linux

Table of Contents:


Why Networking Matters in Linux

Networking is the backbone of any Linux system-whether you’re spinning up a cloud server, building a home lab, or just sharing files on your local network.

A solid grasp of networking concepts and configuration means you can connect, troubleshoot, and secure your systems with confidence.


Core Networking Concepts

Before you dive into configs and commands, let’s break down the basics:

  • Network Interfaces: These are your system’s connections to the network, like Ethernet (eth0, enp3s0), Wi-Fi (wlan0), or virtual adapters

  • IP Addressing: Every device needs a unique address. Linux supports both IPv4 and IPv6

  • Subnet & Gateway: The subnet defines your local network range, and the gateway is your route to the outside world

  • DNS: Translates domain names (like google.com) into IP addresses your system can use

  • Routing: Linux uses routing tables to decide where to send network traffic-think of it as the system’s GPS

  • Network Services: These include web servers, file sharing, and more, all running on your Linux box


Configuring Network Interfaces

There are a few ways to set up networking in Linux, depending on your distro and needs:

  • Manual Editing:

Debian/Ubuntu: /etc/network/interfaces or /etc/netplan/

Red Hat/CentOS: /etc/sysconfig/network-scripts/ifcfg-

  • Command-Line Tools:

ip (modern and powerful)

ifconfig (classic, but legacy)

nmcli (for NetworkManager, especially on desktops)

  • Graphical Tools:

Most desktops offer a GUI for quick network changes

Example: Setting a static IP with the ip command:

ip addr add 192.168.1.100/24 dev eth0
ip link set eth0 up
ip route add default via 192.168.1.1
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

  • Or, with nmcli:

nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24
nmcli con mod "Wired connection 1" ipv4.gateway 192.168.1.1
nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8"
nmcli con mod "Wired connection 1" ipv4.method manual
nmcli con up "Wired connection 1"


Essential Networking Commands

Here are some must-know tools for any Linux user:

ip a or ifconfig - show network interfaces and IPs

ping -test connectivity to another system

traceroute - see the path your packets take

netstat or ss - list open ports and connections

route - show or edit the routing table

tcpdump - capture and analyze network traffic

dig or nslookup - troubleshoot DNS issues


Real-Life Example: Setting a Static IP

Let’s say you’re building a home server and want a fixed address
On Ubuntu, edit /etc/netplan/01-netcfg.yaml:

network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]

  • Apply with:

sudo netplan apply

Now your server always has the same IP-no more guessing!

Troubleshooting Tips:

  • Check interfaces: ip a or ifconfig -a

  • Test connectivity: ping 8.8.8.8

  • Check routes: ip route show

  • Review DNS: cat /etc/resolv.conf

  • Analyze traffic: tcpdump -i eth0

If something isn’t working, start with these basics before diving deeper


Wrapping Up

Linux networking doesn’t have to be intimidating.

Once you know the core concepts and get comfortable with a few configuration files and commands, you’ll be ready to connect, troubleshoot, and manage any system-at home, at work, or in the cloud.

Happy networking!

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Image of Datadog

Get the real story behind DevSecOps

Explore data from thousands of apps to uncover how container image size, deployment frequency, and runtime context affect real-world security. Discover seven key insights that can help you build and ship more secure software.

Read the Report

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay