Ubuntu Netplan Network Configuration YAML Generator
Ubuntu System Networking

Ubuntu Netplan Network Configuration YAML Generator

Generate Ubuntu 20.04/22.04/24.04 netplan YAML configs for static IPs, DHCP, DNS nameservers, gateway routes, bridges, and bonds.

Presets:
Netplan Engine & Operating System Profile
Ubuntu 22/24 routes•networkd•chmod 0600
ens18
Configuring Device:ens18ethernet
Separate multiple CIDRs with comma or newline.
Auto-synthesizes routes (22/24) or gateway4 (20.04).
Advanced Hardware & Boot Settings
# This file is generated by ToolsAA Netplan Network Configuration Builder
# Documentation: https://netplan.readthedocs.io/en/stable/netplan-yaml/
# Apply with: sudo netplan try --timeout 45 || sudo netplan apply
network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      dhcp4: false
      dhcp6: false
      addresses:
        - 192.168.1.150/24
      routes:
        - to: default
          via: 192.168.1.1
          metric: 100
        - to: 10.0.0.0/8
          via: 192.168.1.254
          metric: 200
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8, 9.9.9.9]
        search: [internal.local]
      mtu: 1500
Interfaces Defined1 Devicesens18 (ethernet)
IP Configurations1 SubnetsGateway: 192.168.1.1
Netplan Version / RendererNetplan v2 (networkd)Ubuntu 22.04 / 24.04 LTS (routes syntax)

100% In-Browser YAML Synthesis

Synthesizes strict, indentation-perfect Netplan 0.104+ YAML configs in real time entirely within your browser memory.

Sub-Millisecond AST Engine

Your internal subnets, static IPs, MAC addresses, and gateway credentials never leave your local client machine.

Multi-Ubuntu LTS Compatibility

Seamlessly switches between Ubuntu 22.04/24.04 modern routes syntax and Ubuntu 20.04 legacy gateway4 parameters.

Technical Reference & Architecture Guide

Ubuntu Netplan Network Configuration YAML Generator — Reference Guide

Generate Ubuntu 20.04/22.04/24.04 netplan YAML configs for static IPs, DHCP, DNS nameservers, gateway routes, bridges, and bonds.

Key Parameters & Controls

rendererEnum (networkd | NetworkManager)

Specifies the backend networking daemon. Use 'networkd' for Ubuntu Server/cloud environments and 'NetworkManager' for Ubuntu Desktop.

Default: networkd
addressesCIDR String Array

Static IPv4 or IPv6 addresses assigned to the interface with CIDR subnet prefix lengths (e.g. 192.168.1.50/24 or 2001:db8::10/64).

Default: ['192.168.1.50/24']
routesObject Array

Routing table entries replacing deprecated gateway4/gateway6 directives. Format: [{ to: default, via: <gateway-ip>, metric: 100 }].

Default: [{ to: 'default', via: '192.168.1.1' }]
nameserversObject

DNS resolver configuration containing 'addresses' (upstream DNS IP list) and optional 'search' (local domain search suffixes).

Default: { addresses: ['1.1.1.1', '8.8.8.8'], search: ['lan'] }
dhcp4 / dhcp6Boolean

Enables or disables Dynamic Host Configuration Protocol client auto-configuration on the selected interface.

Default: false

Pro Tips & Best Practices

Always Test Over SSH with 'netplan try'

Never run 'netplan apply' directly over remote SSH. Use 'sudo netplan try', which starts a 120-second rollback timer that automatically reverts changes if network connectivity drops.

Strict 2-Space Indentation Rules

YAML forbids tab characters ('\t'). Ensure your editor inserts exactly 2 spaces per indentation level; otherwise, 'netplan generate' will fail with an indentation error.

Secure YAML File Permissions to 0600

Ubuntu issues security warnings if configuration files in '/etc/netplan/' are world-readable. Secure them immediately using 'sudo chmod 600 /etc/netplan/*.yaml'.

Ubuntu 22.04 LTS and 24.04 LTS

Ubuntu 22.04 LTS and 24.04 LTS deprecate 'gateway4' and 'gateway6'. Always use the 'routes' block with 'to: default' and 'via: <IP>' to future-proof configurations.

Common Gotchas & Troubleshooting

YAML syntax error: 'Invalid YAML: tabs are not allowed for indentation'

Replace all tabs with two spaces using 'sudo sed -i 's/\t/ /g' /etc/netplan/*.yaml' and test syntax with 'sudo netplan generate'.

SSH connection dropped and server becomes unreachable after applying Netplan

Connect via Out-of-Band (IPMI/KVM/Serial console), verify interface naming with 'ip link' (e.g. enp3s0 instead of eth0), and run 'sudo netplan --debug apply' to inspect failures.

DNS nameservers fail to resolve hostnames after applying configuration

Verify that systemd-resolved is active using 'systemctl status systemd-resolved' and confirm active upstream DNS servers with 'resolvectl status'.

Frequently Asked Questions

What is Ubuntu Netplan and why did it replace /etc/network/interfaces?▼

Netplan is Canonical's unified YAML-based network configuration abstraction layer introduced in Ubuntu 17.10. It centralizes network definitions and renders runtime configurations for either systemd-networkd (servers) or NetworkManager (desktops).

What is the key difference between 'renderer: networkd' and 'renderer: NetworkManager'?▼

'networkd' delegates management to systemd-networkd, which is lightweight and ideal for headless cloud instances, servers, and containers. 'NetworkManager' is tailored for desktop workstations requiring GUI control, Wi-Fi management, and dynamic VPN roaming.

Why does Ubuntu 22.04 and 24.04 show a warning for 'gateway4'?▼

Netplan core version 0.100 deprecated 'gateway4' and 'gateway6' in favor of the more flexible 'routes' schema. Modern Netplan configurations specify default gateways under 'routes: [{ to: default, via: <ip> }]' to support policy routing and route metrics.

How can I configure network bridge (br0) or bonding (bond0) for virtualization?▼

In your Netplan YAML, define top-level 'bridges' or 'bonds' keys. For a bridge, assign 'interfaces: [enp3s0]' and enable 'parameters: { stp: true }'. For bonding, specify member interfaces and aggregation mode such as 'mode: 802.3ad' (LACP).

Related Tools & Utilities

All Tools →