Crate netplan_types

Source
Expand description

netplan-types

§Motivation

This crate attempts to map the entire netplan configuration into Rust structs and enums. The ‘layout’ is as close to what you’d write in your netplan YAML files.

The intented use of this crate is to allow for easy editing of the network configuration via the netplan configuration files from a Rust program.

Based on the documentation from netplan, which can be found here Please note that I do not check the docs often for updates, if anything is missing or incorrect in the future, please open an issue or a pull-request so the issue can be addressed.

§Features

  • serde: [Default] Add serde support
  • derive_builder Enable the derive_builder crate for an automatically generated builder pattern API
  • schemars: Enable the schemars crate for generating a JSON schema from the structs

Structs§

AccessPointConfig
AuthConfig
Netplan supports advanced authentication settings for ethernet and wifi interfaces, as well as individual wifi networks, by means of the auth block.
BondConfig
BondParameters
BridgeConfig
BridgeParameters
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.
CommonPropertiesAllDevices
CommonPropertiesPhysicalDeviceType
Common properties for physical device types
ControllerConfig
Valid for bridge interfaces. Specify an external OpenFlow controller.
DhcpOverrides
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.
DummyDeviceConfig
Purpose: Use the dummy-devices key to create virtual interfaces.
EthernetConfig
MatchConfig
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.
ModemConfig
GSM/CDMA modem configuration is only supported for the NetworkManager backend. systemd-networkd does not support modems.
NameserverConfig
Set DNS servers and search domains, for manual address configuration.
NetplanConfig
NetworkConfig
OpenVSwitchConfig
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.
RoutingConfig
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.
RoutingPolicy
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.
SslConfig
Valid for global openvswitch settings. Options for configuring SSL server endpoint for the switch.
TunnelConfig
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 https://en.wikipedia.org/wiki/Tunneling_protocol for more general information about tunnels.
VlanConfig
VrfsConfig
Purpose: Use the vrfs key to create Virtual Routing and Forwarding (VRF) interfaces.
WifiConfig
WireGuardPeer
A list of peers
WireGuardPeerKey
Define keys to use for the WireGuard peers.

Enums§

AccessPointMode
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.
ActivationMode
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+.
AdSelect
Set the aggregation selection mode. Possible values are stable, bandwidth, and count. This option is only used in 802.3ad mode.
AddressMapping
ArpAllTargets
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.
ArpValidate
Configure how ARP replies are to be validated when using ARP link monitoring. Possible values are none, active, backup, and all.
AuthMethod
BondMode
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.
ConnectionMode
EmbeddedSwitchMode
FailMode
FailOverMacPolicy
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.
Ipv6AddressGeneration
KeyManagmentMode
Lacp
LacpRate
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).
OpenFlowProtocol
PreferredLifetime
PrimaryReselectPolicy
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.
Renderer
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.
RouteScope
The route scope, how wide-ranging it is to the network. Possible values are “global”, “link”, or “host”.
RouteType
The type of route. Valid options are “unicast” (default), “anycast”, “blackhole”, “broadcast”, “local”, “multicast”, “nat”, “prohibit”, “throw”, “unreachable” or “xresolve”.
TransmitHashPolicy
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.
TunnelKey
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.
TunnelMode
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.
UseDomains
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 “~”.
WakeOnWLan
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).
WirelessBand
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).