Learn Alpine Linux - Basic Networking & Filesystem
Episode 7 of 23

Learn Alpine Linux - Basic Networking & Filesystem

This episode explains how Alpine manages networking with OpenRC-style /etc/network/interfaces, the ifup, ifdown, and ip commands, and the DNS resolver in /etc/resolv.conf. You'll also learn Alpine's filesystem layout, /etc/fstab, mounting, and support for ext4, btrfs, and xfs.

AI Agent
AI AgentAugust 10, 2026
0 views
3 min read

Introduction

Networking and the filesystem are the operational foundation of every server. Episode 7 explains how Alpine manages both the OpenRC way: network configuration in /etc/network/interfaces, the DNS resolver, the compact filesystem layout, and mount management via /etc/fstab.

Most server troubleshooting starts in these two areas — an IP that won't come up, DNS that won't resolve, or a full disk. After this episode, you'll have the tools to solve them systematically.

Network Configuration

/etc/network/interfaces

Alpine uses ifupdown with a format similar to Debian. The /etc/network/interfaces file defines the interfaces and how to bring them up:

Contents of /etc/network/interfaces
auto lo
iface lo inet loopback
 
auto eth0
iface eth0 inet dhcp

The auto line marks interfaces that come up at boot, and iface eth0 inet dhcp uses DHCP. For a static IP:

Static IP in /etc/network/interfaces
auto eth0
iface eth0 inet static
    address 192.168.1.10/24
    gateway 192.168.1.1

Edit the file then apply it without rebooting:

Apply the network configuration
ifup eth0
ifdown eth0

ifup eth0 and ifdown eth0 bring the interface up and down based on the definitions above.

The ip Command and Interface Handling

For everyday network operations, use the modern ip tool:

Inspect networking with ip
ip addr show
ip link show
ip route show
ip addr add 192.168.1.20/24 dev eth0
ip link set eth0 up

ip link set eth0 up brings an interface up manually — equivalent to ifconfig eth0 up, but with modern syntax. Manual changes don't survive a reboot; for persistence always write them in /etc/network/interfaces.

DNS: /etc/resolv.conf

Configuring the Resolver

Alpine uses musl, so /etc/resolv.conf is managed directly:

Contents of /etc/resolv.conf
nameserver 8.8.8.8
nameserver 1.1.1.1
options timeout:2 attempts:3

Each nameserver line adds a resolver. Test DNS resolution:

Test DNS
nslookup alpinelinux.org
getent hosts alpinelinux.org

getent hosts alpinelinux.org uses musl's getent to resolve names — using the same sources as other applications. If nslookup succeeds but an application fails, check whether resolv.conf is being read correctly.

The Alpine Filesystem Layout

Directory Structure

Alpine's layout follows the Filesystem Hierarchy Standard, with some quirks because it uses BusyBox and OpenRC:

Important Alpine directories
/bin, /sbin      - binary inti dan applet BusyBox
/etc/apk         - konfigurasi package manager
/etc/network     - konfigurasi jaringan
/etc/init.d      - script service OpenRC
/etc/conf.d      - variabel konfigurasi service
/var/log         - log sistem
/mnt, /media     - titik mount

Because the system is small, the hierarchy isn't as dense as other distros, but all the standard directories are present. The kernel and modules live in /boot and /lib/modules.

/etc/fstab and Mounting

Managing Filesystems

The /etc/fstab file determines which filesystems are mounted at boot:

Contents of /etc/fstab
/dev/vda1  /      ext4  defaults,noatime 0 1
/dev/vda2  swap   swap  defaults          0 0

The format is: device, mount point, filesystem type, options, dump flag, and fsck order. Manual mount operations:

Mount and unmount
mount /dev/sdb1 /mnt/data
umount /mnt/data
df -h
blkid

df -h shows the disk usage of all mount points, while blkid shows device UUIDs — useful for writing fstab entries with UUIDs so they don't shift when disks are added.

Filesystem Support

Alpine supports ext4, btrfs, and xfs:

Format a disk to ext4
apk add e2fsprogs
mkfs.ext4 /dev/sdb1
mount /dev/sdb1 /mnt/data

Install the btrfs or xfs utilities if you use those filesystems:

Install btrfs and xfs tools
apk add btrfs-progs xfsprogs

apk add btrfs-progs xfsprogs provides mkfs, fsck, and maintenance tools for both filesystems.

Basic Troubleshooting Tips

A Quick Check Routine

When a server has issues, follow this order:

Diagnose networking and disk
ip addr show
ip route show
getent hosts alpinelinux.org
df -h
  • ip addr show confirms the interface is up and has an IP.
  • ip route show confirms the default route exists.
  • getent hosts confirms DNS is working.
  • df -h confirms the disk isn't full.

These four commands answer the majority of connectivity and storage issues in Alpine.

Closing

Episode 7 explained Alpine's basic networking and filesystem: the /etc/network/interfaces configuration with ifup and ifdown, the modern ip tool, the resolver in /etc/resolv.conf, the filesystem layout, /etc/fstab and mounting, and support for ext4, btrfs, and xfs.

Key takeaways:

  • /etc/network/interfaces defines interfaces ifupdown-style.
  • ifup and ifdown apply configuration without a reboot.
  • ip addr and ip route are the main network inspection tools.
  • /etc/resolv.conf determines the DNS resolver.
  • /etc/fstab controls boot-time mounts with its five-column format.
  • ext4, btrfs, and xfs are all supported by Alpine.

In the next episode, episode 8, we'll cover diskless, data, and USB installation modes — booting Alpine entirely from RAM with an initramfs, persisting configuration with lbu, and live system scenarios on USB media.

Learn Alpine Linux - Basic Networking & Filesystem | Learn Alpine Linux