Linux Networking - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
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
- Understanding Linux Networking
- NetworkManager Setup
- Wired Connection
- Wireless Connection
- Static IP Configuration
- VPN Configuration
- DNS Configuration
- Troubleshooting
Understanding Linux Networking
Network Components
Linux networking uses several components:
- Network Interface: Physical or virtual network connection
- Ethernet: Wired connection (eth0, enp0s3, etc.)
- Wi-Fi: Wireless connection (wlan0, wlp2s0, etc.)
- Virtual: VPN, bridge, etc.
- NetworkManager: Network management service
- What it does: Manages network connections
- GUI: Provides graphical network settings
- CLI: Command-line tools (nmcli)
- IP Address: Network identifier
- IPv4: Traditional IP addresses (192.168.1.1)
- IPv6: Modern IP addresses (2001:db8::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:
- Click network icon in system tray
- Select network from list
- Enter password if required
- 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:
- Open:
nm-connection-editor - Select connection → Edit
- IPv4 Settings → Manual
- Enter: IP, Gateway, DNS
- 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:
- Open:
nm-connection-editor - Add → VPN
- Select VPN type
- 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
- Network Utilities - Network troubleshooting tools
- SSH Configuration - SSH setup
- File Sharing - Network file sharing
- ArchWiki NetworkManager: https://wiki.archlinux.org/title/NetworkManager
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.