# Network Configuration Scenarios (Netplan)

Below are a collection of example Netplan configurations for common scenarios.

To configure the network, save the configuration file to the root folder of a USB stick with Enapter Linux Firmware with a .yaml extension (network.yaml), then insert it into the PC and reboot it.

Network YAML File On USB Stick

# Wi-Fi

Note

In the following configuration examples, please replace MyWifiSSID with your Wi-Fi network SSID and pa$$word with your network's password.

# Connecting to an open wireless network

network:
  version: 2
  renderer: NetworkManager
  wifis:
    wifi1:
      match:
        name: "*"
      dhcp4: yes
      access-points:
        "MyWifiSSID": {}

# Connecting to a WPA Personal wireless network

network:
  version: 2
  renderer: NetworkManager
  wifis:
    wifi1:
      match:
        name: "*"
      dhcp4: yes
      access-points:
        "MyWifiSSID":
          password: "pa$$word"

# Connecting to a WPA Personal wireless network (no DHCP)

Note

In the following configuration, all IP addresses provided as examples, please use your specific network's addresses instead.

network:
  version: 2
  renderer: NetworkManager
  wifis:
    wifi1:
      match:
        name: "*"
      dhcp4: no
      addresses:
        - 192.168.100.20/24
      nameservers:
        addresses:
          - 8.8.8.8
      routes:
        - to: default
          via: 192.168.100.1
      access-points:
        "MyWifiSSID":
          password: "pa$$word"

# Ethernets

Note

Some PCs and IPCs can have multiple Ethernet interfaces. In this case, specifying the full interface name is mandatory (e.g. eno1, enp1s0, enp1s1, enp4s0).

# Using DHCP

To configure only existing Ethernet interface without knowing its name to get an address via DHCP, create a YAML file with the following:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth1:
      match:
        name: en*
      dhcp4: yes

To let the specific interface (e.g. enp3s0) get an address via DHCP, create a YAML file with the following:

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

# Static addressing

Note

In the following configuration all IP addresses provided as examples, please use your specific network's addresses instead.

To configure only existing ethernet interface with static IP address, create a YAML file with the following:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth1:
      match:
        name: en*
      dhcp4: no
      addresses:
        - 192.168.100.20/24
      nameservers:
        addresses:
          - 8.8.8.8
      routes:
        - to: default
          via: 192.168.100.1

# LTE Modem

# Setup internet connection via LTE modem

Note

In the following configuration, please replace PIN with your SIM card's PIN and web.vodafone.de APN with your mobile network operator's APN.

network:
  version: 2
  renderer: NetworkManager
  modems:
    lte_modem:
      match:
        name: cdc-wdm*
      apn: web.vodafone.de
      dhcp4: true
      pin: 1234

# Complex example

This is a complex example which shows most available features.

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp3s0:
      wakeonlan: true
      dhcp4: true
      addresses:
        - 192.168.14.2/24
        - 192.168.14.3/24
        - '2001:1::1/64'
      nameservers:
        search:
          - foo.local
          - bar.local
        addresses:
          - 8.8.8.8
      routes:
        - to: default
          via: 192.168.14.1
        - to: default
          via: '2001:1::2'
        - to: 0.0.0.0/0
          via: 11.0.0.1
          table: 70
          on-link: true
          metric: 3
      routing-policy:
        - to: 10.0.0.0/8
          from: 192.168.14.2/24
          table: 70
          priority: 100
        - to: 20.0.0.0/8
          from: 192.168.14.3/24
          table: 70
          priority: 50
  wifis:
    all-wlans:
      match: "*"
      access-points:
        "Enapter":
          password: "pa$$word"
    wlp1s0:
      access-points:
        guest:
          mode: ap

# More examples

For more examples, please see the examples folder in the official GitHub repository of netplan (opens new window).

Enapter Linux uses NetworkManager for managing network configuration. This means some examples will need to be adapted to work properly on Enapter Linux by replacing renderer: networkd with renderer: NetworkManager.