Network Configuration

Network Configuration

Concepts

The ip Command

The ip command is the modern way to view and configure network interfaces. It replaces the deprecated ifconfig.

Viewing Configuration

# Show all interfaces with IP addresses
ip addr show
# or shorthand:
ip a

# Show a specific interface
ip addr show enp0s3

# Show only IPv4
ip -4 addr show

# Show link status (up/down, MAC addresses)
ip link show

# Show routing table
ip route show
# or:
ip r

Understanding ip addr Output

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    link/ether 08:00:27:ab:cd:ef brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic enp0s3
    inet6 fe80::a00:27ff:feab:cdef/64 scope link
Field Meaning
enp0s3 Interface name (en=ethernet, p0s3=PCI bus location)
UP Interface is active
mtu 1500 Maximum Transmission Unit (packet size)
link/ether MAC address
inet 192.168.1.100/24 IPv4 address and subnet
dynamic Obtained via DHCP
inet6 fe80::... IPv6 link-local address

Interface Naming

Old Style New Style Type
eth0 enp0s3, ens33 Ethernet
wlan0 wlp2s0 Wi-Fi
lo lo Loopback (always 127.0.0.1)

Temporary Configuration (Lost on Reboot)

# Add an IP address
sudo ip addr add 192.168.1.200/24 dev enp0s3

# Remove an IP address
sudo ip addr del 192.168.1.200/24 dev enp0s3

# Bring an interface up or down
sudo ip link set enp0s3 up
sudo ip link set enp0s3 down

# Add a default route
sudo ip route add default via 192.168.1.1

# Add a static route
sudo ip route add 10.0.0.0/8 via 192.168.1.1

These changes are temporary — they are lost on reboot. For persistent configuration, use Netplan (Ubuntu) or /etc/network/interfaces (Debian).

[Read more]

Network Diagnostics

Network Diagnostics

Concepts

Diagnostic Toolkit

When network issues occur, these tools help you pinpoint the problem. Work from the bottom up: check physical/link connectivity first, then IP, then DNS, then application.

ping — Check Reachability

ping -c 4 192.168.1.1        # send 4 packets to gateway
ping -c 3 8.8.8.8             # test internet connectivity
ping -c 3 google.com          # test DNS + connectivity
ping -i 0.5 -c 10 host        # 0.5 second interval

If ping 8.8.8.8 works but ping google.com fails → DNS problem. If ping gateway fails → local network problem.

[Read more]

Networking Concepts

Networking Concepts

Prerequisite: This lesson covers the networking theory you need before configuring Linux networking. If you are already comfortable with IP addresses, subnets, DNS, and DHCP, you can skim this and move to the next lesson.

Concepts

IP Addresses

Every device on a network has an IP address — a numeric identifier that allows other devices to find and communicate with it.

IPv4

The most common format. Four numbers (0-255) separated by dots:

[Read more]

Paths, Links, and Inodes

Paths, Links, and Inodes

Concepts

How Linux Stores Files — Inodes

To understand links, you first need to understand how Linux actually stores files.

Every file on a Linux filesystem has two parts:

  1. The data — the actual content of the file (bytes on disk).
  2. The inode (index node) — a data structure that stores metadata about the file:
    • File type (regular file, directory, symlink, etc.)
    • Permissions (read, write, execute)
    • Owner and group
    • File size
    • Timestamps (created, modified, accessed)
    • Pointers to the disk blocks where the data is stored
    • Link count — how many names point to this inode

Notice what the inode does not contain: the filename. The filename is stored in the directory that contains the file. A directory is essentially a table mapping names to inode numbers.

[Read more]

Performance and Troubleshooting

Performance and Troubleshooting

Concepts

Load Average

Load average represents the average number of processes waiting to run (or running) over 1, 5, and 15 minutes:

uptime
# 15:18:24 up 22:52,  1 user,  load average: 0.33, 0.14, 0.05
#                                            1min  5min  15min

cat /proc/loadavg
# 0.24 0.13 0.05 1/832 454403

How to interpret it:

  • Compare load to number of CPU cores (nproc)
  • Load = number of cores → CPU is fully utilized
  • Load > number of cores → processes are waiting (overloaded)
  • Load « number of cores → system is idle
# Number of CPU cores
nproc
# Example: 4

# Load of 4.0 on a 4-core system = 100% utilization
# Load of 8.0 on a 4-core system = overloaded (processes queuing)
# Load of 1.0 on a 4-core system = 25% utilization

Trends matter more than snapshots: if the 1-minute average is much higher than the 15-minute average, load is spiking. If all three are high, the system is consistently overloaded.

[Read more]