# 32.8.零配置网络（mDNS/DNS-SD）

零配置网络（[Zero-configuration networking](https://en.wikipedia.org/wiki/Zero-configuration_networking)，有时被称为 *Zeroconf*）是一组简化网络配置的技术。Zeroconf 的主要部分包括：

* 链路本地寻址（Link-Local Addressing），提供数值型网络地址的自动分配。
* 多播 DNS（*mDNS*），提供主机名的自动分发与解析。
* 基于 DNS 的服务发现（*DNS-SD*），提供服务实例的自动发现。

## 32.8.1. 配置和启动 Avahi

zeroconf 的一个流行实现是 [Avahi](https://avahi.org/)。可以使用以下命令安装和配置 Avahi：

```sh
# pkg install avahi-app nss_mdns
# grep -q '^hosts:.*\<mdns\>' /etc/nsswitch.conf || sed -i "" 's/^hosts: .*/& mdns/' /etc/nsswitch.conf
# service dbus enable
# service avahi-daemon enable
# service dbus start
# service avahi-daemon start
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://handbook.bsdcn.org/di-32-zhang-wang-luo-fu-wu-qi/32.8.-ling-pei-zhi-wang-luo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
