Netplan is an interesting abstraction to networking on Ubuntu Linux.

Pros: YAML, fairly straightforward, flexible.

Cons: One more Canonical-centric abstraction to manage.

Read more at https://netplan.io/

Netplan config file examples

Basic Static Network

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
---
network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: false
      addresses: [192.168.122.50/24]
      nameservers:
        addresses: [1.1.1.1]
      routes:
        - to: default
          via: 192.168.122.1
          metric: 100
          on-link: true

Bridge Network Setup - Static IP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
network:
    version: 2
    renderer: networkd
    ethernets:
        enp4s0:
            dhcp4: no
            dhcp6: no
    bridges:
        br0:
            addresses: [10.10.100.50/24]
            gateway4: 10.10.100.1
            nameservers:
                addresses: [10.10.100.1, 1.1.1.1]
            dhcp4: no
            dhcp6: no
            interfaces:
                - enp4s0