From 704c56f361b1616fa74616648fa61bbf86325432 Mon Sep 17 00:00:00 2001 From: akutz Date: Wed, 13 Nov 2024 09:59:32 -0600 Subject: [PATCH] Support for full netplan spec This patch adds support for the complete netplan specification. --- .github/workflows/ci.yml | 2 +- .golangci.yml | 1 + Makefile | 1 + hack/quicktype/.gitignore | 2 + hack/quicktype/Dockerfile | 14 + hack/quicktype/Makefile | 145 + .../quicktype}/package-lock.json | 0 .../schema => hack/quicktype}/package.json | 0 pkg/providers/vsphere/constants/constants.go | 2 +- pkg/providers/vsphere/network/netplan.go | 102 +- pkg/providers/vsphere/network/netplan_test.go | 66 +- .../vmlifecycle/bootstrap_cloudinit.go | 5 +- .../vmlifecycle/bootstrap_cloudinit_test.go | 15 +- pkg/util/cloudinit/schema/.gitignore | 1 - .../cloudinit/schema/Dockerfile.quicktype | 18 - pkg/util/cloudinit/schema/Makefile | 130 +- pkg/util/cloudinit/schema/README.md | 2 +- pkg/util/netplan/netplan.go | 38 + pkg/util/netplan/netplan_suite_test.go | 16 + pkg/util/netplan/netplan_test.go | 216 + pkg/util/netplan/schema/.gitignore | 1 + pkg/util/netplan/schema/Dockerfile | 17 + pkg/util/netplan/schema/Makefile | 30 + pkg/util/netplan/schema/README.md | 15 + pkg/util/netplan/schema/main.rs | 7 + pkg/util/netplan/schema/netplan.go | 2159 ++++++++++ pkg/util/netplan/schema/schema.json | 3536 +++++++++++++++++ 27 files changed, 6298 insertions(+), 243 deletions(-) create mode 100644 hack/quicktype/.gitignore create mode 100644 hack/quicktype/Dockerfile create mode 100644 hack/quicktype/Makefile rename {pkg/util/cloudinit/schema => hack/quicktype}/package-lock.json (100%) rename {pkg/util/cloudinit/schema => hack/quicktype}/package.json (100%) delete mode 100644 pkg/util/cloudinit/schema/.gitignore delete mode 100644 pkg/util/cloudinit/schema/Dockerfile.quicktype create mode 100644 pkg/util/netplan/netplan.go create mode 100644 pkg/util/netplan/netplan_suite_test.go create mode 100644 pkg/util/netplan/netplan_test.go create mode 100644 pkg/util/netplan/schema/.gitignore create mode 100644 pkg/util/netplan/schema/Dockerfile create mode 100644 pkg/util/netplan/schema/Makefile create mode 100644 pkg/util/netplan/schema/README.md create mode 100644 pkg/util/netplan/schema/main.rs create mode 100644 pkg/util/netplan/schema/netplan.go create mode 100644 pkg/util/netplan/schema/schema.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a93a979cd..ff3f317fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: with: node-version: '20' cache: 'npm' - cache-dependency-path: 'pkg/util/cloudinit/schema/package-lock.json' + cache-dependency-path: 'hack/quicktype/package-lock.json' - name: Install Go uses: actions/setup-go@v5 with: diff --git a/.golangci.yml b/.golangci.yml index f19564f8f..e01cea44d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -186,6 +186,7 @@ issues: exclude-dirs: - external - pkg/util/cloudinit/schema + - pkg/util/netplan/schema exclude-files: - ".*generated.*\\.go" exclude: diff --git a/Makefile b/Makefile index d58f9c065..32808b0aa 100644 --- a/Makefile +++ b/Makefile @@ -351,6 +351,7 @@ generate-go: ## Generate golang sources paths=github.com/vmware-tanzu/vm-operator/external/capabilities/... \ object:headerFile=./hack/boilerplate/boilerplate.generatego.txt $(MAKE) -C ./pkg/util/cloudinit/schema $@ + $(MAKE) -C ./pkg/util/netplan/schema $@ .PHONY: generate-manifests generate-manifests: $(CONTROLLER_GEN) diff --git a/hack/quicktype/.gitignore b/hack/quicktype/.gitignore new file mode 100644 index 000000000..2e64a5089 --- /dev/null +++ b/hack/quicktype/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +.receipt-* \ No newline at end of file diff --git a/hack/quicktype/Dockerfile b/hack/quicktype/Dockerfile new file mode 100644 index 000000000..f2de3afb1 --- /dev/null +++ b/hack/quicktype/Dockerfile @@ -0,0 +1,14 @@ +# Copyright (c) 2024 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +ARG BASE_IMAGE_BUILD=node:22 +ARG BASE_IMAGE_WORK=gcr.io/distroless/nodejs22-debian12 + +FROM ${BASE_IMAGE_BUILD} AS build +WORKDIR /quicktype +COPY package.json package-lock.json* ./ +RUN npm ci --prefix /quicktype quicktype + +FROM ${BASE_IMAGE_WORK} +COPY --from=build /quicktype /quicktype +WORKDIR /output diff --git a/hack/quicktype/Makefile b/hack/quicktype/Makefile new file mode 100644 index 000000000..aa20094e8 --- /dev/null +++ b/hack/quicktype/Makefile @@ -0,0 +1,145 @@ +# Copyright (c) 2024 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Required vars +SCHEMA_IN ?= +OUTPUT_GO ?= +TOOLS_DIR ?= +QUICK_DIR ?= +START_TYP ?= + +# If you update this file, please follow +# https://suva.sh/posts/well-documented-makefiles + +# Ensure Make is run with bash shell as some syntax below is bash-specific +SHELL := /usr/bin/env bash + +.DEFAULT_GOAL := help + +# Get the information about the platform on which the tools are built/run. +GOHOSTOS := $(shell go env GOHOSTOS) +GOHOSTARCH := $(shell go env GOHOSTARCH) +GOHOSTOSARCH := $(GOHOSTOS)_$(GOHOSTARCH) + +# Directories. +TOOLS_BIN_DIR := $(TOOLS_DIR)/bin/$(GOHOSTOSARCH) +export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) + +# Binaries. +QUICKTYPE := $(QUICK_DIR)/node_modules/.bin/quicktype +GOIMPORTS := $(TOOLS_BIN_DIR)/goimports + +# Images. +BASE_IMAGE_BUILD ?= node:22 +BASE_IMAGE_WORK ?= gcr.io/distroless/nodejs22-debian12 +QUICKTYPE_IMAGE_NAME := vmop-quicktype +QUICKTYPE_IMAGE_VERSION := latest +QUICKTYPE_IMAGE ?= $(QUICKTYPE_IMAGE_NAME):$(QUICKTYPE_IMAGE_VERSION) +QUICKTYPE_IMAGE_RECEIPT := $(abspath $(QUICK_DIR)/.receipt-$(QUICKTYPE_IMAGE_NAME)-$(shell echo '$(BASE_IMAGE_BUILD)-$(BASE_IMAGE_WORK)' | md5sum | awk '{print $$1}')) + +# CRI_BIN is the path to the container runtime binary. +ifeq (,$(strip $(GITHUB_RUN_ID))) +# Prefer podman locally. +CRI_BIN := $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null) +else +# Prefer docker in GitHub actions. +CRI_BIN := $(shell command -v docker 2>/dev/null || command -v podman 2>/dev/null) +endif +export CRI_BIN + +# Select how to run quicktype. +QUICKTYPE_METHOD ?= local +ifeq (local,$(QUICKTYPE_METHOD)) +ifeq (,$(shell command -v npm)) +QUICKTYPE_METHOD ?= container +endif +endif + +# Tooling binaries +GOIMPORTS := $(TOOLS_BIN_DIR)/goimports + + +## -------------------------------------- +## Help +## -------------------------------------- + +help: ## Display this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + + +## -------------------------------------- +## Tooling Binaries +## -------------------------------------- + +TOOLING_BINARIES := $(GOIMPORTS) +tools: $(TOOLING_BINARIES) ## Build tooling binaries +$(TOOLING_BINARIES): + make -C $(TOOLS_DIR) $(@F) + + +## -------------------------------------- +## Image +## -------------------------------------- + +$(QUICKTYPE_IMAGE_RECEIPT): + $(CRI_BIN) build \ + --build-arg "BASE_IMAGE_BUILD=$(BASE_IMAGE_BUILD)" \ + --build-arg "BASE_IMAGE_WORK=$(BASE_IMAGE_WORK)" \ + -t $(QUICKTYPE_IMAGE) \ + -f $(abspath $(QUICK_DIR)/Dockerfile) \ + $(abspath $(QUICK_DIR)) + touch $(QUICKTYPE_IMAGE_RECEIPT) +image-build-quicktype: $(QUICKTYPE_IMAGE_RECEIPT) + + +## -------------------------------------- +## Binaries +## -------------------------------------- + +quicktype: $(QUICKTYPE) +$(QUICKTYPE): $(QUICK_DIR)/package.json + cd $(QUICK_DIR) && npm ci --user quicktype + + +## -------------------------------------- +## Generate +## -------------------------------------- + +generate-schema: $(SCHEMA_IN) +generate-schema: ## Generate the schema + +$(OUTPUT_GO): $(SCHEMA_IN) | $(GOIMPORTS) +ifeq (local,$(QUICKTYPE_METHOD)) +$(OUTPUT_GO): | $(QUICKTYPE) + $(QUICKTYPE) \ + --src $(SCHEMA_IN) --src-lang schema \ + --out $@ --lang go --package schema \ + --top-level $(START_TYP) + $(GOIMPORTS) -w $@ +else +$(OUTPUT_GO): | $(QUICKTYPE_IMAGE_RECEIPT) + $(CRI_BIN) run -it --rm \ + -v $$(pwd):/output \ + -v $(abspath $(SCHEMA_IN)):/schema.json \ + $(QUICKTYPE_IMAGE) \ + /quicktype/node_modules/quicktype/dist/index.js \ + --src /schema.json \ + --src-lang schema \ + --out /output/schema.go \ + --lang go \ + --package schema \ + --top-level $(START_TYP) + mv -f schema.go $@ + $(GOIMPORTS) -w $@ +endif + +generate-go: $(OUTPUT_GO) +generate-go: ## Generate the go source code from the schema + +## -------------------------------------- +## Cleanup +## -------------------------------------- + +.PHONY: clean +clean: ## Run all the clean targets + rm -f $(SCHEMA_IN) $(OUTPUT_GO) $(QUICKTYPE_IMAGE_RECEIPT) diff --git a/pkg/util/cloudinit/schema/package-lock.json b/hack/quicktype/package-lock.json similarity index 100% rename from pkg/util/cloudinit/schema/package-lock.json rename to hack/quicktype/package-lock.json diff --git a/pkg/util/cloudinit/schema/package.json b/hack/quicktype/package.json similarity index 100% rename from pkg/util/cloudinit/schema/package.json rename to hack/quicktype/package.json diff --git a/pkg/providers/vsphere/constants/constants.go b/pkg/providers/vsphere/constants/constants.go index 0fdf9ccba..220a4462e 100644 --- a/pkg/providers/vsphere/constants/constants.go +++ b/pkg/providers/vsphere/constants/constants.go @@ -49,7 +49,7 @@ const ( // NetPlanVersion points to the version used for Network config. // For more information, please see https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html - NetPlanVersion = 2 + NetPlanVersion = int64(2) PCIPassthruMMIOOverrideAnnotation = pkg.VMOperatorKey + "/pci-passthru-64bit-mmio-size" PCIPassthruMMIOExtraConfigKey = "pciPassthru.use64bitMMIO" //nolint:gosec diff --git a/pkg/providers/vsphere/network/netplan.go b/pkg/providers/vsphere/network/netplan.go index b4e9676cb..0d5f87e7f 100644 --- a/pkg/providers/vsphere/network/netplan.go +++ b/pkg/providers/vsphere/network/netplan.go @@ -7,87 +7,75 @@ import ( "strings" "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/constants" + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan" + "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" ) -// Netplan representation described in https://via.vmw.com/cloud-init-netplan // FIXME: 404. -type Netplan struct { - Version int `json:"version,omitempty"` - Ethernets map[string]NetplanEthernet `json:"ethernets,omitempty"` -} - -type NetplanEthernet struct { - Match NetplanEthernetMatch `json:"match,omitempty"` - SetName string `json:"set-name,omitempty"` - Dhcp4 bool `json:"dhcp4,omitempty"` - Dhcp6 bool `json:"dhcp6,omitempty"` - Addresses []string `json:"addresses,omitempty"` - Gateway4 string `json:"gateway4,omitempty"` - Gateway6 string `json:"gateway6,omitempty"` - MTU int64 `json:"mtu,omitempty"` - Nameservers NetplanEthernetNameserver `json:"nameservers,omitempty"` - Routes []NetplanEthernetRoute `json:"routes,omitempty"` -} - -type NetplanEthernetMatch struct { - MacAddress string `json:"macaddress,omitempty"` -} - -type NetplanEthernetNameserver struct { - Addresses []string `json:"addresses,omitempty"` - Search []string `json:"search,omitempty"` -} - -type NetplanEthernetRoute struct { - To string `json:"to"` - Via string `json:"via"` - Metric int32 `json:"metric,omitempty"` -} - -func NetPlanCustomization(result NetworkInterfaceResults) (*Netplan, error) { - netPlan := &Netplan{ +func NetPlanCustomization(result NetworkInterfaceResults) (*netplan.Network, error) { + netPlan := &netplan.Network{ Version: constants.NetPlanVersion, - Ethernets: make(map[string]NetplanEthernet), + Ethernets: make(map[string]netplan.Ethernet), } for _, r := range result.Results { - npEth := NetplanEthernet{ - Match: NetplanEthernetMatch{ - MacAddress: NormalizeNetplanMac(r.MacAddress), + npEth := netplan.Ethernet{ + Match: &netplan.Match{ + Macaddress: ptr.To(NormalizeNetplanMac(r.MacAddress)), }, - SetName: r.GuestDeviceName, - MTU: r.MTU, - Nameservers: NetplanEthernetNameserver{ + SetName: &r.GuestDeviceName, + MTU: &r.MTU, + Nameservers: &netplan.Nameserver{ Addresses: r.Nameservers, Search: r.SearchDomains, }, } - npEth.Dhcp4 = r.DHCP4 - npEth.Dhcp6 = r.DHCP6 + npEth.Dhcp4 = &r.DHCP4 + npEth.Dhcp6 = &r.DHCP6 - if !npEth.Dhcp4 { - for _, ipConfig := range r.IPConfigs { + if !*npEth.Dhcp4 { + for i := range r.IPConfigs { + ipConfig := r.IPConfigs[i] if ipConfig.IsIPv4 { - if npEth.Gateway4 == "" { - npEth.Gateway4 = ipConfig.Gateway + if npEth.Gateway4 == nil || *npEth.Gateway4 == "" { + npEth.Gateway4 = &ipConfig.Gateway } - npEth.Addresses = append(npEth.Addresses, ipConfig.IPCIDR) + npEth.Addresses = append( + npEth.Addresses, + netplan.Address{ + String: &ipConfig.IPCIDR, + }, + ) } } } - if !npEth.Dhcp6 { - for _, ipConfig := range r.IPConfigs { + if !*npEth.Dhcp6 { + for i := range r.IPConfigs { + ipConfig := r.IPConfigs[i] if !ipConfig.IsIPv4 { - if npEth.Gateway6 == "" { - npEth.Gateway6 = ipConfig.Gateway + if npEth.Gateway6 == nil || *npEth.Gateway6 == "" { + npEth.Gateway6 = &ipConfig.Gateway } - npEth.Addresses = append(npEth.Addresses, ipConfig.IPCIDR) + npEth.Addresses = append( + npEth.Addresses, + netplan.Address{ + String: &ipConfig.IPCIDR, + }, + ) } } } - for _, route := range r.Routes { - npEth.Routes = append(npEth.Routes, NetplanEthernetRoute(route)) + for i := range r.Routes { + route := r.Routes[i] + npEth.Routes = append( + npEth.Routes, + netplan.Route{ + To: &route.To, + Metric: ptr.To(int64(route.Metric)), + Via: &route.Via, + }, + ) } netPlan.Ethernets[r.Name] = npEth diff --git a/pkg/providers/vsphere/network/netplan_test.go b/pkg/providers/vsphere/network/netplan_test.go index 5e93d35b3..3610030db 100644 --- a/pkg/providers/vsphere/network/netplan_test.go +++ b/pkg/providers/vsphere/network/netplan_test.go @@ -11,6 +11,8 @@ import ( "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/constants" "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/network" + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan" + "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" ) var _ = Describe("Netplan", func() { @@ -33,17 +35,17 @@ var _ = Describe("Netplan", func() { var ( results network.NetworkInterfaceResults - netplan *network.Netplan + config *netplan.Network err error ) BeforeEach(func() { results.Results = nil - netplan = nil + config = nil }) JustBeforeEach(func() { - netplan, err = network.NetPlanCustomization(results) + config, err = network.NetPlanCustomization(results) }) Context("IPv4/6 Static adapter", func() { @@ -83,30 +85,30 @@ var _ = Describe("Netplan", func() { It("returns success", func() { Expect(err).ToNot(HaveOccurred()) - Expect(netplan).ToNot(BeNil()) - Expect(netplan.Version).To(Equal(constants.NetPlanVersion)) + Expect(config).ToNot(BeNil()) + Expect(config.Version).To(Equal(constants.NetPlanVersion)) - Expect(netplan.Ethernets).To(HaveLen(1)) - Expect(netplan.Ethernets).To(HaveKey(ifName)) + Expect(config.Ethernets).To(HaveLen(1)) + Expect(config.Ethernets).To(HaveKey(ifName)) - np := netplan.Ethernets[ifName] - Expect(np.Match.MacAddress).To(Equal(macAddr1Norm)) - Expect(np.SetName).To(Equal(guestDevName)) - Expect(np.Dhcp4).To(BeFalse()) - Expect(np.Dhcp6).To(BeFalse()) + np := config.Ethernets[ifName] + Expect(*np.Match.Macaddress).To(Equal(macAddr1Norm)) + Expect(*np.SetName).To(Equal(guestDevName)) + Expect(*np.Dhcp4).To(BeFalse()) + Expect(*np.Dhcp6).To(BeFalse()) Expect(np.Addresses).To(HaveLen(2)) - Expect(np.Addresses[0]).To(Equal(ipv4CIDR)) - Expect(np.Addresses[1]).To(Equal(ipv6 + fmt.Sprintf("/%d", ipv6Subnet))) - Expect(np.Gateway4).To(Equal(ipv4Gateway)) - Expect(np.Gateway6).To(Equal(ipv6Gateway)) - Expect(np.MTU).To(BeEquivalentTo(1500)) + Expect(np.Addresses[0]).To(Equal(netplan.Address{String: ptr.To(ipv4CIDR)})) + Expect(np.Addresses[1]).To(Equal(netplan.Address{String: ptr.To(ipv6 + fmt.Sprintf("/%d", ipv6Subnet))})) + Expect(*np.Gateway4).To(Equal(ipv4Gateway)) + Expect(*np.Gateway6).To(Equal(ipv6Gateway)) + Expect(*np.MTU).To(BeEquivalentTo(1500)) Expect(np.Nameservers.Addresses).To(Equal([]string{dnsServer1})) Expect(np.Nameservers.Search).To(Equal([]string{searchDomain1})) Expect(np.Routes).To(HaveLen(1)) route := np.Routes[0] - Expect(route.To).To(Equal("185.107.56.59")) - Expect(route.Via).To(Equal("10.1.1.1")) - Expect(route.Metric).To(BeEquivalentTo(42)) + Expect(*route.To).To(Equal("185.107.56.59")) + Expect(*route.Via).To(Equal("10.1.1.1")) + Expect(*route.Metric).To(BeEquivalentTo(42)) }) }) @@ -128,18 +130,18 @@ var _ = Describe("Netplan", func() { It("returns success", func() { Expect(err).ToNot(HaveOccurred()) - Expect(netplan).ToNot(BeNil()) - Expect(netplan.Version).To(Equal(constants.NetPlanVersion)) - - Expect(netplan.Ethernets).To(HaveLen(1)) - Expect(netplan.Ethernets).To(HaveKey(ifName)) - - np := netplan.Ethernets[ifName] - Expect(np.Match.MacAddress).To(Equal(macAddr1Norm)) - Expect(np.SetName).To(Equal(guestDevName)) - Expect(np.Dhcp4).To(BeTrue()) - Expect(np.Dhcp6).To(BeTrue()) - Expect(np.MTU).To(BeEquivalentTo(9000)) + Expect(config).ToNot(BeNil()) + Expect(config.Version).To(Equal(constants.NetPlanVersion)) + + Expect(config.Ethernets).To(HaveLen(1)) + Expect(config.Ethernets).To(HaveKey(ifName)) + + np := config.Ethernets[ifName] + Expect(*np.Match.Macaddress).To(Equal(macAddr1Norm)) + Expect(*np.SetName).To(Equal(guestDevName)) + Expect(*np.Dhcp4).To(BeTrue()) + Expect(*np.Dhcp6).To(BeTrue()) + Expect(*np.MTU).To(BeEquivalentTo(9000)) Expect(np.Nameservers.Addresses).To(Equal([]string{dnsServer1})) Expect(np.Nameservers.Search).To(Equal([]string{searchDomain1})) Expect(np.Routes).To(BeEmpty()) diff --git a/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit.go b/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit.go index a1fe87e00..46f6054ae 100644 --- a/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit.go +++ b/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit.go @@ -18,13 +18,14 @@ import ( "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/network" pkgutil "github.com/vmware-tanzu/vm-operator/pkg/util" "github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit" + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan" ) type CloudInitMetadata struct { InstanceID string `json:"instance-id,omitempty"` LocalHostname string `json:"local-hostname,omitempty"` Hostname string `json:"hostname,omitempty"` - Network network.Netplan `json:"network,omitempty"` + Network netplan.Network `json:"network,omitempty"` PublicKeys string `json:"public-keys,omitempty"` } @@ -160,7 +161,7 @@ func BootStrapCloudInit( func GetCloudInitMetadata( instanceID, hostName, domainName string, - netplan *network.Netplan, + netplan *netplan.Network, sshPublicKeys string) (string, error) { fqdn := hostName diff --git a/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit_test.go b/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit_test.go index 5e7447267..c0a89251a 100644 --- a/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit_test.go +++ b/pkg/providers/vsphere/vmlifecycle/bootstrap_cloudinit_test.go @@ -20,10 +20,11 @@ import ( pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/constants" "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/internal" - "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/network" "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vmlifecycle" pkgutil "github.com/vmware-tanzu/vm-operator/pkg/util" "github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit" + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan" + "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" ) var _ = Describe("CloudInit Bootstrap", func() { @@ -288,7 +289,7 @@ var _ = Describe("CloudInit Bootstrap", func() { uid string hostName string domainName string - netPlan *network.Netplan + netPlan *netplan.Network sshPublicKeys string mdYaml string @@ -299,11 +300,11 @@ var _ = Describe("CloudInit Bootstrap", func() { uid = "my-uid" hostName = "my-hostname" domainName = "" - netPlan = &network.Netplan{ + netPlan = &netplan.Network{ Version: 42, - Ethernets: map[string]network.NetplanEthernet{ + Ethernets: map[string]netplan.Ethernet{ "eth0": { - SetName: "eth0", + SetName: ptr.To("eth0"), }, }, } @@ -328,7 +329,7 @@ var _ = Describe("CloudInit Bootstrap", func() { Expect(ciMetadata.InstanceID).To(Equal(uid)) Expect(ciMetadata.Hostname).To(Equal(hostName)) Expect(ciMetadata.PublicKeys).To(Equal(sshPublicKeys)) - Expect(ciMetadata.Network.Version).To(Equal(42)) + Expect(ciMetadata.Network.Version).To(BeEquivalentTo(42)) Expect(ciMetadata.Network.Ethernets).To(HaveKey("eth0")) }) }) @@ -347,7 +348,7 @@ var _ = Describe("CloudInit Bootstrap", func() { Expect(ciMetadata.InstanceID).To(Equal(uid)) Expect(ciMetadata.Hostname).To(Equal(hostName + "." + domainName)) Expect(ciMetadata.PublicKeys).To(Equal(sshPublicKeys)) - Expect(ciMetadata.Network.Version).To(Equal(42)) + Expect(ciMetadata.Network.Version).To(BeEquivalentTo(42)) Expect(ciMetadata.Network.Ethernets).To(HaveKey("eth0")) }) }) diff --git a/pkg/util/cloudinit/schema/.gitignore b/pkg/util/cloudinit/schema/.gitignore deleted file mode 100644 index 30bc16279..000000000 --- a/pkg/util/cloudinit/schema/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules \ No newline at end of file diff --git a/pkg/util/cloudinit/schema/Dockerfile.quicktype b/pkg/util/cloudinit/schema/Dockerfile.quicktype deleted file mode 100644 index 543e84c01..000000000 --- a/pkg/util/cloudinit/schema/Dockerfile.quicktype +++ /dev/null @@ -1,18 +0,0 @@ -FROM node:20 AS build -WORKDIR /quicktype - -COPY package.json package-lock.json* ./ -RUN npm ci --prefix /quicktype quicktype - -FROM gcr.io/distroless/nodejs20-debian12 -COPY --from=build /quicktype /quicktype - -WORKDIR /output -CMD [ \ - "/quicktype/node_modules/quicktype/dist/index.js", \ - "--src", "/schema-cloud-config-v1.json", \ - "--src-lang", "schema", \ - "--out", "/output/cloudconfig.go", \ - "--lang", "go", \ - "--package", "schema" \ -] diff --git a/pkg/util/cloudinit/schema/Makefile b/pkg/util/cloudinit/schema/Makefile index 8f1cba112..90ee15d6a 100644 --- a/pkg/util/cloudinit/schema/Makefile +++ b/pkg/util/cloudinit/schema/Makefile @@ -1,126 +1,10 @@ -# Copyright (c) 2023 VMware, Inc. All Rights Reserved. +# Copyright (c) 2024-2023 VMware, Inc. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -# If you update this file, please follow -# https://suva.sh/posts/well-documented-makefiles +TOOLS_DIR := ../../../../hack/tools +SCHEMA_IN := schema-cloud-config-v1.json +OUTPUT_GO := cloudconfig.go +QUICK_DIR := ../../../../hack/quicktype +START_TYP := Cloudconfig -# Ensure Make is run with bash shell as some syntax below is bash-specific -SHELL := /usr/bin/env bash - -.DEFAULT_GOAL := help - -# Get the information about the platform on which the tools are built/run. -GOHOSTOS := $(shell go env GOHOSTOS) -GOHOSTARCH := $(shell go env GOHOSTARCH) -GOHOSTOSARCH := $(GOHOSTOS)_$(GOHOSTARCH) - -# Directories. -BIN_DIR := bin -TOOLS_DIR := ../../../../hack/tools -TOOLS_BIN_DIR := $(TOOLS_DIR)/bin/$(GOHOSTOSARCH) -export PATH := $(abspath $(BIN_DIR)):$(abspath $(TOOLS_BIN_DIR)):$(PATH) - -# Binaries. -QUICKTYPE := node_modules/.bin/quicktype -GOIMPORTS := $(TOOLS_BIN_DIR)/goimports - -# Schemas. -SCHEMA_CLOUD_CONFIG := schema-cloud-config-v1.json - -# Output. -CLOUD_CONFIG_GO := cloudconfig.go - -# Images. -QUICKTYPE_IMAGE_NAME := vm-op-quicktype -QUICKTYPE_IMAGE_VERSION := latest -QUICKTYPE_IMAGE ?= $(QUICKTYPE_IMAGE_NAME):$(QUICKTYPE_IMAGE_VERSION) - -# Select how to run quicktype. -ifeq (,$(shell command -v npm)) -QUICKTYPE_METHOD ?= docker -endif - -# Binaries -MANAGER := $(BIN_DIR)/manager -WEB_CONSOLE_VALIDATOR := $(BIN_DIR)/web-console-validator - -# Tooling binaries -GOIMPORTS := $(TOOLS_BIN_DIR)/goimports - - -## -------------------------------------- -## Help -## -------------------------------------- - -help: ## Display this help - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - - -## -------------------------------------- -## Tooling Binaries -## -------------------------------------- - -TOOLING_BINARIES := $(GOIMPORTS) -tools: $(TOOLING_BINARIES) ## Build tooling binaries -$(TOOLING_BINARIES): - make -C $(TOOLS_DIR) $(@F) - - -## -------------------------------------- -## Image -## -------------------------------------- - -.PHONY: build-images-quicktype -build-images-quicktype: - docker build -t $(QUICKTYPE_IMAGE) -f Dockerfile.quicktype . - -.PHONY: build-images -build-images: ## Build the docker images - $(MAKE) build-images-quicktype - - -## -------------------------------------- -## Binaries -## -------------------------------------- - -quicktype: $(QUICKTYPE) ## Install quicktype -$(QUICKTYPE): package.json - npm ci --user quicktype - - -## -------------------------------------- -## Generate -## -------------------------------------- - -$(CLOUD_CONFIG_GO): $(SCHEMA_CLOUD_CONFIG) | $(GOIMPORTS) -ifeq (docker,$(QUICKTYPE_METHOD)) -$(CLOUD_CONFIG_GO): build-images-quicktype - docker run -it --rm \ - -v $$(pwd):/output \ - -v $$(pwd)/$(SCHEMA_CLOUD_CONFIG):/schema-cloud-config-v1.json \ - $(QUICKTYPE_IMAGE) - $(GOIMPORTS) -w $@ -else -$(CLOUD_CONFIG_GO): | $(QUICKTYPE) - $(QUICKTYPE) \ - --src $(SCHEMA_CLOUD_CONFIG) --src-lang schema \ - --out $@ --lang go --package schema - $(GOIMPORTS) -w $@ -endif - -generate-go: ## Generate the go source code from the schemas - $(MAKE) $(CLOUD_CONFIG_GO) - - -## -------------------------------------- -## Cleanup -## -------------------------------------- - -.PHONY: clean -clean: ## Run all the clean targets - rm -f cloudconfig.go - -.PHONY: clobber -clobber: ## Remove all of the tooling as well - $(MAKE) clean - rm -fr $(BIN_DIR) +include $(QUICK_DIR)/Makefile diff --git a/pkg/util/cloudinit/schema/README.md b/pkg/util/cloudinit/schema/README.md index e47d045b4..2b420de0a 100644 --- a/pkg/util/cloudinit/schema/README.md +++ b/pkg/util/cloudinit/schema/README.md @@ -12,4 +12,4 @@ This directory contains schema files relates to Cloud-Init: ## Generating the Go source code -Run `make generate-go`. If the local system has `npm`, it is used to install `quicktype`, which is then used to generate `cloudconfig.go` from the schema. Otherwise a container image is built from `Dockerfile.quicktype` which is then used to generate the Go source code. +Run `make generate-go` to generate the Go source code. If the local system has `npm`, it is used, otherwise a container image is used with either Docker or Podman. diff --git a/pkg/util/netplan/netplan.go b/pkg/util/netplan/netplan.go new file mode 100644 index 000000000..670f3fd3f --- /dev/null +++ b/pkg/util/netplan/netplan.go @@ -0,0 +1,38 @@ +// Copyright (c) 2024 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package netplan + +import ( + "sigs.k8s.io/yaml" + + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan/schema" +) + +// Config describes the desired network configuration from +// https://netplan.readthedocs.io/en/stable/netplan-yaml/. +type Config = schema.Config + +type Network = schema.NetworkConfig + +type Ethernet = schema.EthernetConfig + +type Match = schema.MatchConfig + +type Nameserver = schema.NameserverConfig + +type Route = schema.RoutingConfig + +type Address = schema.AddressMapping + +type Renderer = schema.Renderer + +func MarshalYAML(in Config) ([]byte, error) { + return yaml.Marshal(in) +} + +func UnmarshalYAML(data []byte) (Config, error) { + var out Config + err := yaml.Unmarshal(data, &out) + return out, err +} diff --git a/pkg/util/netplan/netplan_suite_test.go b/pkg/util/netplan/netplan_suite_test.go new file mode 100644 index 000000000..55b3967f4 --- /dev/null +++ b/pkg/util/netplan/netplan_suite_test.go @@ -0,0 +1,16 @@ +// Copyright (c) 2024 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package netplan_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestNetplan(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Netplan Suite") +} diff --git a/pkg/util/netplan/netplan_test.go b/pkg/util/netplan/netplan_test.go new file mode 100644 index 000000000..7d7787027 --- /dev/null +++ b/pkg/util/netplan/netplan_test.go @@ -0,0 +1,216 @@ +// Copyright (c) 2024 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package netplan_test + +import ( + "github.com/google/go-cmp/cmp" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan" + "github.com/vmware-tanzu/vm-operator/pkg/util/netplan/schema" + "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" +) + +var _ = DescribeTable("MarshalYAML", + func(expYAML string, in netplan.Config, expErr error) { + // Marshal + data, err := netplan.MarshalYAML(in) + if expErr != nil { + Expect(err).To(HaveOccurred()) + Expect(err).To(MatchError(expErr)) + } else { + Expect(err).ToNot(HaveOccurred()) + Expect(string(data)).To(MatchYAML(expYAML)) + } + }, + Entry( + "single static ip", + netplanSingleStaticIP, + netplan.Config{ + Network: netplan.Network{ + Version: 2, + Renderer: ptr.To(netplan.Renderer("networkd")), + Ethernets: map[string]netplan.Ethernet{ + "enp3s0": { + Addresses: []netplan.Address{ + { + String: ptr.To("10.10.10.2/24"), + }, + }, + }, + }, + }, + }, + nil, + ), + + Entry( + "single dhcp4 ip", + netplanSingleDHCP4IPBoolTrueFalse, + netplan.Config{ + Network: netplan.Network{ + Version: 2, + Renderer: ptr.To(netplan.Renderer("networkd")), + Ethernets: map[string]netplan.Ethernet{ + "enp3s0": { + Dhcp4: ptr.To(true), + }, + }, + }, + }, + nil, + ), + + Entry( + "mixed static and dhcp4 ips with overrides", + netplanStaticAndDHCPWithOverridesBoolTrueFalse, + netplan.Config{ + Network: netplan.Network{ + Version: 2, + Ethernets: map[string]netplan.Ethernet{ + "enp5s0": { + Addresses: []netplan.Address{ + { + String: ptr.To("10.10.10.2/24"), + }, + }, + Dhcp4: ptr.To(false), + }, + "enp6s0": { + Dhcp4: ptr.To(true), + Dhcp4Overrides: &schema.DHCPOverrides{ + RouteMetric: ptr.To(int64(200)), + }, + }, + }, + }, + }, + nil, + ), +) + +var _ = DescribeTable("Unmarshal", + func(in string, expObj netplan.Config, expErr error) { + obj, err := netplan.UnmarshalYAML([]byte(in)) + if expErr != nil { + Expect(err).To(HaveOccurred()) + Expect(err).To(MatchError(expErr)) + } else { + Expect(err).ToNot(HaveOccurred()) + Expect(obj).To(Equal(expObj), cmp.Diff(obj, expObj)) + } + + }, + Entry( + "single static ip", + netplanSingleStaticIP, + netplan.Config{ + Network: netplan.Network{ + Version: 2, + Renderer: ptr.To(netplan.Renderer("networkd")), + Ethernets: map[string]netplan.Ethernet{ + "enp3s0": { + Addresses: []netplan.Address{ + { + String: ptr.To("10.10.10.2/24"), + }, + }, + }, + }, + }, + }, + nil, + ), + + Entry( + "single dhcp4 ip", + netplanSingleDHCP4IPBoolYesNo, + netplan.Config{ + Network: netplan.Network{ + Version: 2, + Renderer: ptr.To(netplan.Renderer("networkd")), + Ethernets: map[string]netplan.Ethernet{ + "enp3s0": { + Dhcp4: ptr.To(true), + }, + }, + }, + }, + nil, + ), + + Entry( + "mixed static and dhcp4 ips with overrides", + netplanStaticAndDHCPWithOverridesBoolYesNo, + netplan.Config{ + Network: netplan.Network{ + Version: 2, + Ethernets: map[string]netplan.Ethernet{ + "enp5s0": { + Addresses: []netplan.Address{ + { + String: ptr.To("10.10.10.2/24"), + }, + }, + Dhcp4: ptr.To(false), + }, + "enp6s0": { + Dhcp4: ptr.To(true), + Dhcp4Overrides: &schema.DHCPOverrides{ + RouteMetric: ptr.To(int64(200)), + }, + }, + }, + }, + }, + nil, + ), +) + +const netplanSingleStaticIP = `network: + version: 2 + renderer: networkd + ethernets: + enp3s0: + addresses: + - 10.10.10.2/24` + +const netplanSingleDHCP4IPBoolTrueFalse = `network: + version: 2 + renderer: networkd + ethernets: + enp3s0: + dhcp4: true` + +const netplanStaticAndDHCPWithOverridesBoolTrueFalse = `network: + version: 2 + ethernets: + enp5s0: + dhcp4: false + addresses: + - 10.10.10.2/24 + enp6s0: + dhcp4: true + dhcp4-overrides: + route-metric: 200` + +const netplanSingleDHCP4IPBoolYesNo = `network: + version: 2 + renderer: networkd + ethernets: + enp3s0: + dhcp4: yes` + +const netplanStaticAndDHCPWithOverridesBoolYesNo = `network: + version: 2 + ethernets: + enp5s0: + dhcp4: no + addresses: + - 10.10.10.2/24 + enp6s0: + dhcp4: yes + dhcp4-overrides: + route-metric: 200` diff --git a/pkg/util/netplan/schema/.gitignore b/pkg/util/netplan/schema/.gitignore new file mode 100644 index 000000000..9c9a7cbd3 --- /dev/null +++ b/pkg/util/netplan/schema/.gitignore @@ -0,0 +1 @@ +.receipt-* \ No newline at end of file diff --git a/pkg/util/netplan/schema/Dockerfile b/pkg/util/netplan/schema/Dockerfile new file mode 100644 index 000000000..1004f9640 --- /dev/null +++ b/pkg/util/netplan/schema/Dockerfile @@ -0,0 +1,17 @@ +# Copyright (c) 2024 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +ARG BASE_IMAGE=rust@sha256:96d0c6fc967aad12993be9592eb4a76c23268c4f8ff49dbe96b10226c267b712 + +FROM ${BASE_IMAGE} AS build +WORKDIR /work +RUN git clone https://github.com/TobiasDeBruijn/netplan-types . +COPY main.rs src/ +RUN cargo add serde_json +RUN cargo build --features schemars + + +FROM ${BASE_IMAGE} +COPY --from=build /work/ /work/ +WORKDIR /work +CMD ["/bin/sh", "-c", "cargo run --features schemars >/output/schema.json"] \ No newline at end of file diff --git a/pkg/util/netplan/schema/Makefile b/pkg/util/netplan/schema/Makefile new file mode 100644 index 000000000..ca154356a --- /dev/null +++ b/pkg/util/netplan/schema/Makefile @@ -0,0 +1,30 @@ +# Copyright (c) 2024 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +TOOLS_DIR := ../../../../hack/tools +SCHEMA_IN := schema.json +OUTPUT_GO := netplan.go +QUICK_DIR := ../../../../hack/quicktype +START_TYP := Config + +include $(QUICK_DIR)/Makefile + +# Images. +RUST_IMAGE ?= rust@sha256:96d0c6fc967aad12993be9592eb4a76c23268c4f8ff49dbe96b10226c267b712 +SCHEMA_IMAGE_NAME := vmop-netplan-schema +SCHEMA_IMAGE_VERSION := latest +SCHEMA_IMAGE ?= $(SCHEMA_IMAGE_NAME):$(SCHEMA_IMAGE_VERSION) +SCHEMA_IMAGE_RECEIPT := .receipt-$(SCHEMA_IMAGE_NAME)-$(shell echo $(RUST_IMAGE) | md5sum | awk '{print $$1}') + +$(SCHEMA_IMAGE_RECEIPT): + $(CRI_BIN) build \ + --build-arg BASE_IMAGE="$(RUST_IMAGE)" \ + -t $(SCHEMA_IMAGE) \ + -f Dockerfile \ + . + touch $(SCHEMA_IMAGE_RECEIPT) +image-build-schema: $(SCHEMA_IMAGE_RECEIPT) + +$(SCHEMA_IN): | $(SCHEMA_IMAGE_RECEIPT) +$(SCHEMA_IN): ## Generate the schema + $(CRI_BIN) run -it --rm -v $$(pwd):/output $(SCHEMA_IMAGE) diff --git a/pkg/util/netplan/schema/README.md b/pkg/util/netplan/schema/README.md new file mode 100644 index 000000000..6a57080e3 --- /dev/null +++ b/pkg/util/netplan/schema/README.md @@ -0,0 +1,15 @@ +# Netplan schemas + +## Overview + +This directory contains schema files relates to Netplan: + +* [`schema.json`](./schema.json) + + * **`Copied`** `2024/11/112` + * **`Source`** https://github.com/TobiasDeBruijn/netplan-types + * **`--help`** Generate the schema with `make schema.json` + +## Generating the Go source code + +Run `make generate-go` to generate the Go source code. If the local system has `npm`, it is used, otherwise a container image is used with either Docker or Podman. diff --git a/pkg/util/netplan/schema/main.rs b/pkg/util/netplan/schema/main.rs new file mode 100644 index 000000000..cde32d085 --- /dev/null +++ b/pkg/util/netplan/schema/main.rs @@ -0,0 +1,7 @@ +// Copyright (c) 2024 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +fn main() { + let schema = schemars::schema_for!(netplan_types::NetplanConfig); + println!("{}", serde_json::to_string_pretty(&schema).unwrap()); +} \ No newline at end of file diff --git a/pkg/util/netplan/schema/netplan.go b/pkg/util/netplan/schema/netplan.go new file mode 100644 index 000000000..13652e5c3 --- /dev/null +++ b/pkg/util/netplan/schema/netplan.go @@ -0,0 +1,2159 @@ +// This file was generated from JSON Schema using quicktype, do not modify it directly. +// To parse and unparse this JSON data, add this code to your project and do: +// +// config, err := UnmarshalConfig(bytes) +// bytes, err = config.Marshal() + +package schema + +import ( + "bytes" + "encoding/json" + "errors" +) + +func UnmarshalConfig(data []byte) (Config, error) { + var r Config + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *Config) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type Config struct { + Network NetworkConfig `json:"network"` +} + +type NetworkConfig struct { + Bonds map[string]BondConfig `json:"bonds,omitempty"` + Bridges map[string]BridgeConfig `json:"bridges,omitempty"` + DummyDevices map[string]DummyDeviceConfig `json:"dummy-devices,omitempty"` + Ethernets map[string]EthernetConfig `json:"ethernets,omitempty"` + Renderer *Renderer `json:"renderer,omitempty"` + Tunnels map[string]TunnelConfig `json:"tunnels,omitempty"` + Version int64 `json:"version"` + Vlans map[string]VLANConfig `json:"vlans,omitempty"` + Vrfs map[string]VrfsConfig `json:"vrfs,omitempty"` + Wifis map[string]WifiConfig `json:"wifis,omitempty"` +} + +type BondConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // All devices matching this ID list will be added to the bond. + Interfaces []string `json:"interfaces,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // Customization parameters for special bonding options. Time intervals may need to be + // expressed as a number of seconds or milliseconds: the default value type is specified + // below. If necessary, time intervals can be qualified using a time suffix (such as “s” for + // seconds, “ms” for milliseconds) to allow for more control over its behavior. + Parameters *BondParameters `json:"parameters,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` +} + +type AddressMappingClass struct { + // An IP address label, equivalent to the ip address label command. Currently supported on + // the networkd backend only. + Label string `json:"label"` + // Default: forever. This can be forever or 0 and corresponds to the PreferredLifetime + // option in systemd-networkd’s Address section. Currently supported on the networkd backend + // only. + Lifetime PreferredLifetime `json:"lifetime"` +} + +// Several DHCP behavior overrides are available. Most currently only have any effect when +// using the networkd backend, with the exception of use-routes and route-metric. +// +// Overrides only have an effect if the corresponding dhcp4 or dhcp6 is set to true. +// +// If both dhcp4 and dhcp6 are true, the networkd backend requires that dhcp4-overrides and +// dhcp6-overrides contain the same keys and values. If the values do not match, an error +// will be shown and the network configuration will not be applied. +// +// When using the NetworkManager backend, different values may be specified for +// dhcp4-overrides and dhcp6-overrides, and will be applied to the DHCP client processes as +// specified in the netplan YAML. +type DHCPOverrides struct { + // Use this value for the hostname which is sent to the DHCP server, instead of machine’s + // hostname. Currently only has an effect on the networkd backend. + Hostname *string `json:"hostname,omitempty"` + // Use this value for default metric for automatically-added routes. Use this to prioritize + // routes for devices by setting a lower metric on a preferred interface. Available for both + // the networkd and NetworkManager backends. + RouteMetric *int64 `json:"route-metric,omitempty"` + // Default: true. When true, the machine’s hostname will be sent to the DHCP server. + // Currently only has an effect on the networkd backend. + SendHostname *bool `json:"send-hostname,omitempty"` + // Default: true. When true, the DNS servers received from the DHCP server will be used and + // take precedence over any statically configured ones. Currently only has an effect on the + // networkd backend. + UseDNS *bool `json:"use-dns,omitempty"` + // Takes a boolean, or the special value “route”. When true, the domain name received from + // the DHCP server will be used as DNS search domain over this link, similar to the effect + // of the Domains= setting. If set to “route”, the domain name received from the DHCP server + // will be used for routing DNS queries only, but not for searching, similar to the effect + // of the Domains= setting when the argument is prefixed with “~”. + UseDomains *string `json:"use-domains,omitempty"` + // Default: true. When true, the hostname received from the DHCP server will be set as the + // transient hostname of the system. Currently only has an effect on the networkd backend. + UseHostname *bool `json:"use-hostname,omitempty"` + // Default: true. When true, the MTU received from the DHCP server will be set as the MTU of + // the network interface. When false, the MTU advertised by the DHCP server will be ignored. + // Currently only has an effect on the networkd backend. + UseMTU *bool `json:"use-mtu,omitempty"` + // Default: true. When true, the NTP servers received from the DHCP server will be used by + // systemd-timesyncd and take precedence over any statically configured ones. Currently only + // has an effect on the networkd backend. + UseNTP *bool `json:"use-ntp,omitempty"` + // Default: true. When true, the routes received from the DHCP server will be installed in + // the routing table normally. When set to false, routes from the DHCP server will be + // ignored: in this case, the user is responsible for adding static routes if necessary for + // correct network operation. This allows users to avoid installing a default gateway for + // interfaces configured via DHCP. Available for both the networkd and NetworkManager + // backends. + UseRoutes *bool `json:"use-routes,omitempty"` +} + +// Set DNS servers and search domains, for manual address configuration. +type NameserverConfig struct { + // A list of IPv4 or IPv6 addresses + Addresses []string `json:"addresses,omitempty"` + // A list of search domains. + Search []string `json:"search,omitempty"` +} + +type BondParameters struct { + // Set the aggregation selection mode. Possible values are stable, bandwidth, and count. + // This option is only used in 802.3ad mode. + AdSelect *AdSelect `json:"ad-select,omitempty"` + // If the bond should drop duplicate frames received on inactive ports, set this option to + // false. If they should be delivered, set this option to true. The default value is false, + // and is the desirable behavior in most situations. + AllSlavesActive *bool `json:"all-slaves-active,omitempty"` + // Specify whether to use any ARP IP target being up as sufficient for a slave to be + // considered up; or if all the targets must be up. This is only used for active-backup mode + // when arp-validate is enabled. Possible values are any and all. + ARPAllTargets *ARPAllTargets `json:"arp-all-targets,omitempty"` + // Set the interval value for how frequently ARP link monitoring should happen. The default + // value is 0, which disables ARP monitoring. For the networkd backend, this maps to the + // ARPIntervalSec= property. If no time suffix is specified, the value will be interpreted + // as milliseconds. + ARPInterval *string `json:"arp-interval,omitempty"` + // IPs of other hosts on the link which should be sent ARP requests in order to validate + // that a slave is up. This option is only used when arp-interval is set to a value other + // than 0. At least one IP address must be given for ARP link monitoring to function. Only + // IPv4 addresses are supported. You can specify up to 16 IP addresses. The default value is + // an empty list. + ARPIPTargets []string `json:"arp-ip-targets,omitempty"` + // Configure how ARP replies are to be validated when using ARP link monitoring. Possible + // values are none, active, backup, and all. + ARPValidate *ARPValidate `json:"arp-validate,omitempty"` + // Specify the delay before disabling a link once the link has been lost. The default value + // is 0. This maps to the DownDelaySec= property for the networkd renderer. This option is + // only valid for the miimon link monitor. If no time suffix is specified, the value will be + // interpreted as milliseconds. + DownDelay *string `json:"down-delay,omitempty"` + // Set whether to set all slaves to the same MAC address when adding them to the bond, or + // how else the system should handle MAC addresses. The possible values are none, active, + // and follow. + FailOverMACPolicy *FailOverMACPolicy `json:"fail-over-mac-policy,omitempty"` + // Specify how many ARP packets to send after failover. Once a link is up on a new slave, a + // notification is sent and possibly repeated if this value is set to a number greater than + // 1. The default value is 1 and valid values are between 1 and 255. This only affects + // active-backup mode. + GratuitousARP *int64 `json:"gratuitous-arp,omitempty"` + // Set the rate at which LACPDUs are transmitted. This is only useful in 802.3ad mode. + // Possible values are slow (30 seconds, default), and fast (every second). + LACPRate *LACPRate `json:"lacp-rate,omitempty"` + // Specify the interval between sending learning packets to each slave. The value range is + // between 1 and 0x7fffffff. The default value is 1. This option only affects balance-tlb + // and balance-alb modes. Using the networkd renderer, this field maps to the + // LearnPacketIntervalSec= property. If no time suffix is specified, the value will be + // interpreted as seconds. + LearnPacketInterval *string `json:"learn-packet-interval,omitempty"` + // Specifies the interval for MII monitoring (verifying if an interface of the bond has + // carrier). The default is 0; which disables MII monitoring. This is equivalent to the + // MIIMonitorSec= field for the networkd backend. If no time suffix is specified, the value + // will be interpreted as milliseconds. + MiiMonitorInterval *string `json:"mii-monitor-interval,omitempty"` + // The minimum number of links up in a bond to consider the bond interface to be up. + MinLinks *int64 `json:"min-links,omitempty"` + // Set the bonding mode used for the interfaces. The default is balance-rr (round robin). + // Possible values are balance-rr, active-backup, balance-xor, broadcast, 802.3ad, + // balance-tlb, and balance-alb. For OpenVSwitch active-backup and the additional modes + // balance-tcp and balance-slb are supported. #[serde(skip_serializing_if = "Option + Mode *BondMode `json:"mode,omitempty"` + // In balance-rr mode, specifies the number of packets to transmit on a slave before + // switching to the next. When this value is set to 0, slaves are chosen at random. + // Allowable values are between 0 and 65535. The default value is 1. This setting is only + // used in balance-rr mode. + PacketsPerSlave *int64 `json:"packets-per-slave,omitempty"` + // Specify a device to be used as a primary slave, or preferred device to use as a slave for + // the bond (ie. the preferred device to send data through), whenever it is available. This + // only affects active-backup, balance-alb, and balance-tlb modes. + Primary *string `json:"primary,omitempty"` + // Set the reselection policy for the primary slave. On failure of the active slave, the + // system will use this policy to decide how the new active slave will be chosen and how + // recovery will be handled. The possible values are always, better, and failure. + PrimaryReselectPolicy *PrimaryReselectPolicy `json:"primary-reselect-policy,omitempty"` + // In modes balance-rr, active-backup, balance-tlb and balance-alb, a failover can switch + // IGMP traffic from one slave to another. + // + // This parameter specifies how many IGMP membership reports are issued on a failover event. + // Values range from 0 to 255. 0 disables sending membership reports. Otherwise, the first + // membership report is sent on failover and subsequent reports are sent at 200ms intervals. + ResendIGMP *int64 `json:"resend-igmp,omitempty"` + // Specifies the transmit hash policy for the selection of slaves. This is only useful in + // balance-xor, 802.3ad and balance-tlb modes. Possible values are layer2, layer3+4, + // layer2+3, encap2+3, and encap3+4. + TransmitHashPolicy *TransmitHashPolicy `json:"transmit-hash-policy,omitempty"` + // Specify the delay before enabling a link once the link is physically up. The default + // value is 0. This maps to the UpDelaySec= property for the networkd renderer. This option + // is only valid for the miimon link monitor. If no time suffix is specified, the value will + // be interpreted as milliseconds. + UpDelay *string `json:"up-delay,omitempty"` +} + +// The routes block defines standard static routes for an interface. At least to must be +// specified. If type is local or nat a default scope of host is assumed. If type is unicast +// and no gateway (via) is given or type is broadcast, multicast or anycast a default scope +// of link is assumend. Otherwise, a global scope is the default setting. +// +// For from, to, and via, both IPv4 and IPv6 addresses are recognized, and must be in the +// form addr/prefixlen or addr. +type RoutingConfig struct { + // The receive window to be advertised for the route, represented by number of segments. + // Must be a positive integer value. + AdvertisedReceiveWindow *int64 `json:"advertised-receive-window,omitempty"` + // The congestion window to be used for the route, represented by number of segments. Must + // be a positive integer value. + CongestionWindow *int64 `json:"congestion-window,omitempty"` + // Set a source IP address for traffic going through the route. (NetworkManager: as of + // v1.8.0) + From *string `json:"from,omitempty"` + // The relative priority of the route. Must be a positive integer value. + Metric *int64 `json:"metric,omitempty"` + // The MTU to be used for the route, in bytes. Must be a positive integer value. + MTU *int64 `json:"mtu,omitempty"` + // When set to “true”, specifies that the route is directly connected to the interface. + // (NetworkManager: as of v1.12.0 for IPv4 and v1.18.0 for IPv6) + OnLink *bool `json:"on-link,omitempty"` + // The route scope, how wide-ranging it is to the network. Possible values are “global”, + // “link”, or “host”. + Scope *RouteScope `json:"scope,omitempty"` + // The table number to use for the route. In some scenarios, it may be useful to set routes + // in a separate routing table. It may also be used to refer to routing policy rules which + // also accept a table parameter. Allowed values are positive integers starting from 1. Some + // values are already in use to refer to specific routing tables: see + // /etc/iproute2/rt_tables. (NetworkManager: as of v1.10.0) + Table *int64 `json:"table,omitempty"` + // Destination address for the route. + To *string `json:"to,omitempty"` + // The type of route. Valid options are “unicast” (default), “anycast”, “blackhole”, + // “broadcast”, “local”, “multicast”, “nat”, “prohibit”, “throw”, “unreachable” or + // “xresolve”. + Type *RouteType `json:"type,omitempty"` + // Address to the gateway to use for this route. + Via *string `json:"via,omitempty"` +} + +// The routing-policy block defines extra routing policy for a network, where traffic may be +// handled specially based on the source IP, firewall marking, etc. +// +// For from, to, both IPv4 and IPv6 addresses are recognized, and must be in the form +// addr/prefixlen or addr. +type RoutingPolicy struct { + // Set a source IP address to match traffic for this policy rule. + From *string `json:"from,omitempty"` + // Have this routing policy rule match on traffic that has been marked by the iptables + // firewall with this value. Allowed values are positive integers starting from 1. + Mark *int64 `json:"mark,omitempty"` + // Specify a priority for the routing policy rule, to influence the order in which routing + // rules are processed. A higher number means lower priority: rules are processed in order + // by increasing priority number. + Priority *int64 `json:"priority,omitempty"` + // The table number to match for the route. In some scenarios, it may be useful to set + // routes in a separate routing table. It may also be used to refer to routes which also + // accept a table parameter. Allowed values are positive integers starting from 1. Some + // values are already in use to refer to specific routing tables: see + // /etc/iproute2/rt_tables. + Table int64 `json:"table"` + // Match on traffic going to the specified destination. + To *string `json:"to,omitempty"` + // Match this policy rule based on the type of service number applied to the traffic. + TypeOfService *string `json:"type-of-service,omitempty"` +} + +type BridgeConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // All devices matching this ID list will be added to the bridge. This may be an empty list, + // in which case the bridge will be brought online with no member interfaces. + Interfaces []string `json:"interfaces,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // Customization parameters for special bridging options. Time intervals may need to be + // expressed as a number of seconds or milliseconds: the default value type is specified + // below. If necessary, time intervals can be qualified using a time suffix (such as “s” for + // seconds, “ms” for milliseconds) to allow for more control over its behavior. + Parameters *BridgeParameters `json:"parameters,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` +} + +// Customization parameters for special bridging options. Time intervals may need to be +// expressed as a number of seconds or milliseconds: the default value type is specified +// below. If necessary, time intervals can be qualified using a time suffix (such as “s” for +// seconds, “ms” for milliseconds) to allow for more control over its behavior. +type BridgeParameters struct { + // Set the period of time to keep a MAC address in the forwarding database after a packet is + // received. This maps to the AgeingTimeSec= property when the networkd renderer is used. If + // no time suffix is specified, the value will be interpreted as seconds. + AgeingTime *string `json:"ageing-time,omitempty"` + // Specify the period of time the bridge will remain in Listening and Learning states before + // getting to the Forwarding state. This field maps to the ForwardDelaySec= property for the + // networkd renderer. If no time suffix is specified, the value will be interpreted as + // seconds. + ForwardDelay *string `json:"forward-delay,omitempty"` + // Specify the interval between two hello packets being sent out from the root and + // designated bridges. Hello packets communicate information about the network topology. + // When the networkd renderer is used, this maps to the HelloTimeSec= property. If no time + // suffix is specified, the value will be interpreted as seconds. + HelloTime *string `json:"hello-time,omitempty"` + // Set the maximum age of a hello packet. If the last hello packet is older than that value, + // the bridge will attempt to become the root bridge. This maps to the MaxAgeSec= property + // when the networkd renderer is used. If no time suffix is specified, the value will be + // interpreted as seconds. + MaxAge *string `json:"max-age,omitempty"` + // Set the cost of a path on the bridge. Faster interfaces should have a lower cost. This + // allows a finer control on the network topology so that the fastest paths are available + // whenever possible. + PathCost *int64 `json:"path-cost,omitempty"` + // Set the port priority to . The priority value is a number between 0 and 63. This metric + // is used in the designated port and root port selection algorithms. + PortPriority *int64 `json:"port-priority,omitempty"` + // Set the priority value for the bridge. This value should be a number between 0 and 65535. + // Lower values mean higher priority. The bridge with the higher priority will be elected as + // the root bridge. + Priority *int64 `json:"priority,omitempty"` + // Define whether the bridge should use Spanning Tree Protocol. The default value is “true”, + // which means that Spanning Tree should be used. + Stp *bool `json:"stp,omitempty"` +} + +// Purpose: Use the dummy-devices key to create virtual interfaces. +// +// Structure: The key consists of a mapping of interface names. Dummy devices are virtual +// devices that can be used to route packets to without actually transmitting them. +type DummyDeviceConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` +} + +// Common properties for physical device types +type EthernetConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (SR-IOV devices only) Delay rebinding of SR-IOV virtual functions to its driver after + // changing the embedded-switch-mode setting to a later stage. Can be enabled when + // bonding/VF LAG is in use. Defaults to false. + DelayVirtualFunctionsRebind *bool `json:"delay-virtual-functions-rebind,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // (SR-IOV devices only) Change the operational mode of the embedded switch of a supported + // SmartNIC PCI device (e.g. Mellanox ConnectX-5). Possible values are switchdev or legacy, + // if unspecified the vendor’s default configuration is used. + EmbeddedSwitchMode *EmbeddedSwitchMode `json:"embedded-switch-mode,omitempty"` + // (networkd backend only) Whether to emit LLDP packets. Off by default. + EmitLldp *bool `json:"emit-lldp,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. + // When unset, the kernel’s default will be used. + GenericReceiveOffload *bool `json:"generic-receive-offload,omitempty"` + // (networkd backend only) If set to true, the Generic Segmentation Offload (GSO) is + // enabled. When unset, the kernel’s default will be used. + GenericSegmentationOffload *bool `json:"generic-segmentation-offload,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // (networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. + // When unset, the kernel’s default will be used. + LargeReceiveOffload *bool `json:"large-receive-offload,omitempty"` + // (SR-IOV devices only) The link property declares the device as a Virtual Function of the + // selected Physical Function device, as identified by the given netplan id. + Link *string `json:"link,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // This selects a subset of available physical devices by various hardware properties. The + // following configuration will then apply to all matching devices, as soon as they appear. + // All specified properties must match. + Match *MatchConfig `json:"match,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // This provides additional configuration for the network device for openvswitch. If + // openvswitch is not available on the system, netplan treats the presence of openvswitch + // configuration as an error. + // + // Any supported network device that is declared with the openvswitch mapping (or any + // bond/bridge that includes an interface with an openvswitch configuration) will be created + // in openvswitch instead of the defined renderer. In the case of a vlan definition declared + // the same way, netplan will create a fake VLAN bridge in openvswitch with the requested + // vlan properties. + Openvswitch *OpenVSwitchConfig `json:"openvswitch,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // (networkd backend only) If set to true, the hardware offload for checksumming of ingress + // network packets is enabled. When unset, the kernel’s default will be used. + ReceiveChecksumOffload *bool `json:"receive-checksum-offload,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` + // When matching on unique properties such as path or MAC, or with additional assumptions + // such as “there will only ever be one wifi device”, match rules can be written so that + // they only match one device. Then this property can be used to give that device a more + // specific/desirable/nicer name than the default from udev’s ifnames. Any additional device + // that satisfies the match rules will then fail to get renamed and keep the original kernel + // name (and dmesg will show an error). + SetName *string `json:"set-name,omitempty"` + // (networkd backend only) If set to true, the TCP Segmentation Offload (TSO) is enabled. + // When unset, the kernel’s default will be used. + TCPSegmentationOffload *bool `json:"tcp-segmentation-offload,omitempty"` + // (networkd backend only) If set to true, the TCP6 Segmentation Offload + // (tx-tcp6-segmentation) is enabled. When unset, the kernel’s default will be used. + Tcp6SegmentationOffload *bool `json:"tcp6-segmentation-offload,omitempty"` + // (networkd backend only) If set to true, the hardware offload for checksumming of egress + // network packets is enabled. When unset, the kernel’s default will be used. + TransmitChecksumOffload *bool `json:"transmit-checksum-offload,omitempty"` + // (SR-IOV devices only) In certain special cases VFs might need to be configured outside of + // netplan. For such configurations virtual-function-count can be optionally used to set an + // explicit number of Virtual Functions for the given Physical Function. If unset, the + // default is to create only as many VFs as are defined in the netplan configuration. This + // should be used for special cases only. + VirtualFunctionCount *int64 `json:"virtual-function-count,omitempty"` + // Enable wake on LAN. Off by default. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting wake on LAN. + Wakeonlan *bool `json:"wakeonlan,omitempty"` +} + +// This selects a subset of available physical devices by various hardware properties. The +// following configuration will then apply to all matching devices, as soon as they appear. +// All specified properties must match. +type MatchConfig struct { + // Kernel driver name, corresponding to the DRIVER udev property. A sequence of globs is + // supported, any of which must match. Matching on driver is only supported with networkd. + Driver []string `json:"driver,omitempty"` + // Device’s MAC address in the form “XX:XX:XX:XX:XX:XX”. Globs are not allowed. + Macaddress *string `json:"macaddress,omitempty"` + // Current interface name. Globs are supported, and the primary use case for matching on + // names, as selecting one fixed name can be more easily achieved with having no match: at + // all and just using the ID (see above). (NetworkManager: as of v1.14.0) + Name *string `json:"name,omitempty"` +} + +// This provides additional configuration for the network device for openvswitch. If +// openvswitch is not available on the system, netplan treats the presence of openvswitch +// configuration as an error. +// +// Any supported network device that is declared with the openvswitch mapping (or any +// bond/bridge that includes an interface with an openvswitch configuration) will be created +// in openvswitch instead of the defined renderer. In the case of a vlan definition declared +// the same way, netplan will create a fake VLAN bridge in openvswitch with the requested +// vlan properties. +type OpenVSwitchConfig struct { + // Valid for bridge interfaces. Specify an external OpenFlow controller. + Controller *ControllerConfig `json:"controller,omitempty"` + // Passed-through directly to OpenVSwitch + ExternalIDS *string `json:"external-ids,omitempty"` + // Valid for bridge interfaces. Accepts secure or standalone (the default). + FailMode *FailMode `json:"fail-mode,omitempty"` + // Valid for bond interfaces. Accepts active, passive or off (the default). + LACP *LACP `json:"lacp,omitempty"` + // Valid for bridge interfaces. False by default. + McastSnooping *bool `json:"mcast-snooping,omitempty"` + // Passed-through directly to OpenVSwitch + OtherConfig *string `json:"other-config,omitempty"` + // OpenvSwitch patch ports. Each port is declared as a pair of names which can be referenced + // as interfaces in dependent virtual devices (bonds, bridges). + Ports []string `json:"ports,omitempty"` + // Valid for bridge interfaces or the network section. List of protocols to be used when + // negotiating a connection with the controller. Accepts OpenFlow10, OpenFlow11, OpenFlow12, + // OpenFlow13, OpenFlow14, OpenFlow15 and OpenFlow16. + Protocols []OpenFlowProtocol `json:"protocols,omitempty"` + // Valid for bridge interfaces. False by default. + RTSP *bool `json:"rtsp,omitempty"` + // Valid for global openvswitch settings. Options for configuring SSL server endpoint for + // the switch. + SSL *SSLConfig `json:"ssl,omitempty"` +} + +// Valid for bridge interfaces. Specify an external OpenFlow controller. +type ControllerConfig struct { + // Set the list of addresses to use for the controller targets. The syntax of these + // addresses is as defined in ovs-vsctl(8). Example: addresses: [tcp:127.0.0.1:6653, + // "ssl:[fe80::1234%eth0]:6653"] + Addresses []string `json:"addresses,omitempty"` + // Set the connection mode for the controller. Supported options are in-band and + // out-of-band. The default is in-band. + ConnectionMode *ConnectionMode `json:"connection-mode,omitempty"` +} + +// Valid for global openvswitch settings. Options for configuring SSL server endpoint for +// the switch. +type SSLConfig struct { + // Path to a file containing the CA certificate to be used. + CACERT *string `json:"ca-cert,omitempty"` + // Path to a file containing the server certificate. + Certificate *string `json:"certificate,omitempty"` + // Path to a file containing the private key for the server. + PrivateKey *string `json:"private-key,omitempty"` +} + +// Tunnels allow traffic to pass as if it was between systems on the same local network, +// although systems may be far from each other but reachable via the Internet. They may be +// used to support IPv6 traffic on a network where the ISP does not provide the service, or +// to extend and “connect” separate local networks. Please see +// for more general information about +// tunnels. +type TunnelConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // Define keys to use for the tunnel. The key can be a number or a dotted quad (an IPv4 + // address). For wireguard it can be a base64-encoded private key or (as of networkd v242+) + // an absolute path to a file, containing the private key (since 0.100). It is used for + // identification of IP transforms. This is only required for vti and vti6 when using the + // networkd backend, and for gre or ip6gre tunnels when using the NetworkManager backend. + // + // This field may be used as a scalar (meaning that a single key is specified and to be used + // for input, output and private key), or as a mapping, where you can further specify + // input/output/private. + Key *TunnelKey `json:"key,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Defines the address of the local endpoint of the tunnel. + Local *string `json:"local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // Firewall mark for outgoing WireGuard packets from this interface, optional. + Mark *string `json:"mark,omitempty"` + // Defines the tunnel mode. Valid options are sit, gre, ip6gre, ipip, ipip6, ip6ip6, vti, + // vti6 and wireguard. Additionally, the networkd backend also supports gretap and ip6gretap + // modes. In addition, the NetworkManager backend supports isatap tunnels. + Mode *TunnelMode `json:"mode,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // A list of peers + Peers []WireGuardPeer `json:"peers"` + // UDP port to listen at or auto. Optional, defaults to auto. + Port *string `json:"port,omitempty"` + // Defines the address of the remote endpoint of the tunnel. + Remote *string `json:"remote,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` + // Defines the TTL of the tunnel. + TTL *int64 `json:"ttl,omitempty"` +} + +type TunnelKey struct { + Simple *string `json:"Simple,omitempty"` + Complex *Complex `json:"Complex,omitempty"` +} + +type Complex struct { + // The input key for the tunnel + Input *string `json:"input,omitempty"` + // The output key for the tunnel + Output *string `json:"output,omitempty"` + // A base64-encoded private key required for WireGuard tunnels. When the systemd-networkd + // backend (v242+) is used, this can also be an absolute path to a file containing the + // private key. + Private *string `json:"private,omitempty"` +} + +// A list of peers +type WireGuardPeer struct { + // A list of IP (v4 or v6) addresses with CIDR masks from which this peer is allowed to send + // incoming traffic and to which outgoing traffic for this peer is directed. The catch-all + // 0.0.0.0/0 may be specified for matching all IPv4 addresses, and ::/0 may be specified for + // matching all IPv6 addresses. + AllowedIPS []string `json:"allowed-ips,omitempty"` + // Remote endpoint IPv4/IPv6 address or a hostname, followed by a colon and a port number. + Endpoint *string `json:"endpoint,omitempty"` + // An interval in seconds, between 1 and 65535 inclusive, of how often to send an + // authenticated empty packet to the peer for the purpose of keeping a stateful firewall or + // NAT mapping valid persistently. Optional. + Keepalive *int64 `json:"keepalive,omitempty"` + // Define keys to use for the WireGuard peers. + Keys *WireGuardPeerKey `json:"keys,omitempty"` +} + +// Define keys to use for the WireGuard peers. +// +// This field can be used as a mapping, where you can further specify the public and shared +// keys. +type WireGuardPeerKey struct { + // A base64-encoded public key, required for WireGuard peers. + Public *string `json:"public,omitempty"` + // A base64-encoded preshared key. Optional for WireGuard peers. When the systemd-networkd + // backend (v242+) is used, this can also be an absolute path to a file containing the + // preshared key. + Shared *string `json:"shared,omitempty"` +} + +type VLANConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // VLAN ID, a number between 0 and 4094. + ID *int64 `json:"id,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // netplan ID of the underlying device definition on which this VLAN gets created. + Link *string `json:"link,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` +} + +// Purpose: Use the vrfs key to create Virtual Routing and Forwarding (VRF) interfaces. +// +// Structure: The key consists of a mapping of VRF interface names. The interface used in +// the link option (enp5s0 in the example below) must also be defined in the Netplan +// configuration. The general configuration structure for VRFs is shown below. +type VrfsConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // All devices matching this ID list will be added to the VRF. This may be an empty list, in + // which case the VRF will be brought online with no member interfaces. + Interfaces []string `json:"interfaces"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` + // The numeric routing table identifier. This setting is compulsory. + Table int64 `json:"table"` +} + +// Common properties for physical device types +type WifiConfig struct { + // Accept Router Advertisement that would have the kernel configure IPv6 by itself. When + // enabled, accept Router Advertisements. When disabled, do not respond to Router + // Advertisements. If unset use the host kernel default setting. + AcceptRa *bool `json:"accept-ra,omitempty"` + // This provides pre-configured connections to NetworkManager. Note that users can of course + // select other access points/SSIDs. The keys of the mapping are the SSIDs, and the values + // are mappings with the following supported properties: + AccessPoints map[string]AccessPointConfig `json:"access-points,omitempty"` + // Allows specifying the management policy of the selected interface. By default, netplan + // brings up any configured interface if possible. Using the activation-mode setting users + // can override that behavior by either specifying manual, to hand over control over the + // interface state to the administrator or (for networkd backend only) off to force the link + // in a down state at all times. Any interface with activation-mode defined is implicitly + // considered optional. Supported officially as of networkd v248+. + ActivationMode *Lowercase `json:"activation-mode,omitempty"` + // Add static addresses to the interface in addition to the ones received through DHCP or + // RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an + // IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of + // the subnet. + // + // For virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is + // disabled, the interface may still be brought online, but will not be addressable from the + // network. + Addresses []AddressMapping `json:"addresses,omitempty"` + // Designate the connection as “critical to the system”, meaning that special care will be + // taken by to not release the assigned IP when the daemon is restarted. (not recognized by + // NetworkManager) + Critical *bool `json:"critical,omitempty"` + // (networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, + // the MAC address of the link is used. If this option is omitted, or if duid is specified, + // networkd will generate an RFC4361-compliant client identifier for the interface by + // combining the link’s IAID and DUID. + DHCPIdentifier *string `json:"dhcp-identifier,omitempty"` + // Enable DHCP for IPv4. Off by default. + Dhcp4 *bool `json:"dhcp4,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp4Overrides *DHCPOverrides `json:"dhcp4-overrides,omitempty"` + // Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP + // server supplies information like DNS nameservers but not the IP address - and stateful + // DHCP, where the server provides both the address and the other information. + // + // If you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC + // with RDNSS), this option can be set to cause the interface to be brought up. (Setting + // accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of + // the router advertisement and only use DHCP if requested in the RA. + // + // Note that rdnssd(8) is required to use RDNSS with networkd. No extra software is required + // for NetworkManager. + Dhcp6 *bool `json:"dhcp6,omitempty"` + // (networkd backend only) Overrides default DHCP behavior + Dhcp6Overrides *DHCPOverrides `json:"dhcp6-overrides,omitempty"` + // (networkd backend only) Whether to emit LLDP packets. Off by default. + EmitLldp *bool `json:"emit-lldp,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway4 *string `json:"gateway4,omitempty"` + // Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address + // configuration. This requires setting addresses too. Gateway IPs must be in a form + // recognized by inet_pton(3). There should only be a single gateway per IP address family + // set in your global config, to make it unambiguous. If you need multiple default routes, + // please define them via routing-policy. + Gateway6 *string `json:"gateway6,omitempty"` + // (networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. + // When unset, the kernel’s default will be used. + GenericReceiveOffload *bool `json:"generic-receive-offload,omitempty"` + // (networkd backend only) If set to true, the Generic Segmentation Offload (GSO) is + // enabled. When unset, the kernel’s default will be used. + GenericSegmentationOffload *bool `json:"generic-segmentation-offload,omitempty"` + // (networkd backend only) Allow the specified interface to be configured even if it has no + // carrier. + IgnoreCarrier *bool `json:"ignore-carrier,omitempty"` + // Configure method for creating the address for use with RFC4862 IPv6 Stateless Address + // Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 + // or stable-privacy. + Ipv6AddressGeneration *Ipv6AddressGeneration `json:"ipv6-address-generation,omitempty"` + // Define an IPv6 address token for creating a static interface identifier for IPv6 + // Stateless Address Autoconfiguration. This is mutually exclusive with + // ipv6-address-generation. + Ipv6AddressToken *string `json:"ipv6-address-token,omitempty"` + // Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is + // an unusual requirement. + Ipv6MTU *int64 `json:"ipv6-mtu,omitempty"` + // Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer + // temporary addresses. Defaults to false - no privacy extensions. There is currently no way + // to have a private address but prefer the public address. + Ipv6Privacy *bool `json:"ipv6-privacy,omitempty"` + // (networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. + // When unset, the kernel’s default will be used. + LargeReceiveOffload *bool `json:"large-receive-offload,omitempty"` + // Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, + // which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is + // not defined, the default is to enable only IPv6 link-local addresses. If the field is + // defined but configured as an empty set, IPv6 link-local addresses are disabled as well as + // IPv4 link- local addresses. + // + // This feature enables or disables link-local addresses for a protocol, but the actual + // implementation differs per backend. On networkd, this directly changes the behavior and + // may add an extra address on an interface. When using the NetworkManager backend, enabling + // link-local has no effect if the interface also has DHCP enabled. + // + // Example to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all + // link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local + // addresses: `link-local: [ ]` + LinkLocal []string `json:"link-local,omitempty"` + // Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MAC addresses. + Macaddress *string `json:"macaddress,omitempty"` + // This selects a subset of available physical devices by various hardware properties. The + // following configuration will then apply to all matching devices, as soon as they appear. + // All specified properties must match. + Match *MatchConfig `json:"match,omitempty"` + // Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values + // depend on your network interface. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting MTU. + MTU *int64 `json:"mtu,omitempty"` + // Set DNS servers and search domains, for manual address configuration. + Nameservers *NameserverConfig `json:"nameservers,omitempty"` + // This provides additional configuration for the network device for openvswitch. If + // openvswitch is not available on the system, netplan treats the presence of openvswitch + // configuration as an error. + // + // Any supported network device that is declared with the openvswitch mapping (or any + // bond/bridge that includes an interface with an openvswitch configuration) will be created + // in openvswitch instead of the defined renderer. In the case of a vlan definition declared + // the same way, netplan will create a fake VLAN bridge in openvswitch with the requested + // vlan properties. + Openvswitch *OpenVSwitchConfig `json:"openvswitch,omitempty"` + // An optional device is not required for booting. Normally, networkd will wait some time + // for device to become configured before proceeding with booting. However, if a device is + // marked as optional, networkd will not wait for it. This is only supported by networkd, + // and the default is false. + Optional *bool `json:"optional,omitempty"` + // Specify types of addresses that are not required for a device to be considered online. + // This changes the behavior of backends at boot time to avoid waiting for addresses that + // are marked optional, and thus consider the interface as “usable” sooner. This does not + // disable these addresses, which will be brought up anyway. + OptionalAddresses []string `json:"optional-addresses,omitempty"` + // (networkd backend only) If set to true, the hardware offload for checksumming of ingress + // network packets is enabled. When unset, the kernel’s default will be used. + ReceiveChecksumOffload *bool `json:"receive-checksum-offload,omitempty"` + // Use the given networking backend for this definition. Currently supported are networkd + // and NetworkManager. This property can be specified globally in network:, for a device + // type (in e. g. ethernets:) or for a particular device definition. Default is networkd. + // + // (Since 0.99) The renderer property has one additional acceptable value for vlan objects + // (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an + // SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter + // for it. There can be only one defined per VF. + Renderer *Renderer `json:"renderer,omitempty"` + // Configure static routing for the device + Routes []RoutingConfig `json:"routes,omitempty"` + // Configure policy routing for the device + RoutingPolicy []RoutingPolicy `json:"routing-policy,omitempty"` + // When matching on unique properties such as path or MAC, or with additional assumptions + // such as “there will only ever be one wifi device”, match rules can be written so that + // they only match one device. Then this property can be used to give that device a more + // specific/desirable/nicer name than the default from udev’s ifnames. Any additional device + // that satisfies the match rules will then fail to get renamed and keep the original kernel + // name (and dmesg will show an error). + SetName *string `json:"set-name,omitempty"` + // (networkd backend only) If set to true, the TCP Segmentation Offload (TSO) is enabled. + // When unset, the kernel’s default will be used. + TCPSegmentationOffload *bool `json:"tcp-segmentation-offload,omitempty"` + // (networkd backend only) If set to true, the TCP6 Segmentation Offload + // (tx-tcp6-segmentation) is enabled. When unset, the kernel’s default will be used. + Tcp6SegmentationOffload *bool `json:"tcp6-segmentation-offload,omitempty"` + // (networkd backend only) If set to true, the hardware offload for checksumming of egress + // network packets is enabled. When unset, the kernel’s default will be used. + TransmitChecksumOffload *bool `json:"transmit-checksum-offload,omitempty"` + // Enable wake on LAN. Off by default. + // + // Note: This will not work reliably for devices matched by name only and rendered by + // networkd, due to interactions with device renaming in udev. Match devices by MAC when + // setting wake on LAN. + Wakeonlan *bool `json:"wakeonlan,omitempty"` + // This enables WakeOnWLan on supported devices. Not all drivers support all options. May be + // any combination of any, disconnect, magic_pkt, gtk_rekey_failure, eap_identity_req, + // four_way_handshake, rfkill_release or tcp (NetworkManager only). Or the exclusive default + // flag (the default). + Wakeonwlan []WakeOnWLAN `json:"wakeonwlan,omitempty"` +} + +type AccessPointConfig struct { + Auth *AuthConfig `json:"auth,omitempty"` + // Possible bands are 5GHz (for 5GHz 802.11a) and 2.4GHz (for 2.4GHz 802.11), do not + // restrict the 802.11 frequency band of the network if unset (the default). + Band *WirelessBand `json:"band,omitempty"` + // If specified, directs the device to only associate with the given access point. + Bssid *string `json:"bssid,omitempty"` + // Wireless channel to use for the Wi-Fi connection. Because channel numbers overlap between + // bands, this property takes effect only if the band property is also set. + Channel *int64 `json:"channel,omitempty"` + // Set to true to change the SSID scan technique for connecting to hidden WiFi networks. + // Note this may have slower performance compared to false (the default) when connecting to + // publicly broadcast SSIDs. + Hidden *bool `json:"hidden,omitempty"` + // Possible access point modes are infrastructure (the default), ap (create an access point + // to which other devices can connect), and adhoc (peer to peer networks without a central + // access point). ap is only supported with NetworkManager. + Mode *AccessPointMode `json:"mode,omitempty"` + // Enable WPA2 authentication and set the passphrase for it. If neither this nor an auth + // block are given, the network is assumed to be open. The setting + Password *string `json:"password,omitempty"` +} + +// Netplan supports advanced authentication settings for ethernet and wifi interfaces, as +// well as individual wifi networks, by means of the auth block. +type AuthConfig struct { + // The identity to pass over the unencrypted channel if the chosen EAP method supports + // passing a different tunnelled identity. + AnonymousIdentity *string `json:"anonymous-identity,omitempty"` + // Path to a file with one or more trusted certificate authority (CA) certificates. + CACertificate *string `json:"ca-certificate,omitempty"` + // Path to a file containing the certificate to be used by the client during authentication. + ClientCertificate *string `json:"client-certificate,omitempty"` + // Path to a file containing the private key corresponding to client-certificate. + ClientKey *string `json:"client-key,omitempty"` + // Password to use to decrypt the private key specified in client-key if it is encrypted. + ClientKeyPassword *string `json:"client-key-password,omitempty"` + // The identity to use for EAP. + Identity *string `json:"identity,omitempty"` + // The supported key management modes are none (no key management); psk (WPA with pre-shared + // key, common for home wifi); eap (WPA with EAP, common for enterprise wifi); and 802.1x + // (used primarily for wired Ethernet connections). + KeyManagement *KeyManagmentMode `json:"key-management,omitempty"` + // The EAP method to use. The supported EAP methods are tls (TLS), peap (Protected EAP), and + // ttls (Tunneled TLS). + Method *AuthMethod `json:"method,omitempty"` + // The password string for EAP, or the pre-shared key for WPA-PSK. + Password *string `json:"password,omitempty"` + // Phase 2 authentication mechanism. + Phase2Auth *string `json:"phase2-auth,omitempty"` +} + +// Allows specifying the management policy of the selected interface. By default, netplan +// brings up any configured interface if possible. Using the activation-mode setting users +// can override that behavior by either specifying manual, to hand over control over the +// interface state to the administrator or (for networkd backend only) off to force the link +// in a down state at all times. Any interface with activation-mode defined is implicitly +// considered optional. Supported officially as of networkd v248+. +type Lowercase string + +const ( + LowercaseOff Lowercase = "Off" + Manual Lowercase = "Manual" +) + +// Default: forever. This can be forever or 0 and corresponds to the PreferredLifetime +// option in systemd-networkd’s Address section. Currently supported on the networkd backend +// only. +type PreferredLifetime string + +const ( + Forever PreferredLifetime = "forever" + The0 PreferredLifetime = "0" +) + +type Ipv6AddressGeneration string + +const ( + Eui64 Ipv6AddressGeneration = "eui64" + StablePrivacy Ipv6AddressGeneration = "stable-privacy" +) + +// Specify whether to use any ARP IP target being up as sufficient for a slave to be +// considered up; or if all the targets must be up. This is only used for active-backup mode +// when arp-validate is enabled. Possible values are any and all. +type ARPAllTargets string + +const ( + ARPAllTargetsAll ARPAllTargets = "all" + ARPAllTargetsAny ARPAllTargets = "any" +) + +// Configure how ARP replies are to be validated when using ARP link monitoring. Possible +// values are none, active, backup, and all. +type ARPValidate string + +const ( + ARPValidateAll ARPValidate = "all" + ARPValidateNone ARPValidate = "none" + Active ARPValidate = "active" + Backup ARPValidate = "backup" +) + +// Set the aggregation selection mode. Possible values are stable, bandwidth, and count. +// This option is only used in 802.3ad mode. +type AdSelect string + +const ( + Bandwidth AdSelect = "bandwidth" + Count AdSelect = "count" + Stable AdSelect = "stable" +) + +// Set whether to set all slaves to the same MAC address when adding them to the bond, or +// how else the system should handle MAC addresses. The possible values are none, active, +// and follow. +type FailOverMACPolicy string + +const ( + Activv FailOverMACPolicy = "activv" + FailOverMACPolicyNone FailOverMACPolicy = "none" + Follow FailOverMACPolicy = "follow" +) + +// Set the rate at which LACPDUs are transmitted. This is only useful in 802.3ad mode. +// Possible values are slow (30 seconds, default), and fast (every second). +type LACPRate string + +const ( + Fast LACPRate = "fast" + Slow LACPRate = "slow" +) + +// 802.3ad +type BondMode string + +const ( + ActiveBackup BondMode = "active-backup" + BalanceAlb BondMode = "balance-alb" + BalanceRr BondMode = "balance-rr" + BalanceTlb BondMode = "balance-tlb" + BalanceXor BondMode = "balance-xor" + BondModeBroadcast BondMode = "broadcast" + The8023Ad BondMode = "802.3ad" +) + +// Set the reselection policy for the primary slave. On failure of the active slave, the +// system will use this policy to decide how the new active slave will be chosen and how +// recovery will be handled. The possible values are always, better, and failure. +type PrimaryReselectPolicy string + +const ( + Always PrimaryReselectPolicy = "always" + Better PrimaryReselectPolicy = "better" + Failure PrimaryReselectPolicy = "failure" +) + +// Specifies the transmit hash policy for the selection of slaves. This is only useful in +// balance-xor, 802.3ad and balance-tlb modes. Possible values are layer2, layer3+4, +// layer2+3, encap2+3, and encap3+4. +type TransmitHashPolicy string + +const ( + Encap23 TransmitHashPolicy = "encap2+3" + Encap34 TransmitHashPolicy = "encap3+4" + Layer2 TransmitHashPolicy = "layer2" + Layer23 TransmitHashPolicy = "layer2+3" + Layer34 TransmitHashPolicy = "layer3+4" +) + +// Use the given networking backend for this definition. Currently supported are networkd +// and NetworkManager. This property can be specified globally in network:, for a device +// type (in e. g. ethernets:) or for a particular device definition. Default is networkd. +// +// (Since 0.99) The renderer property has one additional acceptable value for vlan objects +// (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an +// SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter +// for it. There can be only one defined per VF. +type Renderer string + +const ( + NetworkManager Renderer = "NetworkManager" + Networkd Renderer = "networkd" + Sriov Renderer = "sriov" +) + +// The route scope, how wide-ranging it is to the network. Possible values are “global”, +// “link”, or “host”. +type RouteScope string + +const ( + Global RouteScope = "global" + Host RouteScope = "host" + Link RouteScope = "link" +) + +// The type of route. Valid options are “unicast” (default), “anycast”, “blackhole”, +// “broadcast”, “local”, “multicast”, “nat”, “prohibit”, “throw”, “unreachable” or +// “xresolve”. +type RouteType string + +const ( + Anycast RouteType = "anycast" + Blackhole RouteType = "blackhole" + Local RouteType = "local" + Multicast RouteType = "multicast" + Nat RouteType = "nat" + Prohibit RouteType = "prohibit" + RouteTypeBroadcast RouteType = "broadcast" + Throw RouteType = "throw" + Unicast RouteType = "unicast" + Unreachable RouteType = "unreachable" + Xresolve RouteType = "xresolve" +) + +type EmbeddedSwitchMode string + +const ( + Legacy EmbeddedSwitchMode = "legacy" + Switchdev EmbeddedSwitchMode = "switchdev" +) + +type ConnectionMode string + +const ( + InBand ConnectionMode = "in-band" + OutOfBand ConnectionMode = "out-of-band" +) + +type FailMode string + +const ( + Secure FailMode = "Secure" + Standalone FailMode = "Standalone" +) + +type LACP string + +const ( + LACPActive LACP = "Active" + LACPOff LACP = "Off" + Passive LACP = "Passive" +) + +type OpenFlowProtocol string + +const ( + OpenFlow10 OpenFlowProtocol = "OpenFlow10" + OpenFlow11 OpenFlowProtocol = "OpenFlow11" + OpenFlow12 OpenFlowProtocol = "OpenFlow12" + OpenFlow13 OpenFlowProtocol = "OpenFlow13" + OpenFlow14 OpenFlowProtocol = "OpenFlow14" + OpenFlow15 OpenFlowProtocol = "OpenFlow15" + OpenFlow16 OpenFlowProtocol = "OpenFlow16" +) + +// Defines the tunnel mode. Valid options are sit, gre, ip6gre, ipip, ipip6, ip6ip6, vti, +// vti6 and wireguard. Additionally, the networkd backend also supports gretap and ip6gretap +// modes. In addition, the NetworkManager backend supports isatap tunnels. +type TunnelMode string + +const ( + Gre TunnelMode = "gre" + Gretap TunnelMode = "gretap" + ISATAP TunnelMode = "isatap" + Ip6Gre TunnelMode = "ip6gre" + Ip6Gretap TunnelMode = "ip6gretap" + Ip6Ip6 TunnelMode = "ip6ip6" + Ipip TunnelMode = "ipip" + Ipip6 TunnelMode = "ipip6" + Sit TunnelMode = "sit" + Vti TunnelMode = "vti" + Vti6 TunnelMode = "vti6" + Wireguard TunnelMode = "wireguard" +) + +// 802.1x +type KeyManagmentMode string + +const ( + EAP KeyManagmentMode = "eap" + KeyManagmentModeNone KeyManagmentMode = "none" + Psk KeyManagmentMode = "psk" + Sae KeyManagmentMode = "sae" + The8021X KeyManagmentMode = "802.1x" +) + +type AuthMethod string + +const ( + Peap AuthMethod = "peap" + TLS AuthMethod = "tls" + Ttls AuthMethod = "ttls" +) + +// 2.4Ghz +// +// 5Ghz +type WirelessBand string + +const ( + The24GHz WirelessBand = "2.4GHz" + The5GHz WirelessBand = "5GHz" +) + +// Possible access point modes are infrastructure (the default), ap (create an access point +// to which other devices can connect), and adhoc (peer to peer networks without a central +// access point). ap is only supported with NetworkManager. +type AccessPointMode string + +const ( + Adhoc AccessPointMode = "adhoc" + Ap AccessPointMode = "ap" + Infrastructure AccessPointMode = "infrastructure" +) + +// This enables WakeOnWLan on supported devices. Not all drivers support all options. May be +// any combination of any, disconnect, magic_pkt, gtk_rekey_failure, eap_identity_req, +// four_way_handshake, rfkill_release or tcp (NetworkManager only). Or the exclusive default +// flag (the default). +type WakeOnWLAN string + +const ( + Default WakeOnWLAN = "default" + Disconnect WakeOnWLAN = "disconnect" + EAPIdentityReq WakeOnWLAN = "eap_identity_req" + FourWayHandshake WakeOnWLAN = "four_way_handshake" + GtkRekeyFailure WakeOnWLAN = "gtk_rekey_failure" + MagicPkt WakeOnWLAN = "magic_pkt" + RfkillRelease WakeOnWLAN = "rfkill_release" + TCP WakeOnWLAN = "tcp" + WakeOnWLANAny WakeOnWLAN = "any" +) + +type AddressMapping struct { + AddressMappingClass *AddressMappingClass + String *string +} + +func (x *AddressMapping) UnmarshalJSON(data []byte) error { + x.AddressMappingClass = nil + var c AddressMappingClass + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.AddressMappingClass = &c + } + return nil +} + +func (x *AddressMapping) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.AddressMappingClass != nil, x.AddressMappingClass, false, nil, false, nil, false) +} + +func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) { + if pi != nil { + *pi = nil + } + if pf != nil { + *pf = nil + } + if pb != nil { + *pb = nil + } + if ps != nil { + *ps = nil + } + + dec := json.NewDecoder(bytes.NewReader(data)) + dec.UseNumber() + tok, err := dec.Token() + if err != nil { + return false, err + } + + switch v := tok.(type) { + case json.Number: + if pi != nil { + i, err := v.Int64() + if err == nil { + *pi = &i + return false, nil + } + } + if pf != nil { + f, err := v.Float64() + if err == nil { + *pf = &f + return false, nil + } + return false, errors.New("Unparsable number") + } + return false, errors.New("Union does not contain number") + case float64: + return false, errors.New("Decoder should not return float64") + case bool: + if pb != nil { + *pb = &v + return false, nil + } + return false, errors.New("Union does not contain bool") + case string: + if haveEnum { + return false, json.Unmarshal(data, pe) + } + if ps != nil { + *ps = &v + return false, nil + } + return false, errors.New("Union does not contain string") + case nil: + if nullable { + return false, nil + } + return false, errors.New("Union does not contain null") + case json.Delim: + if v == '{' { + if haveObject { + return true, json.Unmarshal(data, pc) + } + if haveMap { + return false, json.Unmarshal(data, pm) + } + return false, errors.New("Union does not contain object") + } + if v == '[' { + if haveArray { + return false, json.Unmarshal(data, pa) + } + return false, errors.New("Union does not contain array") + } + return false, errors.New("Cannot handle delimiter") + } + return false, errors.New("Cannot unmarshal union") + +} + +func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) { + if pi != nil { + return json.Marshal(*pi) + } + if pf != nil { + return json.Marshal(*pf) + } + if pb != nil { + return json.Marshal(*pb) + } + if ps != nil { + return json.Marshal(*ps) + } + if haveArray { + return json.Marshal(pa) + } + if haveObject { + return json.Marshal(pc) + } + if haveMap { + return json.Marshal(pm) + } + if haveEnum { + return json.Marshal(pe) + } + if nullable { + return json.Marshal(nil) + } + return nil, errors.New("Union must not be null") +} diff --git a/pkg/util/netplan/schema/schema.json b/pkg/util/netplan/schema/schema.json new file mode 100644 index 000000000..361fb581e --- /dev/null +++ b/pkg/util/netplan/schema/schema.json @@ -0,0 +1,3536 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NetplanConfig", + "type": "object", + "required": [ + "network" + ], + "properties": { + "network": { + "$ref": "#/definitions/NetworkConfig" + } + }, + "definitions": { + "AccessPointConfig": { + "type": "object", + "properties": { + "auth": { + "anyOf": [ + { + "$ref": "#/definitions/AuthConfig" + }, + { + "type": "null" + } + ] + }, + "band": { + "description": "Possible bands are 5GHz (for 5GHz 802.11a) and 2.4GHz (for 2.4GHz 802.11), do not restrict the 802.11 frequency band of the network if unset (the default).", + "anyOf": [ + { + "$ref": "#/definitions/WirelessBand" + }, + { + "type": "null" + } + ] + }, + "bssid": { + "description": "If specified, directs the device to only associate with the given access point.", + "type": [ + "string", + "null" + ] + }, + "channel": { + "description": "Wireless channel to use for the Wi-Fi connection. Because channel numbers overlap between bands, this property takes effect only if the band property is also set.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "hidden": { + "description": "Set to true to change the SSID scan technique for connecting to hidden WiFi networks. Note this may have slower performance compared to false (the default) when connecting to publicly broadcast SSIDs.", + "type": [ + "boolean", + "null" + ] + }, + "mode": { + "description": "Possible access point modes are infrastructure (the default), ap (create an access point to which other devices can connect), and adhoc (peer to peer networks without a central access point). ap is only supported with NetworkManager.", + "anyOf": [ + { + "$ref": "#/definitions/AccessPointMode" + }, + { + "type": "null" + } + ] + }, + "password": { + "description": "Enable WPA2 authentication and set the passphrase for it. If neither this nor an auth block are given, the network is assumed to be open. The setting", + "type": [ + "string", + "null" + ] + } + } + }, + "AccessPointMode": { + "description": "Possible access point modes are infrastructure (the default), ap (create an access point to which other devices can connect), and adhoc (peer to peer networks without a central access point). ap is only supported with NetworkManager.", + "type": "string", + "enum": [ + "infrastructure", + "ap", + "adhoc" + ] + }, + "AdSelect": { + "description": "Set the aggregation selection mode. Possible values are stable, bandwidth, and count. This option is only used in 802.3ad mode.", + "type": "string", + "enum": [ + "stable", + "bandwidth", + "count" + ] + }, + "AddressMapping": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "required": [ + "label", + "lifetime" + ], + "properties": { + "label": { + "description": "An IP address label, equivalent to the ip address label command. Currently supported on the networkd backend only.", + "type": "string" + }, + "lifetime": { + "description": "Default: forever. This can be forever or 0 and corresponds to the PreferredLifetime option in systemd-networkd’s Address section. Currently supported on the networkd backend only.", + "allOf": [ + { + "$ref": "#/definitions/PreferredLifetime" + } + ] + } + } + } + ] + }, + "ArpAllTargets": { + "description": "Specify whether to use any ARP IP target being up as sufficient for a slave to be considered up; or if all the targets must be up. This is only used for active-backup mode when arp-validate is enabled. Possible values are any and all.", + "type": "string", + "enum": [ + "any", + "all" + ] + }, + "ArpValidate": { + "description": "Configure how ARP replies are to be validated when using ARP link monitoring. Possible values are none, active, backup, and all.", + "type": "string", + "enum": [ + "none", + "active", + "backup", + "all" + ] + }, + "AuthConfig": { + "description": "Netplan supports advanced authentication settings for ethernet and wifi interfaces, as well as individual wifi networks, by means of the auth block.", + "type": "object", + "properties": { + "anonymous-identity": { + "description": "The identity to pass over the unencrypted channel if the chosen EAP method supports passing a different tunnelled identity.", + "type": [ + "string", + "null" + ] + }, + "ca-certificate": { + "description": "Path to a file with one or more trusted certificate authority (CA) certificates.", + "type": [ + "string", + "null" + ] + }, + "client-certificate": { + "description": "Path to a file containing the certificate to be used by the client during authentication.", + "type": [ + "string", + "null" + ] + }, + "client-key": { + "description": "Path to a file containing the private key corresponding to client-certificate.", + "type": [ + "string", + "null" + ] + }, + "client-key-password": { + "description": "Password to use to decrypt the private key specified in client-key if it is encrypted.", + "type": [ + "string", + "null" + ] + }, + "identity": { + "description": "The identity to use for EAP.", + "type": [ + "string", + "null" + ] + }, + "key-management": { + "description": "The supported key management modes are none (no key management); psk (WPA with pre-shared key, common for home wifi); eap (WPA with EAP, common for enterprise wifi); and 802.1x (used primarily for wired Ethernet connections).", + "anyOf": [ + { + "$ref": "#/definitions/KeyManagmentMode" + }, + { + "type": "null" + } + ] + }, + "method": { + "description": "The EAP method to use. The supported EAP methods are tls (TLS), peap (Protected EAP), and ttls (Tunneled TLS).", + "anyOf": [ + { + "$ref": "#/definitions/AuthMethod" + }, + { + "type": "null" + } + ] + }, + "password": { + "description": "The password string for EAP, or the pre-shared key for WPA-PSK.", + "type": [ + "string", + "null" + ] + }, + "phase2-auth": { + "description": "Phase 2 authentication mechanism.", + "type": [ + "string", + "null" + ] + } + } + }, + "AuthMethod": { + "type": "string", + "enum": [ + "tls", + "peap", + "ttls" + ] + }, + "BondConfig": { + "type": "object", + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "interfaces": { + "description": "All devices matching this ID list will be added to the bond.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "parameters": { + "description": "Customization parameters for special bonding options. Time intervals may need to be expressed as a number of seconds or milliseconds: the default value type is specified below. If necessary, time intervals can be qualified using a time suffix (such as “s” for seconds, “ms” for milliseconds) to allow for more control over its behavior.", + "anyOf": [ + { + "$ref": "#/definitions/BondParameters" + }, + { + "type": "null" + } + ] + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + } + } + }, + "BondMode": { + "description": "Set the bonding mode used for the interfaces. The default is balance-rr (round robin). Possible values are balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, and balance-alb. For OpenVSwitch active-backup and the additional modes balance-tcp and balance-slb are supported.", + "oneOf": [ + { + "type": "string", + "enum": [ + "balance-rr", + "active-backup", + "balance-xor", + "broadcast", + "balance-tlb", + "balance-alb" + ] + }, + { + "description": "802.3ad", + "type": "string", + "enum": [ + "802.3ad" + ] + } + ] + }, + "BondParameters": { + "type": "object", + "properties": { + "ad-select": { + "description": "Set the aggregation selection mode. Possible values are stable, bandwidth, and count. This option is only used in 802.3ad mode.", + "anyOf": [ + { + "$ref": "#/definitions/AdSelect" + }, + { + "type": "null" + } + ] + }, + "all-slaves-active": { + "description": "If the bond should drop duplicate frames received on inactive ports, set this option to false. If they should be delivered, set this option to true. The default value is false, and is the desirable behavior in most situations.", + "type": [ + "boolean", + "null" + ] + }, + "arp-all-targets": { + "description": "Specify whether to use any ARP IP target being up as sufficient for a slave to be considered up; or if all the targets must be up. This is only used for active-backup mode when arp-validate is enabled. Possible values are any and all.", + "anyOf": [ + { + "$ref": "#/definitions/ArpAllTargets" + }, + { + "type": "null" + } + ] + }, + "arp-interval": { + "description": "Set the interval value for how frequently ARP link monitoring should happen. The default value is 0, which disables ARP monitoring. For the networkd backend, this maps to the ARPIntervalSec= property. If no time suffix is specified, the value will be interpreted as milliseconds.", + "type": [ + "string", + "null" + ] + }, + "arp-ip-targets": { + "description": "IPs of other hosts on the link which should be sent ARP requests in order to validate that a slave is up. This option is only used when arp-interval is set to a value other than 0. At least one IP address must be given for ARP link monitoring to function. Only IPv4 addresses are supported. You can specify up to 16 IP addresses. The default value is an empty list.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "arp-validate": { + "description": "Configure how ARP replies are to be validated when using ARP link monitoring. Possible values are none, active, backup, and all.", + "anyOf": [ + { + "$ref": "#/definitions/ArpValidate" + }, + { + "type": "null" + } + ] + }, + "down-delay": { + "description": "Specify the delay before disabling a link once the link has been lost. The default value is 0. This maps to the DownDelaySec= property for the networkd renderer. This option is only valid for the miimon link monitor. If no time suffix is specified, the value will be interpreted as milliseconds.", + "type": [ + "string", + "null" + ] + }, + "fail-over-mac-policy": { + "description": "Set whether to set all slaves to the same MAC address when adding them to the bond, or how else the system should handle MAC addresses. The possible values are none, active, and follow.", + "anyOf": [ + { + "$ref": "#/definitions/FailOverMacPolicy" + }, + { + "type": "null" + } + ] + }, + "gratuitous-arp": { + "description": "Specify how many ARP packets to send after failover. Once a link is up on a new slave, a notification is sent and possibly repeated if this value is set to a number greater than 1. The default value is 1 and valid values are between 1 and 255. This only affects active-backup mode.", + "type": [ + "integer", + "null" + ], + "format": "uint8", + "minimum": 0.0 + }, + "lacp-rate": { + "description": "Set the rate at which LACPDUs are transmitted. This is only useful in 802.3ad mode. Possible values are slow (30 seconds, default), and fast (every second).", + "anyOf": [ + { + "$ref": "#/definitions/LacpRate" + }, + { + "type": "null" + } + ] + }, + "learn-packet-interval": { + "description": "Specify the interval between sending learning packets to each slave. The value range is between 1 and 0x7fffffff. The default value is 1. This option only affects balance-tlb and balance-alb modes. Using the networkd renderer, this field maps to the LearnPacketIntervalSec= property. If no time suffix is specified, the value will be interpreted as seconds.", + "type": [ + "string", + "null" + ] + }, + "mii-monitor-interval": { + "description": "Specifies the interval for MII monitoring (verifying if an interface of the bond has carrier). The default is 0; which disables MII monitoring. This is equivalent to the MIIMonitorSec= field for the networkd backend. If no time suffix is specified, the value will be interpreted as milliseconds.", + "type": [ + "string", + "null" + ] + }, + "min-links": { + "description": "The minimum number of links up in a bond to consider the bond interface to be up.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "mode": { + "description": "Set the bonding mode used for the interfaces. The default is balance-rr (round robin). Possible values are balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, and balance-alb. For OpenVSwitch active-backup and the additional modes balance-tcp and balance-slb are supported. #[serde(skip_serializing_if = \"Option", + "anyOf": [ + { + "$ref": "#/definitions/BondMode" + }, + { + "type": "null" + } + ] + }, + "packets-per-slave": { + "description": "In balance-rr mode, specifies the number of packets to transmit on a slave before switching to the next. When this value is set to 0, slaves are chosen at random. Allowable values are between 0 and 65535. The default value is 1. This setting is only used in balance-rr mode.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "primary": { + "description": "Specify a device to be used as a primary slave, or preferred device to use as a slave for the bond (ie. the preferred device to send data through), whenever it is available. This only affects active-backup, balance-alb, and balance-tlb modes.", + "type": [ + "string", + "null" + ] + }, + "primary-reselect-policy": { + "description": "Set the reselection policy for the primary slave. On failure of the active slave, the system will use this policy to decide how the new active slave will be chosen and how recovery will be handled. The possible values are always, better, and failure.", + "anyOf": [ + { + "$ref": "#/definitions/PrimaryReselectPolicy" + }, + { + "type": "null" + } + ] + }, + "resend-igmp": { + "description": "In modes balance-rr, active-backup, balance-tlb and balance-alb, a failover can switch IGMP traffic from one slave to another.\n\nThis parameter specifies how many IGMP membership reports are issued on a failover event. Values range from 0 to 255. 0 disables sending membership reports. Otherwise, the first membership report is sent on failover and subsequent reports are sent at 200ms intervals.", + "type": [ + "integer", + "null" + ], + "format": "uint8", + "minimum": 0.0 + }, + "transmit-hash-policy": { + "description": "Specifies the transmit hash policy for the selection of slaves. This is only useful in balance-xor, 802.3ad and balance-tlb modes. Possible values are layer2, layer3+4, layer2+3, encap2+3, and encap3+4.", + "anyOf": [ + { + "$ref": "#/definitions/TransmitHashPolicy" + }, + { + "type": "null" + } + ] + }, + "up-delay": { + "description": "Specify the delay before enabling a link once the link is physically up. The default value is 0. This maps to the UpDelaySec= property for the networkd renderer. This option is only valid for the miimon link monitor. If no time suffix is specified, the value will be interpreted as milliseconds.", + "type": [ + "string", + "null" + ] + } + } + }, + "BridgeConfig": { + "type": "object", + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "interfaces": { + "description": "All devices matching this ID list will be added to the bridge. This may be an empty list, in which case the bridge will be brought online with no member interfaces.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "parameters": { + "description": "Customization parameters for special bridging options. Time intervals may need to be expressed as a number of seconds or milliseconds: the default value type is specified below. If necessary, time intervals can be qualified using a time suffix (such as “s” for seconds, “ms” for milliseconds) to allow for more control over its behavior.", + "anyOf": [ + { + "$ref": "#/definitions/BridgeParameters" + }, + { + "type": "null" + } + ] + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + } + } + }, + "BridgeParameters": { + "description": "Customization parameters for special bridging options. Time intervals may need to be expressed as a number of seconds or milliseconds: the default value type is specified below. If necessary, time intervals can be qualified using a time suffix (such as “s” for seconds, “ms” for milliseconds) to allow for more control over its behavior.", + "type": "object", + "properties": { + "ageing-time": { + "description": "Set the period of time to keep a MAC address in the forwarding database after a packet is received. This maps to the AgeingTimeSec= property when the networkd renderer is used. If no time suffix is specified, the value will be interpreted as seconds.", + "type": [ + "string", + "null" + ] + }, + "forward-delay": { + "description": "Specify the period of time the bridge will remain in Listening and Learning states before getting to the Forwarding state. This field maps to the ForwardDelaySec= property for the networkd renderer. If no time suffix is specified, the value will be interpreted as seconds.", + "type": [ + "string", + "null" + ] + }, + "hello-time": { + "description": "Specify the interval between two hello packets being sent out from the root and designated bridges. Hello packets communicate information about the network topology. When the networkd renderer is used, this maps to the HelloTimeSec= property. If no time suffix is specified, the value will be interpreted as seconds.", + "type": [ + "string", + "null" + ] + }, + "max-age": { + "description": "Set the maximum age of a hello packet. If the last hello packet is older than that value, the bridge will attempt to become the root bridge. This maps to the MaxAgeSec= property when the networkd renderer is used. If no time suffix is specified, the value will be interpreted as seconds.", + "type": [ + "string", + "null" + ] + }, + "path-cost": { + "description": "Set the cost of a path on the bridge. Faster interfaces should have a lower cost. This allows a finer control on the network topology so that the fastest paths are available whenever possible.", + "type": [ + "integer", + "null" + ], + "format": "int32" + }, + "port-priority": { + "description": "Set the port priority to . The priority value is a number between 0 and 63. This metric is used in the designated port and root port selection algorithms.", + "type": [ + "integer", + "null" + ], + "format": "uint8", + "minimum": 0.0 + }, + "priority": { + "description": "Set the priority value for the bridge. This value should be a number between 0 and 65535. Lower values mean higher priority. The bridge with the higher priority will be elected as the root bridge.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "stp": { + "description": "Define whether the bridge should use Spanning Tree Protocol. The default value is “true”, which means that Spanning Tree should be used.", + "type": [ + "boolean", + "null" + ] + } + } + }, + "ConnectionMode": { + "type": "string", + "enum": [ + "in-band", + "out-of-band" + ] + }, + "ControllerConfig": { + "description": "Valid for bridge interfaces. Specify an external OpenFlow controller.", + "type": "object", + "properties": { + "addresses": { + "description": "Set the list of addresses to use for the controller targets. The syntax of these addresses is as defined in ovs-vsctl(8). Example: addresses: [tcp:127.0.0.1:6653, \"ssl:[fe80::1234%eth0]:6653\"]", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "connection-mode": { + "description": "Set the connection mode for the controller. Supported options are in-band and out-of-band. The default is in-band.", + "anyOf": [ + { + "$ref": "#/definitions/ConnectionMode" + }, + { + "type": "null" + } + ] + } + } + }, + "DhcpOverrides": { + "description": "Several DHCP behavior overrides are available. Most currently only have any effect when using the networkd backend, with the exception of use-routes and route-metric.\n\nOverrides only have an effect if the corresponding dhcp4 or dhcp6 is set to true.\n\nIf both dhcp4 and dhcp6 are true, the networkd backend requires that dhcp4-overrides and dhcp6-overrides contain the same keys and values. If the values do not match, an error will be shown and the network configuration will not be applied.\n\nWhen using the NetworkManager backend, different values may be specified for dhcp4-overrides and dhcp6-overrides, and will be applied to the DHCP client processes as specified in the netplan YAML.", + "type": "object", + "properties": { + "hostname": { + "description": "Use this value for the hostname which is sent to the DHCP server, instead of machine’s hostname. Currently only has an effect on the networkd backend.", + "type": [ + "string", + "null" + ] + }, + "route-metric": { + "description": "Use this value for default metric for automatically-added routes. Use this to prioritize routes for devices by setting a lower metric on a preferred interface. Available for both the networkd and NetworkManager backends.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "send-hostname": { + "description": "Default: true. When true, the machine’s hostname will be sent to the DHCP server. Currently only has an effect on the networkd backend.", + "type": [ + "boolean", + "null" + ] + }, + "use-dns": { + "description": "Default: true. When true, the DNS servers received from the DHCP server will be used and take precedence over any statically configured ones. Currently only has an effect on the networkd backend.", + "type": [ + "boolean", + "null" + ] + }, + "use-domains": { + "description": "Takes a boolean, or the special value “route”. When true, the domain name received from the DHCP server will be used as DNS search domain over this link, similar to the effect of the Domains= setting. If set to “route”, the domain name received from the DHCP server will be used for routing DNS queries only, but not for searching, similar to the effect of the Domains= setting when the argument is prefixed with “~”.", + "type": [ + "string", + "null" + ] + }, + "use-hostname": { + "description": "Default: true. When true, the hostname received from the DHCP server will be set as the transient hostname of the system. Currently only has an effect on the networkd backend.", + "type": [ + "boolean", + "null" + ] + }, + "use-mtu": { + "description": "Default: true. When true, the MTU received from the DHCP server will be set as the MTU of the network interface. When false, the MTU advertised by the DHCP server will be ignored. Currently only has an effect on the networkd backend.", + "type": [ + "boolean", + "null" + ] + }, + "use-ntp": { + "description": "Default: true. When true, the NTP servers received from the DHCP server will be used by systemd-timesyncd and take precedence over any statically configured ones. Currently only has an effect on the networkd backend.", + "type": [ + "boolean", + "null" + ] + }, + "use-routes": { + "description": "Default: true. When true, the routes received from the DHCP server will be installed in the routing table normally. When set to false, routes from the DHCP server will be ignored: in this case, the user is responsible for adding static routes if necessary for correct network operation. This allows users to avoid installing a default gateway for interfaces configured via DHCP. Available for both the networkd and NetworkManager backends.", + "type": [ + "boolean", + "null" + ] + } + } + }, + "DummyDeviceConfig": { + "description": "Purpose: Use the dummy-devices key to create virtual interfaces.\n\nStructure: The key consists of a mapping of interface names. Dummy devices are virtual devices that can be used to route packets to without actually transmitting them.", + "type": "object", + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + } + } + }, + "EmbeddedSwitchMode": { + "type": "string", + "enum": [ + "switchdev", + "legacy" + ] + }, + "EthernetConfig": { + "description": "Common properties for physical device types", + "type": "object", + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "delay-virtual-functions-rebind": { + "description": "(SR-IOV devices only) Delay rebinding of SR-IOV virtual functions to its driver after changing the embedded-switch-mode setting to a later stage. Can be enabled when bonding/VF LAG is in use. Defaults to false.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "embedded-switch-mode": { + "description": "(SR-IOV devices only) Change the operational mode of the embedded switch of a supported SmartNIC PCI device (e.g. Mellanox ConnectX-5). Possible values are switchdev or legacy, if unspecified the vendor’s default configuration is used.", + "anyOf": [ + { + "$ref": "#/definitions/EmbeddedSwitchMode" + }, + { + "type": "null" + } + ] + }, + "emit-lldp": { + "description": "(networkd backend only) Whether to emit LLDP packets. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "generic-receive-offload": { + "description": "(networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "generic-segmentation-offload": { + "description": "(networkd backend only) If set to true, the Generic Segmentation Offload (GSO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "large-receive-offload": { + "description": "(networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "link": { + "description": "(SR-IOV devices only) The link property declares the device as a Virtual Function of the selected Physical Function device, as identified by the given netplan id.", + "type": [ + "string", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "match": { + "description": "This selects a subset of available physical devices by various hardware properties. The following configuration will then apply to all matching devices, as soon as they appear. All specified properties must match.", + "anyOf": [ + { + "$ref": "#/definitions/MatchConfig" + }, + { + "type": "null" + } + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "openvswitch": { + "description": "This provides additional configuration for the network device for openvswitch. If openvswitch is not available on the system, netplan treats the presence of openvswitch configuration as an error.\n\nAny supported network device that is declared with the openvswitch mapping (or any bond/bridge that includes an interface with an openvswitch configuration) will be created in openvswitch instead of the defined renderer. In the case of a vlan definition declared the same way, netplan will create a fake VLAN bridge in openvswitch with the requested vlan properties.", + "anyOf": [ + { + "$ref": "#/definitions/OpenVSwitchConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "receive-checksum-offload": { + "description": "(networkd backend only) If set to true, the hardware offload for checksumming of ingress network packets is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + }, + "set-name": { + "description": "When matching on unique properties such as path or MAC, or with additional assumptions such as “there will only ever be one wifi device”, match rules can be written so that they only match one device. Then this property can be used to give that device a more specific/desirable/nicer name than the default from udev’s ifnames. Any additional device that satisfies the match rules will then fail to get renamed and keep the original kernel name (and dmesg will show an error).", + "type": [ + "string", + "null" + ] + }, + "tcp-segmentation-offload": { + "description": "(networkd backend only) If set to true, the TCP Segmentation Offload (TSO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "tcp6-segmentation-offload": { + "description": "(networkd backend only) If set to true, the TCP6 Segmentation Offload (tx-tcp6-segmentation) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "transmit-checksum-offload": { + "description": "(networkd backend only) If set to true, the hardware offload for checksumming of egress network packets is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "virtual-function-count": { + "description": "(SR-IOV devices only) In certain special cases VFs might need to be configured outside of netplan. For such configurations virtual-function-count can be optionally used to set an explicit number of Virtual Functions for the given Physical Function. If unset, the default is to create only as many VFs as are defined in the netplan configuration. This should be used for special cases only.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "wakeonlan": { + "description": "Enable wake on LAN. Off by default.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting wake on LAN.", + "type": [ + "boolean", + "null" + ] + } + } + }, + "FailMode": { + "type": "string", + "enum": [ + "Secure", + "Standalone" + ] + }, + "FailOverMacPolicy": { + "description": "Set whether to set all slaves to the same MAC address when adding them to the bond, or how else the system should handle MAC addresses. The possible values are none, active, and follow.", + "type": "string", + "enum": [ + "none", + "activv", + "follow" + ] + }, + "Ipv6AddressGeneration": { + "type": "string", + "enum": [ + "eui64", + "stable-privacy" + ] + }, + "KeyManagmentMode": { + "oneOf": [ + { + "type": "string", + "enum": [ + "none", + "psk", + "eap", + "sae" + ] + }, + { + "description": "802.1x", + "type": "string", + "enum": [ + "802.1x" + ] + } + ] + }, + "Lacp": { + "type": "string", + "enum": [ + "Active", + "Passive", + "Off" + ] + }, + "LacpRate": { + "description": "Set the rate at which LACPDUs are transmitted. This is only useful in 802.3ad mode. Possible values are slow (30 seconds, default), and fast (every second).", + "type": "string", + "enum": [ + "slow", + "fast" + ] + }, + "MatchConfig": { + "description": "This selects a subset of available physical devices by various hardware properties. The following configuration will then apply to all matching devices, as soon as they appear. All specified properties must match.", + "type": "object", + "properties": { + "driver": { + "description": "Kernel driver name, corresponding to the DRIVER udev property. A sequence of globs is supported, any of which must match. Matching on driver is only supported with networkd.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Device’s MAC address in the form “XX:XX:XX:XX:XX:XX”. Globs are not allowed.", + "type": [ + "string", + "null" + ] + }, + "name": { + "description": "Current interface name. Globs are supported, and the primary use case for matching on names, as selecting one fixed name can be more easily achieved with having no match: at all and just using the ID (see above). (NetworkManager: as of v1.14.0)", + "type": [ + "string", + "null" + ] + } + } + }, + "NameserverConfig": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "type": "object", + "properties": { + "addresses": { + "description": "A list of IPv4 or IPv6 addresses", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "search": { + "description": "A list of search domains.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + } + } + }, + "NetworkConfig": { + "type": "object", + "required": [ + "version" + ], + "properties": { + "bonds": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/BondConfig" + } + }, + "bridges": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/BridgeConfig" + } + }, + "dummy-devices": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/DummyDeviceConfig" + } + }, + "ethernets": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/EthernetConfig" + } + }, + "renderer": { + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "tunnels": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/TunnelConfig" + } + }, + "version": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "vlans": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/VlanConfig" + } + }, + "vrfs": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/VrfsConfig" + } + }, + "wifis": { + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/WifiConfig" + } + } + } + }, + "OpenFlowProtocol": { + "type": "string", + "enum": [ + "OpenFlow10", + "OpenFlow11", + "OpenFlow12", + "OpenFlow13", + "OpenFlow14", + "OpenFlow15", + "OpenFlow16" + ] + }, + "OpenVSwitchConfig": { + "description": "This provides additional configuration for the network device for openvswitch. If openvswitch is not available on the system, netplan treats the presence of openvswitch configuration as an error.\n\nAny supported network device that is declared with the openvswitch mapping (or any bond/bridge that includes an interface with an openvswitch configuration) will be created in openvswitch instead of the defined renderer. In the case of a vlan definition declared the same way, netplan will create a fake VLAN bridge in openvswitch with the requested vlan properties.", + "type": "object", + "properties": { + "controller": { + "description": "Valid for bridge interfaces. Specify an external OpenFlow controller.", + "anyOf": [ + { + "$ref": "#/definitions/ControllerConfig" + }, + { + "type": "null" + } + ] + }, + "external-ids": { + "description": "Passed-through directly to OpenVSwitch", + "type": [ + "string", + "null" + ] + }, + "fail-mode": { + "description": "Valid for bridge interfaces. Accepts secure or standalone (the default).", + "anyOf": [ + { + "$ref": "#/definitions/FailMode" + }, + { + "type": "null" + } + ] + }, + "lacp": { + "description": "Valid for bond interfaces. Accepts active, passive or off (the default).", + "anyOf": [ + { + "$ref": "#/definitions/Lacp" + }, + { + "type": "null" + } + ] + }, + "mcast-snooping": { + "description": "Valid for bridge interfaces. False by default.", + "type": [ + "boolean", + "null" + ] + }, + "other-config": { + "description": "Passed-through directly to OpenVSwitch", + "type": [ + "string", + "null" + ] + }, + "ports": { + "description": "OpenvSwitch patch ports. Each port is declared as a pair of names which can be referenced as interfaces in dependent virtual devices (bonds, bridges).", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "protocols": { + "description": "Valid for bridge interfaces or the network section. List of protocols to be used when negotiating a connection with the controller. Accepts OpenFlow10, OpenFlow11, OpenFlow12, OpenFlow13, OpenFlow14, OpenFlow15 and OpenFlow16.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/OpenFlowProtocol" + } + }, + "rtsp": { + "description": "Valid for bridge interfaces. False by default.", + "type": [ + "boolean", + "null" + ] + }, + "ssl": { + "description": "Valid for global openvswitch settings. Options for configuring SSL server endpoint for the switch.", + "anyOf": [ + { + "$ref": "#/definitions/SslConfig" + }, + { + "type": "null" + } + ] + } + } + }, + "PreferredLifetime": { + "type": "string", + "enum": [ + "forever", + "0" + ] + }, + "PrimaryReselectPolicy": { + "description": "Set the reselection policy for the primary slave. On failure of the active slave, the system will use this policy to decide how the new active slave will be chosen and how recovery will be handled. The possible values are always, better, and failure.", + "type": "string", + "enum": [ + "always", + "better", + "failure" + ] + }, + "Renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "type": "string", + "enum": [ + "networkd", + "NetworkManager", + "sriov" + ] + }, + "RouteScope": { + "description": "The route scope, how wide-ranging it is to the network. Possible values are “global”, “link”, or “host”.", + "type": "string", + "enum": [ + "global", + "link", + "host" + ] + }, + "RouteType": { + "description": "The type of route. Valid options are “unicast” (default), “anycast”, “blackhole”, “broadcast”, “local”, “multicast”, “nat”, “prohibit”, “throw”, “unreachable” or “xresolve”.", + "type": "string", + "enum": [ + "unicast", + "anycast", + "blackhole", + "broadcast", + "local", + "multicast", + "nat", + "prohibit", + "throw", + "unreachable", + "xresolve" + ] + }, + "RoutingConfig": { + "description": "The routes block defines standard static routes for an interface. At least to must be specified. If type is local or nat a default scope of host is assumed. If type is unicast and no gateway (via) is given or type is broadcast, multicast or anycast a default scope of link is assumend. Otherwise, a global scope is the default setting.\n\nFor from, to, and via, both IPv4 and IPv6 addresses are recognized, and must be in the form addr/prefixlen or addr.", + "type": "object", + "properties": { + "advertised-receive-window": { + "description": "The receive window to be advertised for the route, represented by number of segments. Must be a positive integer value.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "congestion-window": { + "description": "The congestion window to be used for the route, represented by number of segments. Must be a positive integer value.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "from": { + "description": "Set a source IP address for traffic going through the route. (NetworkManager: as of v1.8.0)", + "type": [ + "string", + "null" + ] + }, + "metric": { + "description": "The relative priority of the route. Must be a positive integer value.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "mtu": { + "description": "The MTU to be used for the route, in bytes. Must be a positive integer value.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "on-link": { + "description": "When set to “true”, specifies that the route is directly connected to the interface. (NetworkManager: as of v1.12.0 for IPv4 and v1.18.0 for IPv6)", + "type": [ + "boolean", + "null" + ] + }, + "scope": { + "description": "The route scope, how wide-ranging it is to the network. Possible values are “global”, “link”, or “host”.", + "anyOf": [ + { + "$ref": "#/definitions/RouteScope" + }, + { + "type": "null" + } + ] + }, + "table": { + "description": "The table number to use for the route. In some scenarios, it may be useful to set routes in a separate routing table. It may also be used to refer to routing policy rules which also accept a table parameter. Allowed values are positive integers starting from 1. Some values are already in use to refer to specific routing tables: see /etc/iproute2/rt_tables. (NetworkManager: as of v1.10.0)", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "to": { + "description": "Destination address for the route.", + "type": [ + "string", + "null" + ] + }, + "type": { + "description": "The type of route. Valid options are “unicast” (default), “anycast”, “blackhole”, “broadcast”, “local”, “multicast”, “nat”, “prohibit”, “throw”, “unreachable” or “xresolve”.", + "anyOf": [ + { + "$ref": "#/definitions/RouteType" + }, + { + "type": "null" + } + ] + }, + "via": { + "description": "Address to the gateway to use for this route.", + "type": [ + "string", + "null" + ] + } + } + }, + "RoutingPolicy": { + "description": "The routing-policy block defines extra routing policy for a network, where traffic may be handled specially based on the source IP, firewall marking, etc.\n\nFor from, to, both IPv4 and IPv6 addresses are recognized, and must be in the form addr/prefixlen or addr.", + "type": "object", + "required": [ + "table" + ], + "properties": { + "from": { + "description": "Set a source IP address to match traffic for this policy rule.", + "type": [ + "string", + "null" + ] + }, + "mark": { + "description": "Have this routing policy rule match on traffic that has been marked by the iptables firewall with this value. Allowed values are positive integers starting from 1.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "priority": { + "description": "Specify a priority for the routing policy rule, to influence the order in which routing rules are processed. A higher number means lower priority: rules are processed in order by increasing priority number.", + "type": [ + "integer", + "null" + ], + "format": "int32" + }, + "table": { + "description": "The table number to match for the route. In some scenarios, it may be useful to set routes in a separate routing table. It may also be used to refer to routes which also accept a table parameter. Allowed values are positive integers starting from 1. Some values are already in use to refer to specific routing tables: see /etc/iproute2/rt_tables.", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "to": { + "description": "Match on traffic going to the specified destination.", + "type": [ + "string", + "null" + ] + }, + "type-of-service": { + "description": "Match this policy rule based on the type of service number applied to the traffic.", + "type": [ + "string", + "null" + ] + } + } + }, + "SslConfig": { + "description": "Valid for global openvswitch settings. Options for configuring SSL server endpoint for the switch.", + "type": "object", + "properties": { + "ca-cert": { + "description": "Path to a file containing the CA certificate to be used.", + "type": [ + "string", + "null" + ] + }, + "certificate": { + "description": "Path to a file containing the server certificate.", + "type": [ + "string", + "null" + ] + }, + "private-key": { + "description": "Path to a file containing the private key for the server.", + "type": [ + "string", + "null" + ] + } + } + }, + "TransmitHashPolicy": { + "description": "Specifies the transmit hash policy for the selection of slaves. This is only useful in balance-xor, 802.3ad and balance-tlb modes. Possible values are layer2, layer3+4, layer2+3, encap2+3, and encap3+4.", + "type": "string", + "enum": [ + "layer2", + "layer3+4", + "layer2+3", + "encap2+3", + "encap3+4" + ] + }, + "TunnelConfig": { + "description": "Tunnels allow traffic to pass as if it was between systems on the same local network, although systems may be far from each other but reachable via the Internet. They may be used to support IPv6 traffic on a network where the ISP does not provide the service, or to extend and “connect” separate local networks. Please see for more general information about tunnels.", + "type": "object", + "required": [ + "peers" + ], + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "key": { + "description": "Define keys to use for the tunnel. The key can be a number or a dotted quad (an IPv4 address). For wireguard it can be a base64-encoded private key or (as of networkd v242+) an absolute path to a file, containing the private key (since 0.100). It is used for identification of IP transforms. This is only required for vti and vti6 when using the networkd backend, and for gre or ip6gre tunnels when using the NetworkManager backend.\n\nThis field may be used as a scalar (meaning that a single key is specified and to be used for input, output and private key), or as a mapping, where you can further specify input/output/private.", + "anyOf": [ + { + "$ref": "#/definitions/TunnelKey" + }, + { + "type": "null" + } + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "local": { + "description": "Defines the address of the local endpoint of the tunnel.", + "type": [ + "string", + "null" + ] + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "mark": { + "description": "Firewall mark for outgoing WireGuard packets from this interface, optional.", + "type": [ + "string", + "null" + ] + }, + "mode": { + "description": "Defines the tunnel mode. Valid options are sit, gre, ip6gre, ipip, ipip6, ip6ip6, vti, vti6 and wireguard. Additionally, the networkd backend also supports gretap and ip6gretap modes. In addition, the NetworkManager backend supports isatap tunnels.", + "anyOf": [ + { + "$ref": "#/definitions/TunnelMode" + }, + { + "type": "null" + } + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "peers": { + "description": "A list of peers", + "type": "array", + "items": { + "$ref": "#/definitions/WireGuardPeer" + } + }, + "port": { + "description": "UDP port to listen at or auto. Optional, defaults to auto.", + "type": [ + "string", + "null" + ] + }, + "remote": { + "description": "Defines the address of the remote endpoint of the tunnel.", + "type": [ + "string", + "null" + ] + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + }, + "ttl": { + "description": "Defines the TTL of the tunnel.", + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + } + }, + "TunnelKey": { + "description": "Define keys to use for the tunnel. The key can be a number or a dotted quad (an IPv4 address). For wireguard it can be a base64-encoded private key or (as of networkd v242+) an absolute path to a file, containing the private key (since 0.100). It is used for identification of IP transforms. This is only required for vti and vti6 when using the networkd backend, and for gre or ip6gre tunnels when using the NetworkManager backend.\n\nThis field may be used as a scalar (meaning that a single key is specified and to be used for input, output and private key), or as a mapping, where you can further specify input/output/private.", + "oneOf": [ + { + "type": "object", + "required": [ + "Simple" + ], + "properties": { + "Simple": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Complex" + ], + "properties": { + "Complex": { + "type": "object", + "properties": { + "input": { + "description": "The input key for the tunnel", + "type": [ + "string", + "null" + ] + }, + "output": { + "description": "The output key for the tunnel", + "type": [ + "string", + "null" + ] + }, + "private": { + "description": "A base64-encoded private key required for WireGuard tunnels. When the systemd-networkd backend (v242+) is used, this can also be an absolute path to a file containing the private key.", + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "TunnelMode": { + "description": "Defines the tunnel mode. Valid options are sit, gre, ip6gre, ipip, ipip6, ip6ip6, vti, vti6 and wireguard. Additionally, the networkd backend also supports gretap and ip6gretap modes. In addition, the NetworkManager backend supports isatap tunnels.", + "type": "string", + "enum": [ + "sit", + "gre", + "ip6gre", + "ipip", + "ipip6", + "ip6ip6", + "vti", + "vti6", + "wireguard", + "gretap", + "ip6gretap", + "isatap" + ] + }, + "VlanConfig": { + "type": "object", + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "id": { + "description": "VLAN ID, a number between 0 and 4094.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "link": { + "description": "netplan ID of the underlying device definition on which this VLAN gets created.", + "type": [ + "string", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + } + } + }, + "VrfsConfig": { + "description": "Purpose: Use the vrfs key to create Virtual Routing and Forwarding (VRF) interfaces.\n\nStructure: The key consists of a mapping of VRF interface names. The interface used in the link option (enp5s0 in the example below) must also be defined in the Netplan configuration. The general configuration structure for VRFs is shown below.", + "type": "object", + "required": [ + "interfaces", + "table" + ], + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "interfaces": { + "description": "All devices matching this ID list will be added to the VRF. This may be an empty list, in which case the VRF will be brought online with no member interfaces.", + "type": "array", + "items": { + "type": "string" + } + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + }, + "table": { + "description": "The numeric routing table identifier. This setting is compulsory.", + "type": "integer", + "format": "int32" + } + } + }, + "WakeOnWLan": { + "description": "This enables WakeOnWLan on supported devices. Not all drivers support all options. May be any combination of any, disconnect, magic_pkt, gtk_rekey_failure, eap_identity_req, four_way_handshake, rfkill_release or tcp (NetworkManager only). Or the exclusive default flag (the default).", + "type": "string", + "enum": [ + "any", + "disconnect", + "magic_pkt", + "gtk_rekey_failure", + "eap_identity_req", + "four_way_handshake", + "rfkill_release", + "tcp", + "default" + ] + }, + "WifiConfig": { + "description": "Common properties for physical device types", + "type": "object", + "properties": { + "accept-ra": { + "description": "Accept Router Advertisement that would have the kernel configure IPv6 by itself. When enabled, accept Router Advertisements. When disabled, do not respond to Router Advertisements. If unset use the host kernel default setting.", + "type": [ + "boolean", + "null" + ] + }, + "access-points": { + "description": "This provides pre-configured connections to NetworkManager. Note that users can of course select other access points/SSIDs. The keys of the mapping are the SSIDs, and the values are mappings with the following supported properties:", + "type": [ + "object", + "null" + ], + "additionalProperties": { + "$ref": "#/definitions/AccessPointConfig" + } + }, + "activation-mode": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "anyOf": [ + { + "$ref": "#/definitions/lowercase" + }, + { + "type": "null" + } + ] + }, + "addresses": { + "description": "Add static addresses to the interface in addition to the ones received through DHCP or RA. Each sequence entry is in CIDR notation, i. e. of the form addr/prefixlen. addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and prefixlen the number of bits of the subnet.\n\nFor virtual devices (bridges, bonds, vlan) if there is no address configured and DHCP is disabled, the interface may still be brought online, but will not be addressable from the network.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/AddressMapping" + } + }, + "critical": { + "description": "Designate the connection as “critical to the system”, meaning that special care will be taken by to not release the assigned IP when the daemon is restarted. (not recognized by NetworkManager)", + "type": [ + "boolean", + "null" + ] + }, + "dhcp-identifier": { + "description": "(networkd backend only) Sets the source of DHCPv4 client identifier. If mac is specified, the MAC address of the link is used. If this option is omitted, or if duid is specified, networkd will generate an RFC4361-compliant client identifier for the interface by combining the link’s IAID and DUID.", + "type": [ + "string", + "null" + ] + }, + "dhcp4": { + "description": "Enable DHCP for IPv4. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp4-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "dhcp6": { + "description": "Enable DHCP for IPv6. Off by default. This covers both stateless DHCP - where the DHCP server supplies information like DNS nameservers but not the IP address - and stateful DHCP, where the server provides both the address and the other information.\n\nIf you are in an IPv6-only environment with completely stateless autoconfiguration (SLAAC with RDNSS), this option can be set to cause the interface to be brought up. (Setting accept-ra alone is not sufficient.) Autoconfiguration will still honour the contents of the router advertisement and only use DHCP if requested in the RA.\n\nNote that rdnssd(8) is required to use RDNSS with networkd. No extra software is required for NetworkManager.", + "type": [ + "boolean", + "null" + ] + }, + "dhcp6-overrides": { + "description": "(networkd backend only) Overrides default DHCP behavior", + "anyOf": [ + { + "$ref": "#/definitions/DhcpOverrides" + }, + { + "type": "null" + } + ] + }, + "emit-lldp": { + "description": "(networkd backend only) Whether to emit LLDP packets. Off by default.", + "type": [ + "boolean", + "null" + ] + }, + "gateway4": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "gateway6": { + "description": "Deprecated, see Default routes. Set default gateway for IPv4/6, for manual address configuration. This requires setting addresses too. Gateway IPs must be in a form recognized by inet_pton(3). There should only be a single gateway per IP address family set in your global config, to make it unambiguous. If you need multiple default routes, please define them via routing-policy.", + "type": [ + "string", + "null" + ] + }, + "generic-receive-offload": { + "description": "(networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "generic-segmentation-offload": { + "description": "(networkd backend only) If set to true, the Generic Segmentation Offload (GSO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "ignore-carrier": { + "description": "(networkd backend only) Allow the specified interface to be configured even if it has no carrier.", + "type": [ + "boolean", + "null" + ] + }, + "ipv6-address-generation": { + "description": "Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration (only supported with NetworkManager backend). Possible values are eui64 or stable-privacy.", + "anyOf": [ + { + "$ref": "#/definitions/Ipv6AddressGeneration" + }, + { + "type": "null" + } + ] + }, + "ipv6-address-token": { + "description": "Define an IPv6 address token for creating a static interface identifier for IPv6 Stateless Address Autoconfiguration. This is mutually exclusive with ipv6-address-generation.", + "type": [ + "string", + "null" + ] + }, + "ipv6-mtu": { + "description": "Set the IPv6 MTU (only supported with networkd backend). Note that needing to set this is an unusual requirement.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "ipv6-privacy": { + "description": "Enable IPv6 Privacy Extensions (RFC 4941) for the specified interface, and prefer temporary addresses. Defaults to false - no privacy extensions. There is currently no way to have a private address but prefer the public address.", + "type": [ + "boolean", + "null" + ] + }, + "large-receive-offload": { + "description": "(networkd backend only) If set to true, the Generic Receive Offload (GRO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "link-local": { + "description": "Configure the link-local addresses to bring up. Valid options are ‘ipv4’ and ‘ipv6’, which respectively allow enabling IPv4 and IPv6 link local addressing. If this field is not defined, the default is to enable only IPv6 link-local addresses. If the field is defined but configured as an empty set, IPv6 link-local addresses are disabled as well as IPv4 link- local addresses.\n\nThis feature enables or disables link-local addresses for a protocol, but the actual implementation differs per backend. On networkd, this directly changes the behavior and may add an extra address on an interface. When using the NetworkManager backend, enabling link-local has no effect if the interface also has DHCP enabled.\n\nExample to enable only IPv4 link-local: `link-local: [ ipv4 ]` Example to enable all link-local addresses: `link-local: [ ipv4, ipv6 ]` Example to disable all link-local addresses: `link-local: [ ]`", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "macaddress": { + "description": "Set the device’s MAC address. The MAC address must be in the form “XX:XX:XX:XX:XX:XX”.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MAC addresses.", + "type": [ + "string", + "null" + ] + }, + "match": { + "description": "This selects a subset of available physical devices by various hardware properties. The following configuration will then apply to all matching devices, as soon as they appear. All specified properties must match.", + "anyOf": [ + { + "$ref": "#/definitions/MatchConfig" + }, + { + "type": "null" + } + ] + }, + "mtu": { + "description": "Set the Maximum Transmission Unit for the interface. The default is 1500. Valid values depend on your network interface.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting MTU.", + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + }, + "nameservers": { + "description": "Set DNS servers and search domains, for manual address configuration.", + "anyOf": [ + { + "$ref": "#/definitions/NameserverConfig" + }, + { + "type": "null" + } + ] + }, + "openvswitch": { + "description": "This provides additional configuration for the network device for openvswitch. If openvswitch is not available on the system, netplan treats the presence of openvswitch configuration as an error.\n\nAny supported network device that is declared with the openvswitch mapping (or any bond/bridge that includes an interface with an openvswitch configuration) will be created in openvswitch instead of the defined renderer. In the case of a vlan definition declared the same way, netplan will create a fake VLAN bridge in openvswitch with the requested vlan properties.", + "anyOf": [ + { + "$ref": "#/definitions/OpenVSwitchConfig" + }, + { + "type": "null" + } + ] + }, + "optional": { + "description": "An optional device is not required for booting. Normally, networkd will wait some time for device to become configured before proceeding with booting. However, if a device is marked as optional, networkd will not wait for it. This is only supported by networkd, and the default is false.", + "type": [ + "boolean", + "null" + ] + }, + "optional-addresses": { + "description": "Specify types of addresses that are not required for a device to be considered online. This changes the behavior of backends at boot time to avoid waiting for addresses that are marked optional, and thus consider the interface as “usable” sooner. This does not disable these addresses, which will be brought up anyway.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "receive-checksum-offload": { + "description": "(networkd backend only) If set to true, the hardware offload for checksumming of ingress network packets is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "renderer": { + "description": "Use the given networking backend for this definition. Currently supported are networkd and NetworkManager. This property can be specified globally in network:, for a device type (in e. g. ethernets:) or for a particular device definition. Default is networkd.\n\n(Since 0.99) The renderer property has one additional acceptable value for vlan objects (i. e. defined in vlans:): sriov. If a vlan is defined with the sriov renderer for an SR-IOV Virtual Function interface, this causes netplan to set up a hardware VLAN filter for it. There can be only one defined per VF.", + "anyOf": [ + { + "$ref": "#/definitions/Renderer" + }, + { + "type": "null" + } + ] + }, + "routes": { + "description": "Configure static routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingConfig" + } + }, + "routing-policy": { + "description": "Configure policy routing for the device", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RoutingPolicy" + } + }, + "set-name": { + "description": "When matching on unique properties such as path or MAC, or with additional assumptions such as “there will only ever be one wifi device”, match rules can be written so that they only match one device. Then this property can be used to give that device a more specific/desirable/nicer name than the default from udev’s ifnames. Any additional device that satisfies the match rules will then fail to get renamed and keep the original kernel name (and dmesg will show an error).", + "type": [ + "string", + "null" + ] + }, + "tcp-segmentation-offload": { + "description": "(networkd backend only) If set to true, the TCP Segmentation Offload (TSO) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "tcp6-segmentation-offload": { + "description": "(networkd backend only) If set to true, the TCP6 Segmentation Offload (tx-tcp6-segmentation) is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "transmit-checksum-offload": { + "description": "(networkd backend only) If set to true, the hardware offload for checksumming of egress network packets is enabled. When unset, the kernel’s default will be used.", + "type": [ + "boolean", + "null" + ] + }, + "wakeonlan": { + "description": "Enable wake on LAN. Off by default.\n\nNote: This will not work reliably for devices matched by name only and rendered by networkd, due to interactions with device renaming in udev. Match devices by MAC when setting wake on LAN.", + "type": [ + "boolean", + "null" + ] + }, + "wakeonwlan": { + "description": "This enables WakeOnWLan on supported devices. Not all drivers support all options. May be any combination of any, disconnect, magic_pkt, gtk_rekey_failure, eap_identity_req, four_way_handshake, rfkill_release or tcp (NetworkManager only). Or the exclusive default flag (the default).", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/WakeOnWLan" + } + } + } + }, + "WireGuardPeer": { + "description": "A list of peers", + "type": "object", + "properties": { + "allowed-ips": { + "description": "A list of IP (v4 or v6) addresses with CIDR masks from which this peer is allowed to send incoming traffic and to which outgoing traffic for this peer is directed. The catch-all 0.0.0.0/0 may be specified for matching all IPv4 addresses, and ::/0 may be specified for matching all IPv6 addresses.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "endpoint": { + "description": "Remote endpoint IPv4/IPv6 address or a hostname, followed by a colon and a port number.", + "type": [ + "string", + "null" + ] + }, + "keepalive": { + "description": "An interval in seconds, between 1 and 65535 inclusive, of how often to send an authenticated empty packet to the peer for the purpose of keeping a stateful firewall or NAT mapping valid persistently. Optional.", + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "keys": { + "description": "Define keys to use for the WireGuard peers.", + "anyOf": [ + { + "$ref": "#/definitions/WireGuardPeerKey" + }, + { + "type": "null" + } + ] + } + } + }, + "WireGuardPeerKey": { + "description": "Define keys to use for the WireGuard peers.\n\nThis field can be used as a mapping, where you can further specify the public and shared keys.", + "type": "object", + "properties": { + "public": { + "description": "A base64-encoded public key, required for WireGuard peers.", + "type": [ + "string", + "null" + ] + }, + "shared": { + "description": "A base64-encoded preshared key. Optional for WireGuard peers. When the systemd-networkd backend (v242+) is used, this can also be an absolute path to a file containing the preshared key.", + "type": [ + "string", + "null" + ] + } + } + }, + "WirelessBand": { + "description": "Possible bands are 5GHz (for 5GHz 802.11a) and 2.4GHz (for 2.4GHz 802.11), do not restrict the 802.11 frequency band of the network if unset (the default).", + "oneOf": [ + { + "description": "2.4Ghz", + "type": "string", + "enum": [ + "2.4GHz" + ] + }, + { + "description": "5Ghz", + "type": "string", + "enum": [ + "5GHz" + ] + } + ] + }, + "lowercase": { + "description": "Allows specifying the management policy of the selected interface. By default, netplan brings up any configured interface if possible. Using the activation-mode setting users can override that behavior by either specifying manual, to hand over control over the interface state to the administrator or (for networkd backend only) off to force the link in a down state at all times. Any interface with activation-mode defined is implicitly considered optional. Supported officially as of networkd v248+.", + "type": "string", + "enum": [ + "Manual", + "Off" + ] + } + } +}