{"id":19220416,"url":"https://github.com/louisbrunner/avahi2dns","last_synced_at":"2025-05-13T01:13:06.977Z","repository":{"id":47231727,"uuid":"404078166","full_name":"LouisBrunner/avahi2dns","owner":"LouisBrunner","description":"Small DNS server which interface with avahi (perfect for Alpine Linux and musl)","archived":false,"fork":false,"pushed_at":"2025-04-08T00:33:28.000Z","size":28,"stargazers_count":29,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-13T01:12:58.428Z","etag":null,"topics":["alpine","avahi","dns","docker","mdns","multicast-dns","musl"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LouisBrunner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-07T18:10:13.000Z","updated_at":"2025-04-22T21:13:59.000Z","dependencies_parsed_at":"2024-06-19T11:25:38.900Z","dependency_job_id":"562c2757-b319-45af-a67e-f255e0f65b84","html_url":"https://github.com/LouisBrunner/avahi2dns","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Favahi2dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Favahi2dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Favahi2dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Favahi2dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LouisBrunner","download_url":"https://codeload.github.com/LouisBrunner/avahi2dns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253851071,"owners_count":21973674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","avahi","dns","docker","mdns","multicast-dns","musl"],"created_at":"2024-11-09T14:35:05.111Z","updated_at":"2025-05-13T01:13:06.957Z","avatar_url":"https://github.com/LouisBrunner.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# avahi2dns [![Build](https://github.com/LouisBrunner/avahi2dns/actions/workflows/build.yml/badge.svg)](https://github.com/LouisBrunner/avahi2dns/actions/workflows/build.yml)\n\nLinux DNS-resolution is done by the standard library (through functions like `getaddrinfo` or `gethostbyname`), unfortunately `musl` (used by Alpine Linux) doesn't support mdns out-of-the-box.\n\n`avahi2dns` is a small DNS server which interfaces with avahi (through D-Bus) and forwards (perfect for Alpine Linux and musl)\n\n## Building\n\nRequires go 1.24 or later\n\n```\ngo build\n```\n\n## Usage\n\n```shell\n$ ./avahi2dns -h\nUsage: avahi2dns [--domains DOMAINS] [--addr ADDR] [--port PORT] [--debug] [--timeout TIMEOUT]\n\nOptions:\n  --domains DOMAINS, -d DOMAINS\n                         comma-separated list of domains to resolve\n  --addr ADDR, -a ADDR   address to bind on [default: localhost]\n  --port PORT, -p PORT   port to bind on [default: 53]\n  --debug, -v            also include debug information [default: false]\n  --timeout TIMEOUT, -t TIMEOUT\n                         timeout for the Avahi request, 0 meaning none, see https://pkg.go.dev/time#ParseDuration for units and format [default: 0s]\n  --help, -h             display this help and exit\n```\n\n\u003e [!TIP]\n\u003e You can also configure the server through environment variables.\n\n### Examples\n\nBy default the server will bind to port 53 on localhost (not accessible outside your computer) and resolve any domain with the following extensions: `home`, `internal`, `intranet`, `lan`, `local`, `private`, `test`\n\n```shell\n$ sudo ./avahi2dns\nINFO[0000] starting DNS server                           addr=\"localhost:53\"\n...\n```\n\nSettings can be changed through command-line arguments or environment variables:\n\n```shell\n$ ./avahi2dns -p 5454 -a '0.0.0.0' -d 'local,home'\nor\n$ BIND='0.0.0.0' PORT=5454 ./avahi2dns -d 'local,home'\n```\n\nYou can also use the debug flag if you need more information about what the server is doing (probably overkill):\n\n```shell\n$ ./avahi2dns -v -p 5454\nDEBU[2025-04-07T23:27:41Z]/src/server.go:31 main.NewForwarder() connection to dbus...\nDEBU[2025-04-07T23:27:41Z]/src/server.go:37 main.NewForwarder() connection to avahi through dbus...\nDEBU[2025-04-07T23:27:41Z]/src/server.go:44 main.NewForwarder() adding dns handler                            domain=home\n...\n```\n\nIn this example, `avahi2dns` is run as a background job for the sake of demonstration, don't do that in production (use OpenRC, systemd or similar).\n\n```shell\n$ sudo ./avahi2dns \u0026\nINFO[0000] starting DNS server                           addr=\"localhost:53\"\n$ docker run --rm --entrypoint ash --dns=127.0.0.1 --net=host alpine -c 'apk add iputils \u0026\u0026 ping your-name-host.local'\nfetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz\nfetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz\n(1/2) Installing libcap (2.50-r0)\n(2/2) Installing iputils (20210202-r0)\nExecuting busybox-1.33.1-r3.trigger\nOK: 4 MiB in 16 packages\nINFO[0006] forwarding query to avahi                     component=main name=your-name-host.local. protocol=0 type=A\nINFO[0006] forwarding query to avahi                     component=main name=your-name-host.local. protocol=1 type=AAAA\nPING your-name-host.local (172.16.16.2) 56(84) bytes of data.\n64 bytes from 172.16.16.2 (172.16.16.2): icmp_seq=1 ttl=64 time=0.456 ms\n64 bytes from 172.16.16.2 (172.16.16.2): icmp_seq=2 ttl=64 time=0.426 ms\n64 bytes from 172.16.16.2 (172.16.16.2): icmp_seq=3 ttl=64 time=0.429 ms\n64 bytes from 172.16.16.2 (172.16.16.2): icmp_seq=4 ttl=64 time=0.418 ms\n```\n\n\u003e [!IMPORTANT]\n\u003e If you are running `avahi2dns` within Docker, you will need to run your container with the `host` network mode (i.e. `--net=host`) instead of the `bridge` default.\n\n## Installation\n\n### Alpine (edge version)\n\nFeel free to check the Alpine wiki directly for their recommended setup: https://wiki.alpinelinux.org/wiki/MDNS#Setup_avahi2dns\n\n\u003e [!NOTE]\n\u003e Thanks to [Willow Barraco](https://cv.willowbarraco.fr/en/), `avahi2dns` is available through the `testing` repository of Alpine.\n\n```bash\n# all those steps require you to be root\n\n# add the testing repository, skip if you already have it enabled\necho \"@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing\" \u003e\u003e /etc/apk/repositories\n\napk add avahi2dns@testing\n\n# if you are using openrc\napk add avahi2dns-openrc@testing\n# automatically starts avahi2dns at boot\nrc-update add avahi2dns\n# start it right now as well\nrc-service avahi2dns start\n```\n\n### Any Linux\n\nCheckout the latest release [here](https://github.com/LouisBrunner/avahi2dns/releases/latest) and download the binary corresponding to your architecture.\n\n```bash\n# make sure to match your system architecture\nwget https://github.com/LouisBrunner/avahi2dns/releases/latest/download/avahi2dns-linux-arm64\nmv avahi2dns-linux-arm64 /usr/bin/avahi2dns\n```\n\nYou can then setup `avahi2dns` through OpenRC, systemd or similar. Check this [file](openrc/avahi2dns) for an example for the former.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisbrunner%2Favahi2dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouisbrunner%2Favahi2dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisbrunner%2Favahi2dns/lists"}