Skip to content

Netplan Network Configuration

This section provides comprehensive coverage of Netplan, Ubuntu's network configuration abstraction layer. Understanding Netplan is essential for configuring complex network setups involving bridges, bonds, VLANs, and integration with virtualization technologies.

What is Netplan?

Netplan is a utility for network configuration on Linux systems using YAML files. It acts as an abstraction layer between you and the underlying network configuration systems.

┌─────────────────────────────────────────────────────────────┐
│                    YAML Configuration                        │
│                  /etc/netplan/*.yaml                         │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│                        Netplan                               │
│              Parses YAML, generates config                   │
└─────────────────────────────────────────────────────────────┘
              ┌─────────────┴─────────────┐
              ▼                           ▼
┌─────────────────────────┐   ┌─────────────────────────┐
│    systemd-networkd     │   │    NetworkManager       │
│   (Server default)      │   │   (Desktop default)     │
└─────────────────────────┘   └─────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│                    Linux Kernel                              │
│              Network interfaces configured                   │
└─────────────────────────────────────────────────────────────┘

Why Netplan?

Before Netplan

Different tools for different scenarios: - /etc/network/interfaces (ifupdown) - NetworkManager connection files - systemd-networkd .network files - Distribution-specific tools

With Netplan

  • Single configuration format (YAML)
  • Backend-agnostic - same config works with networkd or NetworkManager
  • Declarative - describe desired state, not commands
  • Cloud-ready - integrates with cloud-init
  • Validation - catches errors before applying

Section Overview

Fundamentals

Interface Types

  • Ethernet - Physical interfaces, DHCP, static IP
  • Bridges - Software switches for VMs and containers
  • Bonds - Link aggregation for redundancy/performance
  • VLANs - Virtual LANs for network segmentation
  • Wireless - WiFi configuration
  • Virtual Interfaces - Dummy, VXLAN, tunnels

Routing & DNS

Advanced Topics

Integration

Troubleshooting

Reference

Quick Start

Minimal Server Configuration

# /etc/netplan/00-config.yaml
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true

Static IP Configuration

network:
  version: 2
  ethernets:
    eth0:
      addresses:
        - 192.168.1.100/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]

Apply Configuration

# Test without applying
sudo netplan try

# Apply configuration
sudo netplan apply

# Generate and show backend config
sudo netplan generate

Key Concepts

Declarative Configuration

Netplan uses declarative YAML - you describe the desired end state, not the steps to get there.

Always Use netplan try

The netplan try command applies changes with an automatic rollback timer. Essential for remote administration.

File Naming Matters

Files are processed in alphabetical order. Use numbered prefixes (00-, 01-) to control order.