Here’s a sample /etc/netplan config for Ubuntu 18.04. HUGE LIFE PRO TIP: against all expectations of decency, netplan refuses to function if you don’t indent everything exactly the way it likes it and returns incomprehensible wharrgarbl errors like “mapping values are not allowed in this context, line 17, column 15” if you, for example, have a single extra space somewhere in the config.
I wish I was kidding.
Anyway, here’s a sample
/etc/netplan/01-config.yaml with a couple interfaces, one wired and static, one wireless and dynamic. Enjoy. And for the love of god, get the spacing exactly right; I really wasn’t kidding about it barfing if you have one too many spaces for a whitespace indent somewhere. Ask me how I know. >=\
If for any reason you have trouble reading this exact spacing, the rule is two spaces for each level of indent. So the v in “version” should line up under the t in “network”, the d in “dhcp4” should line up under the o in “eno1”, and so forth.
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eno1: dhcp4: no dhcp6: no addresses: [192.168.0.1/24] gateway4: 192.168.0.1 nameservers: addresses: [220.127.116.11, 18.104.22.168] wifis: wlp58s0: dhcp4: yes dhcp6: no access-points: "your-wifi-SSID-name": password: "your-wifi-password"
3 thoughts on “sample netplan config for ubuntu 18.04”
Wonderfully esoteric. But what is the indentation rule.? How many spaces, tabs, jumps, skips, flits? Or is it a secret?
An example with 2 x NICs statically assigned:
# Let NetworkManager manage all devices on this system
– to: 0.0.0.0/32
– to: 0.0.0.0/32
The last post didn’t show the indentation. Oh well. Can I send you the .yaml file so you can publish it?