Straightforward DNS forwarder with cache, custom hosts and blocklists support
Find a file
2025-04-24 09:06:37 +02:00
.github/workflows update releaser workflow 2025-04-24 09:06:37 +02:00
assets new logo 2023-03-05 16:40:49 +01:00
cmd/luna-dns username change and dep upgrade 2025-04-24 08:59:53 +02:00
internal username change and dep upgrade 2025-04-24 08:59:53 +02:00
.dockerignore docker image 2022-08-25 20:47:33 +02:00
.gitignore gitignore updated 2022-08-25 23:43:57 +02:00
.goreleaser.yml username change and dep upgrade 2025-04-24 08:59:53 +02:00
config.yml configurable blocklists update time 2023-05-12 00:10:22 +02:00
Dockerfile username change and dep upgrade 2025-04-24 08:59:53 +02:00
go.mod username change and dep upgrade 2025-04-24 08:59:53 +02:00
go.sum username change and dep upgrade 2025-04-24 08:59:53 +02:00
LICENSE username change and dep upgrade 2025-04-24 08:59:53 +02:00
Makefile assets and readme 2022-08-25 23:39:21 +02:00
README.md username change and dep upgrade 2025-04-24 08:59:53 +02:00


luna-dns

Release Build Test

Straightforward DNS forwarder with cache, custom hosts and blocklists support


Deployment

Standalone Executable

In order to run luna-dns as a standalone executable, you can build it from source code or download a pre-built binary from the latest release.

Build from source:

git clone https://github.com/wiredlush/luna-dns.git
cd luna-dns
make

Run executable:

./luna-dns <path-to-config-file>

Docker

You can deploy an instance of luna-dns by using Docker:

docker run -d --name=luna-dns \
  -p 5355:5355/udp \
  -v /path/to/config.yml:/etc/luna-dns/config.yml \
  --restart unless-stopped \
  wiredlush/luna-dns:latest

The luna-dns image will always look for a configuration file in /etc/luna-dns/config.yml

Configuration

Luna DNS is configured via a YAML configuration file. A sample configuration is provided in the root of this repository (config.yml).

addr: "0.0.0.0:5355" # the address luna-dns will bind to
network: "udp" # luna-dns server protocol (udp or tcp supported)
cache_ttl: 14400 # after how long the cached data is cleared (expressed in seconds)

# if a valid file path is set the logs will be written to that file
# leave empty to disable log file
log_file: "test.log"

# remote dns servers to forward requests to (if not matching custom hosts)
dns:
  - addr: "8.8.8.8:53" # remote dns addr string
    network: "tcp" # remote dns protocol (udp or tcp supported)
  - addr: "8.8.4.4:53"
    network: "udp"

# custom hosts entries
hosts:
  - host: google.com # custom host domain or pattern (wildcards supported)
    ip: 127.0.1.1 # custom host ip
  - host: "test.com"
    ip: 127.0.0.1
  - host: "*.test.com" # wildcard pattern example
    ip: 127.0.0.1

# luna-dns supports blocklists both from local files or remote URI
# Blocklists must contain only one domain name per line.
# Every blocked record resolves to 0.0.0.0
# ex.
# google.com
# test.com
# ...
blocklists:
  - http://test.test/test.txt
  - file://folder/test.txt
  - file:///root/test.txt

# blocklists update time (in minute)
blocklists_update: 720 # 12 hours (default)