Skip to content

Linux Networking

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux Networking Guide

Complete beginner-friendly guide to networking on Linux, covering Arch Linux, CachyOS, and other distributions including NetworkManager, wired/wireless connections, static IP, VPN, and DNS configuration.


Table of Contents

  1. Understanding Linux Networking
  2. NetworkManager Setup
  3. Wired Connection
  4. Wireless Connection
  5. Static IP Configuration
  6. VPN Configuration
  7. DNS Configuration
  8. Troubleshooting

Understanding Linux Networking

Network Components

Linux networking uses several components:

  1. Network Interface: Physical or virtual network connection
  • Ethernet: Wired connection (eth0, enp0s3, etc.)
  • Wi-Fi: Wireless connection (wlan0, wlp2s0, etc.)
  • Virtual: VPN, bridge, etc.
  1. NetworkManager: Network management service
  • What it does: Manages network connections
  • GUI: Provides graphical network settings
  • CLI: Command-line tools (nmcli)
  1. IP Address: Network identifier
  • IPv4: Traditional IP addresses (192.168.1.1)
  • IPv6: Modern IP addresses (2001:db8::1)
  1. DNS: Domain Name System
  • What it does: Converts domain names to IP addresses
  • Example: google.com → 142.250.191.14

Network Configuration Methods

Two main methods:

  • NetworkManager: Easy, graphical, recommended
  • Manual configuration: Advanced, command-line

This guide focuses on NetworkManager (easier for beginners).


NetworkManager Setup

Install NetworkManager

Arch/CachyOS:

# Install NetworkManager
sudo pacman -S networkmanager

# Enable service
sudo systemctl enable --now NetworkManager.service

Debian/Ubuntu:

sudo apt install network-manager
sudo systemctl enable NetworkManager

Fedora:

sudo dnf install NetworkManager
sudo systemctl enable NetworkManager

NetworkManager Tools

GUI and CLI tools:

# Install GUI
sudo pacman -S network-manager-applet

# CLI tool (nmcli is included)
nmcli --help

Check Status

Verify NetworkManager:

# Check status
systemctl status NetworkManager

# List connections
nmcli connection show

# List devices
nmcli device status

Wired Connection

Automatic Connection

Ethernet usually works automatically:

# Check connection
nmcli device status

# Should show:
# eth0  ethernet  connected  Wired connection 1

Manual Connection

Create wired connection:

# Create connection
sudo nmcli connection add type ethernet con-name "Wired" ifname eth0

# Activate connection
sudo nmcli connection up "Wired"

Configure Connection

Edit connection:

# Edit connection
nmcli connection edit "Wired connection 1"

# Or use GUI
nm-connection-editor

Wireless Connection

Connect to Wi-Fi

Using GUI:

  1. Click network icon in system tray
  2. Select network from list
  3. Enter password if required
  4. Connect

Using CLI:

# Scan for networks
nmcli device wifi list

# Connect to network
nmcli device wifi connect "Network-Name" password "password"

# Connect to hidden network
nmcli device wifi connect "Network-Name" password "password" hidden yes

Wi-Fi Drivers

Check drivers:

# Check wireless card
lspci | grep -i network

# Check driver
lsmod | grep -i wifi

Static IP Configuration

Set Static IP

Using NetworkManager:

# Edit connection
nmcli connection edit "Wired connection 1"

# Set static IP
set ipv4.addresses 192.168.1.100/24
set ipv4.gateway 192.168.1.1
set ipv4.dns 8.8.8.8
set ipv4.method manual
save
activate

Using GUI:

  1. Open: nm-connection-editor
  2. Select connection → Edit
  3. IPv4 Settings → Manual
  4. Enter: IP, Gateway, DNS
  5. Save

VPN Configuration

OpenVPN

Install OpenVPN:

# Arch/CachyOS
sudo pacman -S openvpn

# Debian/Ubuntu
sudo apt install openvpn

# Fedora
sudo dnf install openvpn

Connect:

# Connect to VPN
sudo openvpn --config config.ovpn

WireGuard

Install WireGuard:

# Arch/CachyOS
sudo pacman -S wireguard-tools

# Debian/Ubuntu
sudo apt install wireguard

# Fedora
sudo dnf install wireguard-tools

Configure:

# Create config
sudo vim /etc/wireguard/wg0.conf

# Enable
sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0

NetworkManager VPN

Install VPN plugins:

# OpenVPN plugin
sudo pacman -S networkmanager-openvpn

# WireGuard plugin
sudo pacman -S networkmanager-wireguard

Configure in GUI:

  1. Open: nm-connection-editor
  2. Add → VPN
  3. Select VPN type
  4. Configure

DNS Configuration

Set DNS Servers

Using NetworkManager:

# Edit connection
nmcli connection edit "Wired connection 1"

# Set DNS
set ipv4.dns "8.8.8.8 8.8.4.4"
save
activate

System-wide DNS:

# Edit resolv.conf
sudo vim /etc/resolv.conf

Add:

nameserver 8.8.8.8
nameserver 8.8.4.4

DNS over HTTPS

Install DoH:

# Install cloudflared
yay -S cloudflared

# Or use systemd-resolved
sudo systemctl enable systemd-resolved

Troubleshooting

No Internet Connection

Check connection:

# Check status
nmcli device status

# Restart NetworkManager
sudo systemctl restart NetworkManager

# Check interface
ip link show

Wi-Fi Not Working

Check drivers:

# Check wireless card
lspci | grep -i network

# Check driver
lsmod | grep -i wifi

# Install drivers if needed
sudo pacman -S linux-firmware

DNS Issues

Test DNS:

# Test DNS
nslookup google.com

# Flush DNS cache
sudo systemd-resolve --flush-caches

Summary

This guide covered networking for Arch Linux, CachyOS, and other distributions, including NetworkManager, wired/wireless, static IP, VPN, and DNS configuration.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally