···11+Copyright (c) 2026 joshua stein <jcs@jcs.org>
22+33+Permission to use, copy, modify, and distribute this software for any
44+purpose with or without fee is hereby granted, provided that the above
55+copyright notice and this permission notice appear in all copies.
66+77+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
99+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1010+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1111+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1212+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1313+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
···11+# avahi-proxy
22+33+Act as a DNS server listening on a given port (and optional IP, otherwise
44+defaulting to `127.0.0.1`) and pass each `A` and `AAAA` query received for the
55+`local` domain to `avahi-resolve`.
66+If it gets an answer, pass it back as a proper DNS reply, otherwise return
77+`NXDOMAIN`.
88+99+## Compiling
1010+1111+ $ git clone https://github.com/jcs/avahi-proxy
1212+ $ cd avahi-proxy
1313+ avahi-proxy$ make
1414+1515+## Installing
1616+1717+ avahi-proxy$ doas make install
1818+ avahi-proxy$ doas rcctl enable avahi_proxy
1919+ avahi-proxy$ doas rcctl start avahi_proxy
2020+2121+## Use with `unwind`
2222+2323+When using OpenBSD's `unwind`, configure a `force` block for `local.` and a
2424+`forwarder` to `avahi-proxy`, assuming its default port of 5300:
2525+2626+ preference { autoconf }
2727+ forwarder { 127.0.0.1 port 5300 }
2828+ force forwarder { local }
2929+3030+Now queries for `local.` hosts will forward to `avahi-proxy`, which will proxy
3131+them to `avahi-resolve`:
3232+3333+ $ dig @127.0.0.1 giraffe.local. a
3434+ [...]
3535+ ;; QUESTION SECTION:
3636+ ;giraffe.local. IN A
3737+3838+ ;; ANSWER SECTION:
3939+ giraffe.local. 9 IN A 192.168.1.3
4040+4141+To directly query `avahi-daemon`, just supply the port it's running on:
4242+4343+ $ dig @127.0.0.1 -p 5300 giraffe.local. a