# Network Configuration

---

# Configuring Profiles

_Peios / Using Peios / Network Configuration_

> Inspect the current network, prepare a profile and matching rule, apply changes live with a recovery plan, and verify the accepted addresses, routes and DNS.

Network configuration is two kinds of key under `Machine\System\Network`. A
**profile**, a subkey of `Profiles`, says how an interface stands on a
network: what to take from the network's offer and what to dictate. A
**rule**, a subkey of `Rules\Interface`, says which interfaces stand in which
profile. netd watches the subtree, so a change takes effect within a moment of
the write — no restart, no reload command.

Follow this order: inspect the active interface, prepare the profile, select
it with a rule, then read back the accepted state. For desktop changes, use
[Network Manager](/peios/using-peios/network-configuration/network-manager.md), whose profile editor
shows inherited values and the interfaces a change affects.

Read the registry value reference on the machine with
`regman 'Machine\System\Network'`.

## Before you change anything

- You need write access to the particular registry keys. Reading status
  does not grant permission to change configuration; protected `Status`
  keys are netd's output, not settings to edit.
- Record the current rule, profile, and values so you can restore them.
  Keep local console access or another recovery path if this network
  carries your remote session.
- Profile and rule writes take effect live. Changing a profile's resolved
  values restarts its interfaces' clients, even for a DNS-only profile
  edit. No reboot or daemon reload is required.
- Use a derived profile for one interface. Editing `default` affects
  every interface using it and descendants that inherit the edited value.
- The commands below are examples. Replace addresses, names, ids, and bus
  paths with your own. The `vpn`, `office`, `laptop`, `untrusted`, and
  `home`
  profile examples assume those profiles already exist.

> [!WARNING]
> Direct `reg` writes do not use Network Manager's **Keep this change?**
> confirmation. A policy edit can disconnect the machine. Have console access
> or another recovery path before changing the interface used for remote
> access.

## See what you have

```sh
net status
net rules
net profiles
```

Keep this output for comparison after the change. `net status` shows each
interface with its verdict: the rule that spoke and the profile it stands in.
An image's baseline is a profile `default` that takes the network's address,
way out and name servers, and a rule `wired` that puts every wired interface
in it at priority 10.

## A static address

Create the profile before a rule names it. This example derives `default/db1`
from `default`, so values not listed here remain inherited, including
`Dns.Offered` and `Address.LinkLocal`. Lists replace inherited lists; they do
not append. An absent value inherits, while a present empty value means none.

Confirm that `10.0.0.5/24` is appropriate and available on your network and
that `10.0.0.1` is its gateway before adapting these example writes:

```sh
reg new Machine/System/Network/Profiles/default/db1
reg set Machine/System/Network/Profiles/default/db1 Address.Offered dword:0
reg set Machine/System/Network/Profiles/default/db1 Address.Static multi:10.0.0.5/24
reg set Machine/System/Network/Profiles/default/db1 Route.Offered dword:0
reg set Machine/System/Network/Profiles/default/db1 Route.Gateway 10.0.0.1
```

Then a rule naming the interface by its bus path (from `net status`, stable
across boots), as an exception under the baseline's `wired` rule so it is
judged only for wired interfaces:

```sh
reg new Machine/System/Network/Rules/Interface/wired/db1
reg set Machine/System/Network/Rules/Interface/wired/db1 Interface.Path.Equal pci-0000:00:03.0
reg set Machine/System/Network/Rules/Interface/wired/db1 Actions 'multi:JOIN(default/db1)'
```

The exception is more specific than `wired`, so it selects `default/db1` for
that interface and stops offered address acquisition. Check for
`JOIN(default/db1) by wired/db1` and the intended address and gateway in
`net status`; `readiness routed` appears once both a usable address and the
default route are in place.

Inherited `Dns.Offered` is a setting, not evidence that a server is available
after address acquisition stops. Check `resolv status`. To pin DNS as well,
set `Dns.Offered = 0` and `Dns.Servers` on this derived profile. The inherited
link-local setting does not add a fallback beside a static address. See
[desired state](/peios/reference/netd/interfaces/desired-state.md).

## Verify the accepted settings

```sh
net rules
net profiles
net status
resolv status
```

1. Confirm the rule names the intended profile and matches the intended
   interface. `net profiles` lists each profile's own values, not a
   flattened result; account for inherited values.
2. Check that `net status` has no `policy REFUSED` line. Read the active
   verdict, rule and profile, then the address, gateway, lease and warnings.
3. Check the servers and domains in `resolv status`, and test a relevant
   name with `resolv query <name>`.
4. Test the service you actually need. Readiness `routed` proves a default
   route exists, not that a remote service or the Internet answers.

If you also changed firewall rules or a network's `Name` or `Trust`, an
administrator should run `net policy wait` and check `net policy`. That
verifies the kernel's packet policy; it does not substitute for checking
netd's accepted profile in `net status`.

If the result is wrong, restore the values you recorded and repeat the checks.
`net reconcile` requests another pass; it does not undo a write.
`net renew <interface>` asks to renew an existing DHCP lease without releasing
it first. Both need `NETWORK_CONTROL`, granted to SYSTEM, and Administrators
by default.

## Facts a rule can name

Every `<Fact>.<Operator>` value present must hold. Comparison is exact;
`Equal` takes a list for *any of*.

| Fact | Matches | Example |
|---|---|---|
| `Interface` | the kernel's interface name | `enp0s3` |
| `Interface.Kind` | `wired`, `wireless`, `loopback`, `other` | `wired` |
| `Interface.Id` | the stable id from `net status` | `3f2a1b8e-…` |
| `Interface.Mac` | the hardware address | `52:54:00:12:34:56` |
| `Interface.Path` | the bus path | `pci-0000:00:03.0` |
| `Interface.Driver` | the kernel driver | `virtio_net` |
| `Network.Name` | the `Name` you gave the network's record | `palfrey-home` |
| `Network.Trust` | the `Trust` you gave it | `corporate` |

Prefer `Interface.Path` or `Interface.Id` for a specific card and
`Interface.Kind` or `Interface.Driver` for a class. `Interface` (the name) is
the least stable: the kernel might call the same card something else after a
hardware change. A fact the interface lacks — a tunnel has no `Path` — makes
the condition false, never an error.

## Taking the offer, with adjustments

`default` believes the network about the address, the way out and the name
servers. To keep the address but pin DNS, override two values in a derived
profile and point a rule at it — or, if the whole machine should behave so,
edit `default` itself:

```sh
reg set Machine/System/Network/Profiles/default Dns.Offered dword:0
reg set Machine/System/Network/Profiles/default Dns.Servers multi:1.1.1.1,9.9.9.9
```

Three more `Dns` values decide *which* names an interface's servers are asked
for, which matters the moment a second interface appears — typically a VPN:

```sh
reg set Machine/System/Network/Profiles/vpn Dns.Domains multi:corp.example
reg set Machine/System/Network/Profiles/vpn Dns.Default dword:1
reg set Machine/System/Network/Profiles/vpn Dns.Exclusive dword:1
```

`Dns.Domains` sends names under `corp.example` to this interface's servers.
`Dns.Default` sends *every other* name there too (unset, an interface claims
that only when it carries the default route). `Dns.Exclusive` takes all
queries only while the interface is at least `addressed` and supplies a DNS
server. Without those conditions it does not prevent another interface from
being chosen. Verify the VPN's addresses and server lines before relying on it
to keep names off another network. resolvd owns resolver selection;
`resolvd(8)` describes that service.

To hold an offered address across a server outage:

```sh
reg set Machine/System/Network/Profiles/default Address.OnExpiry Keep
```

`Keep` trades the risk of an address conflict for continuity; the default
`Drop` is the safe choice.

## IPv6

`Address.Offered` covers both families: on a network with router
advertisements the interface gets a stable-privacy address per advertised
prefix, and with `Route.Offered` and `Dns.Offered` the advertised default
route and DNS from RDNSS or stateless DHCPv6. Three values change that:

```sh
reg set Machine/System/Network/Profiles/office Address.Families multi:ipv4
reg set Machine/System/Network/Profiles/laptop Address.Temporary dword:1
reg set Machine/System/Network/Profiles/office Route.Gateway multi:10.0.0.1,fe80::1
```

`Address.Families = ipv4` stops router discovery on interfaces in the profile
and drops IPv6 entries from `Address.Static`. `Address.Temporary` adds
daily-rotating temporary addresses beside the stable one, for machines whose
traffic should not correlate over days; the stable address remains for
inbound. An IPv6 entry in `Route.Gateway` — usually a link-local address —
pins the default router instead of believing advertisements.

The stable address survives reboots and reinstalls that keep `/var/state/netd`
; it is not derived directly from the MAC, and a different network sees an
unrelated address. The [IPv6 address
chapter](/peios/reference/netd/ipv6/addresses.md) documents derivation,
lifetimes and rotation.

## Prefer a cable over WiFi

When both interfaces have default routes, the metric decides which is used.
Wired defaults to 100 and wireless to 600, so no configuration is needed. To
invert it, set `Route.Metric` on the profiles. This describes route preference
once links exist; Wi-Fi association is not implemented by netd, wireless is
not in the baseline, and Network Manager shows wireless as **Not managed**.

## Name a network, and behave differently on it

Once an interface has stood on a network, `net status` shows the record's id.
Give it a name and your word on it:

```sh
reg set Machine/System/Network/Networks/<id> Name palfrey-home
reg set Machine/System/Network/Networks/<id> Trust home
```

Changing either label can change both the selected profile and firewall
access. Check the active interface and packet policy afterward.

The following illustrates choosing a profile by network. It is not a Wi-Fi
setup procedure: a supplicant must supply the link, and wireless network-name
identification is unfinished. Create the `untrusted` and `home` profiles
before a rule names them:

```sh
reg new Machine/System/Network/Rules/Interface/radio
reg set Machine/System/Network/Rules/Interface/radio Interface.Kind.Equal wireless
reg set Machine/System/Network/Rules/Interface/radio Actions 'multi:JOIN(untrusted)'
reg new Machine/System/Network/Rules/Interface/radio/home
reg set Machine/System/Network/Rules/Interface/radio/home Network.Name.Equal palfrey-home
reg set Machine/System/Network/Rules/Interface/radio/home Actions 'multi:JOIN(home)'
```

Until a network has been identified on the link, the `Network.*` facts are
absent, so the radio stands in `untrusted` first and moves to `home` once the
network is known. `Trust` is your label, not verified evidence of network
identity: a rule that conditions on it is stating that you accept the
identification. The same word reaches the firewall: a `Flow` rule with
`Network.Trust.Equal = home` sees the network the radio is on, so what you
open at home stays shut at the cafe. See the network context in the
Peios Network Policy specification for the shared firewall contract.

## Hand an interface to something else

An `IGNORE` verdict leaves a matched interface alone: no new addresses,
routes, link changes, or DHCP. If it was previously joined, existing addresses
and routes remain; `IGNORE` is not a cleanup action:

```sh
reg new Machine/System/Network/Rules/Interface/leave-alone
reg set Machine/System/Network/Rules/Interface/leave-alone Interface.Equal tap0
reg set Machine/System/Network/Rules/Interface/leave-alone Actions multi:IGNORE
```

## Take an interface down

A `DOWN` verdict keeps a matched interface administratively down. `DOWN` wins
equal-priority ties, but a higher-priority rule still wins. Check existing
priorities before using the example priority 100:

```sh
reg new Machine/System/Network/Rules/Interface/dead-card
reg set Machine/System/Network/Rules/Interface/dead-card Interface.Id.Equal <id>
reg set Machine/System/Network/Rules/Interface/dead-card Priority dword:100
reg set Machine/System/Network/Rules/Interface/dead-card Actions multi:DOWN
```

The interface id is in `net status`. Delete the rule, or set `Enabled = 0` on
it, to let the remaining rules decide again. Verify that they select the
intended profile; removing `DOWN` alone does not guarantee a `JOIN`.

## Ask for the same address

The address a network last leased is on its record, and netd asks for it
first. Write it yourself for a soft reservation — a request the server might
refuse, unlike a static address:

```sh
reg set Machine/System/Network/Networks/<id> RequestedAddress 10.0.2.50
```

## Set the hostname

```sh
reg set Machine/System/Network Hostname workshop
```

netd applies it on the next pass. A profile with `Hostname.Offered` on adopts
a network-supplied name when this value is unset; `Hostname.Announce` tells
DHCP servers the name so their DNS can register it. Both are off in a bare
profile.

Each change netd makes to the machine's name is recorded in the event log as
`netd.hostname.changed`, with the name before and after
(`config.text-previous` and `config.text`). The netd manual's [hostname
chapter](/peios/reference/netd/what-netd-publishes/the-hostname.md) says exactly when.

netd validates the name as one network label:
letters, digits, and hyphens, at most 63 of them, not beginning or ending with
a hyphen, and not `localhost`. **System Settings** holds it to that as it is
typed: in its **About** section, **Machine Name** says what is wrong with a
name before it can be applied, and shows the name the machine has now if netd
hasn't applied the new one yet; **Apply** appears once the name has been
changed. The About section also shows what the machine is and runs: the system
and its edition, the kernel, how long it has been up, the hardware, and the
disks.

## When netd refuses

An unknown fact, a `JOIN` naming a missing profile, or an unknown profile
value refuses the whole new interface generation. netd keeps the last good one
and `net status` reports `policy REFUSED` with the reason. Fix the named
entry, then verify the next write was accepted; the registry listing alone
does not tell you what is active.

Two equal-priority rules selecting different profiles also refuse a runtime
reload when the conflict affects an existing interface. At startup, or for an
interface that appears later, the tied interface is instead ignored and its
warning names both rules. Make one rule unambiguously win. The
[generation](/peios/reference/netd/the-interface-layer/building-a-generation.md)
and [interface
judgment](/peios/reference/netd/the-interface-layer/judging-an-interface.md)
chapters describe that distinction.

A `JOIN` naming an existing but disabled profile abstains; its parent, another
rule, or the backstop answers. Disabling a profile does not exempt malformed
values in it from validation.

## Where to go next

- [The net command](/peios/using-peios/network-configuration/the-net-command.md) — read back what netd
  did.
- [Networking](/peios/reference/netd/introduction/overview.md) — the model behind these keys.
- `regman 'Machine\System\Network'` — registry values and their meanings.
- [The interface layer as netd runs
  it](/peios/reference/netd/the-interface-layer/profiles.md), in the netd
  technical reference manual — how netd reads these keys, builds a generation
  from them and judges each interface.

---

# The Net Command

_Peios / Using Peios / Network Configuration_

> Read active interfaces and leases, compare rules and profiles, verify firewall acceptance, and choose a safe renew or reconcile command with the required access.

Use `net status` first. It shows what netd accepted and what is present on
each interface. Use `net rules` and `net profiles` to compare that state with
the registry configuration. On the desktop, the same starting point is
[Network Manager's
Overview](/peios/using-peios/network-configuration/network-manager.md#finding-the-right-view).

```sh
net status
net rules
net profiles
```

`net` does not write profile or rule configuration. Follow [Configuring
profiles](/peios/using-peios/network-configuration/configuring-profiles.md) to change it, then return
here to verify the result.

## After a change

- **Profile or interface rule:** check `net status` for the intended
  verdict, rule and profile, no `policy REFUSED` line, and the expected
  addresses and gateway. `net profiles` shows each profile's own values,
  so inherited settings still matter.
- **DNS:** check `resolv status` and a relevant `resolv query <name>`.
- **Firewall rule or network label:** as an administrator, run
  `net policy wait`, then `net policy`. A returned registry write is not
  yet proof that the kernel accepted it.
- **Connectivity:** test the required service. `routed` means there is a
  usable address and a default route, not a successful Internet probe.

The interface and packet policy are accepted independently. A successful
`net policy wait` does not prove that netd accepted a profile; a good
`net status` does not prove that the firewall accepted a rule.

## Reading `net status`

```text
hostname   workshop
readiness  routed

enp0s3  [3f2a1b8e-…]
  verdict    JOIN(default) by wired
  state      up, carrier
  readiness  routed
  hardware   52:54:00:12:34:56 pci-0000:00:03.0 virtio_net
  network    palfrey-home [9c0d4e21-…] trust home
  address    10.0.2.15/24
  gateway    10.0.2.2
  dns        10.0.2.3
  lease      bound from 10.0.2.2, 86395s left
```

`verdict` is what the interface layer said and who said it: the verdict, the
profile (for `JOIN`), and the rule path that spoke — `backstop` when no rule
did. `readiness` is `absent` (down or no carrier), `link`, `addressed` or
`routed`, shown for joined interfaces; the machine's is the highest among
them. `network` is the record under `Machine\System\Network\Networks`
identified on the link, with the `Name` and `Trust` you gave it.

The bracketed value after the name is the interface id — the inventory key
under `Machine\System\Network\Interfaces`.

Read the interface block, not only the machine's readiness: another interface
can make the machine `routed` while this one is unusable. An IPv4 link-local
address counts as `addressed`; IPv6 link-local alone does not. Only joined
interfaces contribute to machine readiness.

A `warning` line can mean DHCP discovery went unanswered or two rules tied and
this interface is ignored. `policy REFUSED:` means the newest interface
generation was rejected and the last good one stands. Correct the named rule
or profile and read status again. A listed registry write is not proof it took
effect.

## Commands

| Command | Does |
|---|---|
| `net status` | Hostname, the machine's readiness, whether the newest generation was refused, and every interface: verdict with the rule and profile behind it, link state, readiness, hardware identity, the network identified on it, addresses, gateway, DNS, lease, warnings. |
| `net wait <level> [seconds]` | Block until the machine reaches `link`, `addressed` or `routed`, or the timeout (default 60) passes. For scripts that need the network. |
| `net renew <interface>` | Renew the DHCP lease now. Accepts a kernel name or an interface id. |
| `net reconcile` | Re-run the reconciler immediately rather than waiting for an event. |
| `net policy` | The kernel's side of the packet policy: whether the filtering engine (NTFE) is enforcing, its generation, whether every change written so far is in force, whether the last re-read was refused, and how many interfaces have a network context. |
| `net policy wait [seconds]` | Block until every change made to `Machine\System\Network` before the command started is in force in the kernel, or the timeout (default 10) passes. Fails if the kernel refused the new generation. For scripts that write a rule and then rely on it. |
| `net rules` | The interface layer, one rule per line: path, priority, conditions, actions. |
| `net profiles` | The profile tree, one profile per line with the values it sets itself. |

## Choose renew or reconcile carefully

`net renew <interface>` asks a DHCPv4 client holding a lease to renew it
without releasing its current address first. A client with no lease is left as
it is; a successful request alone does not prove a new lease arrived. Check
the lease afterward. The argument might be a kernel name or the stable
interface id shown by `net status`.

`net reconcile` asks netd to apply the configured desired state now. It does
not reload a different configuration, undo a write, or make an invalid gateway
reachable. Neither operation requires a reboot.

Use these commands when a restart is unnecessary. On restart, netd asks to
reuse its remembered IPv4 address and keeps that address and applicable routes
while revalidation is pending. A rejection or timeout discards that
provisional state. It must reacquire offered DNS and IPv6 information. See
[startup](/peios/reference/netd/the-daemon/startup.md).

Each control request has a 5-second total deadline, including connection,
request transmission, and response reading. A timeout does not prove that a
renew or reconcile request had no effect. Check status before retrying.

## Required access

`status`, `wait`, `renew`, and `reconcile` reach netd through
`/run/netd/control.sock`. The control object is a security descriptor:
`Machine\System\Network\ControlSecurity`, or a compiled default when that is
unset. `status` and `wait` need `NETWORK_QUERY`, which the default grants to
everyone. `renew` and `reconcile` need `NETWORK_CONTROL`, which the default
grants to SYSTEM and Administrators. `rules` and `profiles` read the registry
directly and need only read access to it. `policy` and `policy wait` ask the
kernel through `/dev/peios-ntfe`, which ordinary users might lack access to. A
denied request reports `access denied`.

## Exit status

| Code | Meaning |
|---|---|
| 0 | Done; for `wait`, the level was reached; for `policy wait`, the changes are in force. |
| 1 | netd refused or could not be reached; for `wait`, the timeout passed; for `policy wait`, the timeout passed or the kernel refused the generation. |
| 2 | Usage error. |

## See also

- [Networking](/peios/reference/netd/introduction/overview.md)
- [Configuring profiles](/peios/using-peios/network-configuration/configuring-profiles.md)
- `regman 'Machine\System\Network'` on the machine, for every key netd reads
  and writes.
- [netd's control
  socket](/peios/reference/netd/the-control-socket/requests.md), in the netd
  technical reference manual: the requests behind every `net` command, and
  their replies.

---

# Network Manager

_Peios / Using Peios / Network Configuration_

> Distinguish live network settings from example firewall displays.

Network Manager combines interface configuration, name resolution, and
firewall policy in one desktop application. It reads netd, resolvd, kernel
state, and registry settings as your account. Each operation remains
subject to the backend's access checks.

## Finding the right view

The application groups its views by purpose:

| Group | Views and purpose |
|---|---|
| Network | Overview, known networks, profiles, profile rules, and DNS |
| Firewall | Exposure, rule editing, connection tests, and activity |
| System | Port reservations, audit level, and advanced daemon settings |

**Overview** maps an interface to its selected profile and network, with
addresses, routes, traffic, and lease information. A **Connected** summary
means there is a route; it does not prove that a particular service or the
Internet is reachable. Wireless interfaces are shown as unmanaged by this
implementation.

**Networks** records identities and trust levels. **Profiles** define
configuration and **Profile rules** choose where it applies. **DNS**
queries resolvd and manages fallback servers, search domains, static names,
and its cache. Port-reservation permission to bind a socket is separate
from firewall permission for traffic to reach it.

## Example firewall data

The listener, connection, counter, and recent-audit displays under the
firewall interface use constructed examples. Affected panels say
**Example data**, and the status line says **Example**. They use real
rules and some real machine context, but are not a live inventory of
traffic or listening services.

The saved rules and network settings are real. A connection test predicts
a policy result; verify a policy change with the actual connection or
service you intended to affect. Do not use an example activity panel as
evidence that a connection happened or was blocked.

## Permissions and refresh

Settings are checked for write access by registry key. Runtime **Renew
lease** and **Reapply** use netd's control right. Read-only panels explain
why a change is unavailable. Exposure and Activity also restrict access.

Live machine data refreshes every two seconds; registry changes trigger
settings refreshes. A daemon refusal is shown with the previous accepted
configuration or generation still in force. See
[Changing Network Settings](/peios/using-peios/network-configuration/changing-network-settings.md) before making
a change through a remote desktop.

---

# Changing Network Settings in Network Manager

_Peios / Using Peios / Network Configuration_

> Review a network change and verify it before keeping it.

Use Network Manager to change the intended profile, selection rule, or
firewall rule, then verify its live effect. Some changes can disconnect the
desktop through which you are working.

## Before you start

You need permission to change the relevant settings. Record their previous
values and keep another recovery path for changes that can affect remote
access. Not every change has automatic undo.

## Apply a controlled change

1. Open **Network Manager** and inspect the affected interface in
   **Overview**. Record the profile, rule, network, and addresses it uses.
2. Open the relevant profile, profile rule, or firewall rule. Inspect the
   preview and any affected interfaces or desktop connections.
3. Save the intended change. If the application warns that it would
   disconnect an active desktop, read the affected connections before
   deciding whether to continue.
4. When **Keep this change?** appears, test the intended connection before
   selecting **Keep**. Select **Undo** to revert, or allow the 30-second
   server-side timer to expire.

## Check the result

Return to **Overview** and check the actual interface state. For a name
change, perform the intended lookup; for a firewall change, test the actual
connection. Read the accepted policy generation and any refusal. Example
firewall activity is not live confirmation.

## Which changes have undo

The keep timer covers firewall and profile-rule changes, exposure changes,
and relevant changes to profiles or known networks carrying desktop
connections. A change accepted after a disconnect warning also receives
the timer. Starting another guarded change keeps the preceding one.

DNS settings, static names, port reservations, audit levels, and new
profiles can apply immediately without that bar. Restore their recorded
previous values explicitly if needed. The server runs the guarded timer,
so losing the browser connection does not prevent its expiry.

See `gxwi-network-manager(1)`, `net(1)`, and `resolv(1)` for command
interfaces and backend behavior.

---

# Checking Connectivity

_Peios / Using Peios / Network Configuration_

> Separate link configuration, DNS, listener authority, and packet policy when diagnosing a connection.

Network readiness, name resolution, certificate trust, and permission to
connect are separate checks. Preserve the failed command and its diagnostic
before changing configuration.

## Follow the symptom

1. Run `net status` to identify the affected interface, its carrier, rule,
   profile, addresses, and route. Run `resolv status` for the DNS servers
   actually selected.
2. Choose the next check from the table. Use the intended service and host,
   rather than treating any successful probe as proof of full connectivity.
3. If a change is necessary, follow the owning component's procedure with
   a local recovery path. Then repeat the original failed operation.

| Observation | Next check |
|---|---|
| No carrier or readiness `absent` | Link, cable, and the interface verdict. |
| `IGNORE`, `DOWN`, or no profile | `net rules` and the profile-selection policy. |
| Carrier but no offered address | Profile families and `Address.Offered`, server reachability, and DHCP policy. |
| Only a `169.254` address | Link-local fallback; it does not establish a routed lease. |
| Address but no default route | `Route.Offered` or the configured gateway and route-addition diagnostics. |
| IP works but a name fails | `resolv query NAME`, server selection, and not-found versus unavailable. |
| One service fails | Its listener, bind authority, packet policy, and application response. |
| Stored changes do not apply | netd's acceptance and the kernel's packet-policy acceptance separately. |
| TLS verification fails | Expected peer identity, selected trust anchors, and the reported certificate. |

The [profile workflow](/peios/using-peios/network-configuration/configuring-profiles.md) and
[resolver guide](/peios/using-peios/network-configuration/name-resolution.md) explain their own checks.
For firewall changes, use [Changing Network
Policy](/peios/using-peios/network-policy/changing-policy.md).

## Readiness and ownership

Readiness progresses through `absent`, `link`, `addressed`, and `routed`.
An address can be link-local; a default route does not prove Internet, DNS,
or application availability. `net wait` accepts at least its requested
level, while Peinit's declared readiness dependency matches a published
level. Check the [readiness
reference](/peios/reference/netd/what-netd-publishes/readiness.md) when
choosing a service dependency.

netd owns addresses on joined interfaces and its tagged routes. Manual
address changes can disappear during reconciliation. It leaves the kernel's
IPv6 link-local address and other programs' route tags alone. `IGNORE` is
not a cleanup request. Restarting netd can interrupt offered configuration
while DHCP and router discovery run again; it is not a harmless reload.

Network `Name` and `Trust` labels are operator policy, not authenticated
proof of the network's identity. Changing them can affect both interface
selection and the firewall. Wireless association requires a supplicant;
netd's profiles do not implement association, and the baseline leaves
wireless unmanaged.

## Compare daemon and network evidence

Inspect captured service output when configuration does not explain a
failure:

```sh
evctl 'LOGS FROM netd SINCE 1h ago TAKE 40'
evctl 'LOGS FROM resolvd SINCE 1h ago TAKE 40'
```

Use `ss -lnt` on the receiving machine to inspect TCP listeners. A targeted
`nc -vz HOST PORT` checks a TCP connection, not application correctness.
`dig @127.0.0.53 NAME A` queries the local DNS stub directly; it does not
change resolver policy. Choose hosts and traffic you are authorized to test.

An absent echo reply does not establish that a host is down. Ordinary echo
uses datagram sockets, while packet capture and some probe modes require
raw-socket authority. Neither installing a diagnostic utility nor selecting
its privileged mode grants native privileges or a firewall exception.

The [network utility compatibility
reference](/peios/using-peios/network-tools/network-utilities.md) describes the Peios ports'
file, authority, and supported-mode differences. Tool availability depends
on the installed packages, not this guide.

---

# Diagnosing Name Resolution

_Peios / Using Peios / Network Configuration_

> Identify why a name fails and verify the resolver's chosen path.

Use `resolv` to identify whether a name is missing, resolution is unavailable,
or an unexpected interface is being used. Interface DNS policy belongs to
netd. resolvd applies that policy and machine-wide fallback and static-name
settings.

## Before you start

- Install resolvd and the `resolv` operator command.
- Identify the failing name and the network it should use.
- Obtain registry write access before changing policy. Queries use the
  resolver's separate query permission, granted publicly by default.

`resolv(1)` owns command syntax and exit statuses. The regman entry for
`Machine\System\Network\Dns` owns machine-wide settings. Do not edit
`/etc/hosts`, `/etc/resolv.conf`, or `nsswitch.conf` to change this policy.

## Check a name first

1. Read the effective state:

   ```sh
   resolv status
   ```

2. Query the failing name. For example:

   ```sh
   resolv query example.org
   resolv lookup example.org
   ```

3. Compare an answer obtained without consulting the cache:

   ```sh
   resolv query example.org --no-cache
   ```

The final command bypasses cache lookup but can store the resulting answer.
Read the reported outcome, source, server, and interface. If connecting to
an address also fails, investigate
[connectivity](/peios/reference/netd/failure-modes/failure-modes.md).

## Where the servers come from

netd sends resolvd each interface's servers, domains, and addresses as a
**scope**. Compare the scopes in `resolv status` with `net status` and the
intended interface profile.

Use [Configuring
Profiles](/peios/using-peios/network-configuration/configuring-profiles.md#taking-the-offer-with-adjustments)
to change offered or explicit interface DNS settings. A profile change can
restart address clients; follow that guide's recovery checks.

Machine-wide fallback servers, extra search domains, and static names live
under `Machine\System\Network\Dns`. They apply after a successful complete
configuration read. A read failure retains the previous configuration and is
logged. A lost registry watch can prevent later changes from being observed.

### Verify which interface gets a name

A query selects one scope. The order is exclusive scope, longest matching
search domain, matching reverse subnet, default route, then lowest metric
among up scopes with servers. Fallback servers are considered only when no
earlier step chooses a scope.

An exclusive scope must be at `addressed` or better. It still wins without
servers; upstream work then becomes unavailable rather than using another
interface. At `link` alone, the exclusive rule does not apply. Verify the
interface state as well as its flags when diagnosing VPN name routing.

A bare name such as `printer` requires a search domain. All up scopes can
contribute domains, including scopes without servers. A qualifying exclusive
scope supplies only its own domains. With no applicable domain, a bare name
is answered locally as not found and is never sent upstream unchanged.

See the [routing](/peios/reference/resolvd/the-engine/scope-routing.md) and
[search
expansion](/peios/reference/resolvd/the-engine/single-label-expansion.md)
chapters for tie-breaking and failure behavior.

## Static names

With registry write access, add a static name when this machine should answer
it without DNS. Replace the sample address with the intended host:

```sh
reg new Machine/System/Network/Dns/Hosts
reg set Machine/System/Network/Dns/Hosts printer sz:10.0.2.9
resolv query printer
resolv reverse 10.0.2.9
```

Verify both directions. Static names apply without a cache flush after the
configuration is read. Synthetic localhost names take precedence over static
names. The [synthetic-name
chapter](/peios/reference/resolvd/the-engine/synthetic-names.md)
describes hostname, reverse, and `.local` handling.

## The `resolv` command

`resolv query` reports individual records and where the answer came from.
`resolv lookup` returns addresses and a canonical name. `resolv reverse`
queries names for an address. `resolv status` reports scopes and counters.

`resolv flush` clears the shared cache and requires the resolver control
right. Registry editing has separate permissions. Every command exchange
has a ten-second deadline; a failed exchange is not evidence that a name
is absent. See `resolv(1)` for scripting contracts.

## Not found versus unavailable

| Observation | Next check |
|---|---|
| `notfound` from DNS or cache | Check spelling and compare a query without cache lookup. |
| `notfound` locally for a bare name | Check applicable search domains. |
| `unavailable` | Check the selected scope, its servers, and reachability. |
| netd disconnected, no scopes | Check netd; only local answers and configured fallbacks are available. |
| netd disconnected, scopes listed | These are the last snapshot, not a fresh view of the links. |
| A demoted server | Check its failures; healthy servers are tried before demoted ones. |
| A stale answer | Check static overrides, then compare a query without cache lookup. |
| Access denied | Inspect the native control permission separately from stub reachability. |

Read the service log when startup or updates fail:

```sh
evctl 'LOGS FROM resolvd SINCE 1h ago TAKE 40'
```

A restart replaces resolvd's stale socket and clears transient state.
Do not remove its runtime directory as a routine diagnostic step. Inspect
permissions and the exact startup error using the
[failure
guide](/peios/reference/resolvd/failure-modes/resolvd-cannot-be-reached.md).

## Three doors

Programs reach the same resolver engine through the native socket, the local
DNS stub at `127.0.0.53`, or glibc's Name Service Switch (NSS) module.
Native applications can use `libresolvd.so`; other DNS clients use the
constant resolver configuration pointing at the stub.

A direct query to another server tests that server and bypasses normal scope
selection. It does not establish how Peios applications resolve the name.

## Implementation boundaries {#what-is-not-there-yet}

resolvd does not implement DNSSEC validation, DNS over TLS, multicast DNS,
or per-program resolution policy. Answers report `unvalidated`. Allowed
callers use the same policy; native query access controls permission to ask.

## Going deeper

- PSPU, Name Resolution Interface, defines the protocol contract.
  defines request and outcome contracts.
- [resolvd TRM](/peios/reference/resolvd/introduction/overview.md)
  explains the implementation and its limits.
- [netd's resolver
channel](/peios/reference/netd/what-netd-publishes/the-resolver-channel.md)
  describes the live network information sent to resolvd.
