Skip to content

ServerNetworkInterface

Record in Oadm.Sdk.Network · Oadm.Sdk.dll

One network interface of the OADM server (for core plugins that serve the network, e.g. NTP or DHCP server pages).

public sealed record ServerNetworkInterface(string Id, string Name, string Description, IReadOnlyList<IPAddress> Addresses, bool IsUp, bool IsLoopback)

Parameters

  • Id: Stable id of the OS (NetworkInterface.Id: a GUID on Windows, the name on Linux/macOS).
  • Name: “Ethernet”, “eth0”, “en0”.
  • Description: Adapter description (“Intel(R) Ethernet Connection I219-LM”); may equal the name.
  • Addresses: Unicast addresses, IPv4 first; IPv6 link-local addresses carry their scope id.
  • IsUp: Operational status is Up.
  • IsLoopback: Loopback interface (127.0.0.1, ::1).
IReadOnlyList<IPAddress> Addresses { get; init; }

Unicast addresses, IPv4 first; IPv6 link-local addresses carry their scope id.

string Description { get; init; }

Adapter description (“Intel(R) Ethernet Connection I219-LM”); may equal the name.

IReadOnlyList<IPAddress> DnsServers { get; init; }

DNS servers the OS uses on this interface (IPv4 first).

string? DnsSuffix { get; init; }

DNS suffix (domain name) of the interface, null when none.

IReadOnlyList<IPAddress> Gateways { get; init; }

Default gateways of the interface (IPv4 first).

string Id { get; init; }

Stable id of the OS (NetworkInterface.Id: a GUID on Windows, the name on Linux/macOS).

int Ipv4Index { get; init; }

IPv4 interface index of the OS (-1 unknown): binds a socket to this interface (macOS IP_BOUND_IF, packet info).

bool IsLoopback { get; init; }

Loopback interface (127.0.0.1, ::1).

bool IsUp { get; init; }

Operational status is Up.

string Name { get; init; }

“Ethernet”, “eth0”, “en0”.

IReadOnlyDictionary<IPAddress, int> PrefixLengths { get; init; }

Prefix length per unicast address (IPv4 /24 = 24); addresses without a known prefix are missing.

IPAddress? PrimaryAddress { get; }

The first IPv4 address, else the first non-link-local IPv6 address, else the first address.

IPAddress? PrimaryIpv4 { get; }

The first IPv4 address, null when the interface has none.

int? PrefixLengthOf(IPAddress address)

Prefix length of address, null when unknown.