Categories
Linux

Cheatsheet: Netplan-Example containing IPv4 and IPv6 configuration

In the example below you can review a netplan using IPv4 as well as IPv6. We’ve replaced the addresses with casual IPs.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      # Disable DHCP
      dhcp4: no
      dhcp6: no
      # Address configuration - multiple addresses can be added by adding a line 
      addresses:
        - 192.168.1.123/24
        - 123:4567:ab12:3:192:168:1:123/64
      # Gateways
      gateway4: 192.168.1.1
      gateway6: 123:4567:ab12:3::1
      # Nameservers - again you can add multiple lines
      nameservers:
        addresses:
          - 192.168.1.1
          - 192.168.1.2
          - 123:4567:ab12:3:192:168:1:1
          - 123:4567:ab12:3:192:168:1:2

You can apply your netplan by using the following command:

sudo netplan apply

Leave a Reply

Your email address will not be published. Required fields are marked *