跳到主要内容

Resource API v1alpha1

routerd configuration is a top-level Router resource with a list of typed resources. This page summarizes the current implemented API surface.

Since Phase 1.6, DHCP names follow RFC spelling: DHCPv4* and DHCPv6*. There are no compatibility aliases for the earlier names.

Common Shape

apiVersion: net.routerd.net/v1alpha1
kind: Interface
metadata:
name: wan
spec:
ifname: ens18
adminUp: true
FieldMeaning
apiVersionAPI group and version.
kindResource kind.
metadata.nameName inside the kind.
specDesired intent declared by the user.
statusObserved state written by routerd or a managed daemon.

API Groups

API groupMain kinds
routerd.net/v1alpha1Router
net.routerd.net/v1alpha1interfaces, DHCP, DNS, routes, tunnels, events, traffic flow logs
firewall.routerd.net/v1alpha1FirewallZone, FirewallPolicy, FirewallRule, FirewallLog
system.routerd.net/v1alpha1Hostname, Sysctl, Package, NetworkAdoption, SystemdUnit, NTPClient, LogSink, LogRetention, WebConsole, NixOSHost
observability.routerd.net/v1alpha1Telemetry
plugin.routerd.net/v1alpha1plugin manifests

System Bootstrap

KindRole
PackageDeclares OS-specific packages and installs missing packages where the platform supports it.
SysctlSets one sysctl value. Readback comparison can be exact or atLeast.
SysctlProfileApplies router-oriented sysctl defaults.
NetworkAdoptionAdjusts OS DHCP clients and systemd-resolved listeners so routerd can own the interface role.
SystemdUnitGenerates, installs, and enables systemd units used by routerd.
HostnameSets the host name.
NTPClientEnables the OS NTP client.
LogSinkSends routerd events to syslog or another local sink.
LogRetentionManages retention for events, DNS queries, traffic flows, and firewall logs.
WebConsoleEnables the read-only management Web Console.

Observability

KindRole
TelemetryDeclares an external OTLP endpoint and injects OpenTelemetry environment variables into generated service units.
KindRole
InterfaceBinds a stable routerd name to an OS interface name.
LinkPublishes link state for downstream resources.
PPPoEInterfaceDefines PPPoE lower-interface settings.
PPPoESessionRepresents a routerd-pppoe-client session.
WireGuardInterfaceRepresents a WireGuard interface.
WireGuardPeerRepresents a WireGuard peer.
TailscaleNodeConfigures a local Tailscale node for exit-node and subnet-router advertisement through a managed systemd unit.
IPsecConnectionDefines a cloud VPN oriented strongSwan connection.
VRFRepresents a Linux VRF device and route table.
VXLANTunnelRepresents a VXLAN tunnel.

WAN Addressing and Delegation

KindRole
IPv4StaticAddressAssigns a static IPv4 address.
DHCPv4AddressLegacy host DHCP client path. Prefer DHCPv4Lease for new configs.
DHCPv4LeaseDHCPv4 lease managed by routerd-dhcpv4-client.
DHCPv6AddressGroundwork for DHCPv6 IA_NA.
DHCPv6PrefixDelegationDHCPv6-PD lease managed by routerd-dhcpv6-client.
DHCPv6InformationDHCPv6 information request result, including DNS, SNTP, domain search, and AFTR observations.
IPv6DelegatedAddressDerives a LAN-side address from a delegated prefix.
IPv6RAAddressGroundwork for IPv6 addresses learned from RA/SLAAC.

DHCPv6PrefixDelegation no longer selects an OS DHCPv6 client. DHCPv6-PD is owned by routerd-dhcpv6-client.

LAN Services

KindRole
DHCPv4ServerProvides a dnsmasq DHCPv4 pool.
DHCPv4ScopeRepresents a DHCPv4 address range.
DHCPv4ReservationReserves an IPv4 address for a MAC address.
DHCPv4RelayRepresents dnsmasq DHCPv4 relay.
IPv6RouterAdvertisementGenerates RA, PIO, RDNSS, DNSSL, M/O flags, MTU, preference, and lifetimes.
DHCPv6ServerProvides dnsmasq DHCPv6 service in stateless, stateful, or both mode.
DHCPv6ScopeRepresents a DHCPv6 address range.
DNSZoneOwns a local authoritative zone with manual and DHCP-derived records.
DNSResolverOwns routerd-dns-resolver listen profiles, sources, upstreams, and cache.

Android does not use DHCPv6 DNS configuration, so IPv6 LANs should publish RDNSS through IPv6RouterAdvertisement.spec.rdnss.

dnsmasq is limited to DHCPv4, DHCPv6, relay, and RA. DNS answering and forwarding belongs to DNSResolver.

DNSResolver.spec.sources lists local zones, conditional forwarding sources, and default upstreams in priority order. https:// is DoH, tls:// is DoT, quic:// is DoQ, and udp:// is plain DNS. listen can contain multiple profiles, and each listener can choose a subset of sources.

sources[].viaInterface binds outgoing DNS queries to a Linux interface name. sources[].bootstrapResolver supplies resolver addresses for DoH and DoT endpoint name resolution. DNSSEC is configured with DNSZone.spec.dnssec and DNSResolver.spec.sources[].dnssecValidate.

DS-Lite, Routes, and NAT

KindRole
DSLiteTunnelCreates an ip6tnl tunnel to an AFTR. The AFTR can be static IPv6, FQDN, or DHCPv6 information.
IPv4RouteAdds IPv4 routes, including DS-Lite defaults and explicit drop routes.
NAT44RulePerforms IPv4 NAPT in the nftables routerd_nat table.
IPv4SourceNATLegacy IPv4 source NAT groundwork.
IPv4PolicyRouteRepresents IPv4 policy routing.
IPv4PolicyRouteSetGroups multiple policy routes.
IPv4DefaultRoutePolicyRepresents default-route policy.
IPv4ReversePathFilterManages reverse path filter settings.
PathMTUPolicyControls MTU and TCP MSS adjustment. mtu.source: probe can measure path MTU with DF probes.

IPv4PolicyRoute, IPv4PolicyRouteSet, and IPv4DefaultRoutePolicy support excludeDestinationCIDRs. Use it to keep LAN, management, HGW LAN, and RFC 1918 destinations out of policy routing.

NAT44Rule supports destinationCIDRs and excludeDestinationCIDRs. This allows internet traffic to be masqueraded while private routed destinations stay un-NATed.

Coordination

KindRole
HealthCheckMeasures reachability through routerd-healthcheck or the development embedded runner.
EgressRoutePolicySelects the highest-weight ready egress candidate. Candidates can include gateway fields and health checks.
EventRuleEvaluates event streams with all_of, any_of, sequence, window, absence, throttle, debounce, and count.
DerivedEventEmits virtual events derived from multiple resource states.
SelfAddressPolicySelects a self address for protocols that need one.
StatePolicyRepresents state-management policy.

HealthCheck.spec.sourceInterface accepts a network resource name and resolves it to the OS interface name at runtime. via and sourceAddress can also be specified. sourceAddressFrom derives the probe source address from another resource status.

WebConsole.spec.listenAddressFrom derives the HTTP listener address from another resource status, for example Interface/mgmt.status.ipv4Addresses. Use it instead of a literal listenAddress when the management address comes from DHCP, IPAM, or another declarative resource.

Firewall

KindRole
FirewallZoneAssigns interfaces to zones with untrust, trust, and mgmt roles.
FirewallPolicyRepresents global firewall behavior such as deny logging.
FirewallRuleRepresents exceptions that cannot be expressed by the role matrix.

Stateful filtering renders into the nftables inet routerd_filter table. Established traffic, loopback, and required ICMPv6 are always accepted. routerd derives internal openings needed by DHCP, DNS, DS-Lite, and related managed resources.

Renamed Kinds

Phase 1.6 renamed DHCP resources.

OldCurrent
IPv4DHCPAddressDHCPv4Address
IPv4DHCPServerDHCPv4Server
IPv4DHCPReservationDHCPv4Reservation
IPv4DHCPScopeDHCPv4Scope
IPv6DHCPAddressDHCPv6Address
IPv6PrefixDelegationDHCPv6PrefixDelegation
IPv6DHCPServer / IPv6DHCPv6ServerDHCPv6Server
IPv6DHCPScopeDHCPv6Scope
DHCPRelayDHCPv4Relay

The daemon binaries are routerd-dhcpv4-client and routerd-dhcpv6-client.