NetPlan
Ubuntu 18.04 and up ships with NetPlan instead of the standard /etc/network/interfaces file. I found the documentation to be fairly scarce, so I'll leave a few examples and snippets here.
General
Be sure to apply / test changes with sudo netplan generate
and sudo netplany apply
For more up to date examples, see Canonical's documentation site: https://netplan.io/examples
Simple Static Host
---
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses: [ 192.168.1.100/24 ]
gateway4: 192.168.1.1
nameservers:
addresses: [ 192.168.1.1 ]
search: [ ljlapierre.com ]
Bridge / VLAN Config
---
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: no
vlans:
vl10:
id: 10
link: eno1
accept-ra: no
vl20:
id: 20
link: eno1
accept-ra: no
bridges:
brLAN:
addresses: [ 192.168.1.100/24 ]
gateway4: 192.168.1.1
nameservers:
search: [ ljlapierre.com ]
addresses: [ 192.168.1.1 ]
interfaces: [ vl10 ]
br20:
dhcp4: no
interfaces: [ vl20 ]