Netplan: Difference between revisions

From Omnia
Jump to navigation Jump to search
Line 2: Line 2:


  /etc/netplan/01-netcfg.yaml
  /etc/netplan/01-netcfg.yaml
<pre>
network:
  ethernets:
    ens18:
      dhcp4: true
  version: 2
</pre>


  sudo netplan apply
  sudo netplan apply
Line 7: Line 14:
  sudo netplan --debug apply
  sudo netplan --debug apply
   # note "apply --debug" does not work
   # note "apply --debug" does not work
networkctl
<pre>
IDX LINK  TYPE    OPERATIONAL SETUP
  1 lo    loopback carrier    unmanaged
  2 ens18 ether    routable    configured
2 links listed.
</pre>


== examples ==
== examples ==

Revision as of 19:55, 4 February 2024

config

/etc/netplan/01-netcfg.yaml
network:
  ethernets:
    ens18:
      dhcp4: true
  version: 2
sudo netplan apply
sudo netplan --debug apply
  # note "apply --debug" does not work
networkctl
IDX LINK  TYPE     OPERATIONAL SETUP
  1 lo    loopback carrier     unmanaged
  2 ens18 ether    routable    configured

2 links listed.

examples

https://github.com/canonical/netplan/tree/main/examples

static

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses:
        - 10.10.10.2/24
      nameservers:
        search: [mydomain, otherdomain]
        addresses: [10.10.10.1, 1.1.1.1]
      routes: 
        - to: default
          via: 10.10.10.1

ref: https://github.com/canonical/netplan/blob/main/examples/static.yaml

dhcp

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true

ref: https://github.com/canonical/netplan/blob/main/examples/dhcp.yaml