How do Ubuntu-server network interfaces work?

Abstract: Configure static IPs, DNS, gateways, bonding, and VLANs on Ubuntu Server using Netplan YAML files.

Created: 2026-10-15 by
Network interfaces in Ubuntu Server are managed primarily through the Netplan configuration system, which translates human-readable YAML files into low-level backend configurations for either NetworkManager or systemd-networkd. Understanding this layer is essential for configuring static IPs, bondings, and VPN tunnels correctly without relying on deprecated ifupdown scripts.

Understanding the Netplan Architecture

Ubuntu Server 18.04 and later versions utilize Netplan as the default network configuration utility. This tool acts as an abstraction layer that generates configuration for lower-level network managers. By default, modern Ubuntu installations use systemd-networkd as the backend, although NetworkManager remains a supported alternative, particularly for desktop hybrids or specific server deployments requiring dynamic host management. The core principle of Netplan is declarative configuration. You define what the network state should look like in a YAML file, rather than issuing imperative commands to change the state immediately. These configuration files are stored in the /etc/netplan/ directory. When you modify these files, you must apply them using the netplan apply command, which validates the syntax and pushes the changes to the backend manager.

Locating Configuration Files

To inspect your current network setup, list the files in the configuration directory:
ls -l /etc/netplan/
You will typically see a single YAML file, such as 00-installer-config.yaml or 50-cloud-init.yaml. The number prefix indicates priority; however, in most standard server installations, there is only one active file. Editing these files requires root privileges, so always use a secure editor like nano or vim with sudo.

Basic Interface Configuration

A basic network interface definition includes the device name, IP address assignment method, and gateway settings. Below is a standard example for a static IPv4 configuration on an Ethernet interface named eth0.
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.1.10/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1
In this snippet, dhcp4: no disables automatic IP acquisition. The addresses field specifies the static IP and subnet mask. The routes section defines the default gateway, which is crucial for external connectivity. Finally, the nameservers block configures DNS resolution, ensuring that domain names resolve to IP addresses. If you prefer DHCP, you can simplify the configuration by setting dhcp4: yes and omitting the static IP, routes, and nameserver blocks, allowing the router to handle those assignments automatically.

Advanced Networking: Bonding and VLANs

For high-availability setups, Linux supports network bonding, which combines multiple physical interfaces into a single logical interface. This provides load balancing and fault tolerance. Netplan supports bonding through the bonding type in the YAML structure. Similarly, Virtual LANs (VLANs) allow you to segment traffic on a single physical link. In Netplan, you define VLANs under the parent interface using the vlan key. This is particularly useful in data center environments where network isolation is required without additional hardware switches. When configuring complex topologies, ensure that the backend manager (systemd-networkd or NetworkManager) supports the specific features you intend to use. While both support basic IPv4/IPv6, some advanced bonding modes or VLAN tagging behaviors may have subtle differences in implementation.

Troubleshooting Common Issues

Network misconfigurations can lead to loss of SSH access, making remote troubleshooting difficult. Always verify your configuration syntax before applying it. Use netplan generate to check for errors without applying changes. If the command returns no output, the syntax is valid. If you lose connectivity after applying a new configuration, revert to the previous state by restoring the original YAML file from backup or using the cloud-init cache if available. For immediate diagnostics, use ip addr show to verify interface states and ip route to check routing tables. For VPN integration, such as WireGuard or OpenVPN, the network interface handling depends on the tunnel type. WireGuard creates virtual interfaces that route traffic through existing physical interfaces. If you encounter issues with internal network access while connected to a VPN, consult our guide on Routing Internet-Bound Traffic Between Two WireGuard Peers to adjust routing tables properly. Another common issue arises when VPN clients do not receive correct DNS or gateway routes. Ensure that your VPN configuration explicitly sets the route and dns parameters within the client configuration file. If you are setting up a new VPN connection from scratch, refer to How to Set Up a VPN on Linux Using OpenVPN: A Comprehensive Guide for detailed steps on daemon configuration and service management.

Verifying Connectivity and Services

After applying changes, verify that the network service is running correctly. For systemd-networkd, use systemctl status systemd-networkd. Check the journal logs for any errors related to interface initialization:
journalctl -u systemd-networkd -f
This real-time log view helps identify why an interface might fail to come up. Common causes include incorrect MAC addresses, conflicting IP ranges, or missing gateway definitions. If you are connecting directly to a router without intermediate switches, ensure that the interface is set to accept traffic correctly. Misconfigured direct links often result in ping failures despite correct IP settings. Reviewing Configure Ethernet Interface for Direct Link with Computer Router to Internet on Jetson Nano (Ubuntu 22.04) can provide insights into handling direct physical connections where NAT is not involved.

Frequently Asked Questions

How do I switch from NetworkManager to systemd-networkd?

You can switch backends by modifying the renderer field in your Netplan YAML file. Change renderer: NetworkManager to renderer: systemd-networkd and run netplan apply. Note that NetworkManager may need to be stopped or disabled to prevent conflicts.

Why does netplan apply fail with a syntax error?

YAML is sensitive to indentation and spacing. Ensure you use spaces, not tabs, and maintain consistent indentation levels. Use netplan generate to pinpoint the exact line causing the error before attempting to apply the configuration again.

Can I configure multiple network interfaces in one file?

Yes, you can define multiple interfaces under the ethernets, wifis, or other relevant sections in a single YAML file. Each interface is defined by its unique name, allowing centralized management of complex network setups.

What happens if I lose SSH access after changing network settings?

If you lose access, you will need physical console access or out-of-band management to revert the changes. Restore the original configuration file from a backup or reinstall the package if necessary. Always test changes in a non-production environment first.

How do I disable IPv6 on a specific interface?

Add ipv6: false under the specific interface configuration in Netplan. This disables IPv6 stack initialization for that interface. Alternatively, you can use sysctl settings in /etc/sysctl.conf for a global disable, though per-interface control is preferred for servers.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More