Sharing the deployment and use experience of DnsServer, an open source DNS service based on .NET7
Continuing from the previous article using docker-bind to build a dns service, this article will introduce the deployment and use of another DnsServer, which is more focused and lightweight.
Foreword
Continuing from the previous article using docker-bind to build a dns service, this article will introduce the deployment and use of another DnsServer, which is more focused and lightweight.
Features
- Based on .NET 7, supports Windows, Linux, macOS and Raspberry Pi
- Out of the box, easy to use, high performance
- Provides web console, visual management, and viewing usage
- Provides additional control over the network, allowing domain names to be blocked
- Supports DNS-over-TLS, DNS-over-HTTPS, and DNS-over-QUIC
- DNS-over-HTTPS implementation supports HTTP/1.1, HTTP/2 and HTTP/3 transport protocols
- HTTP API is used by the web console, third-party applications or scripts can use the API interface configuration to DNS server
usage
- You can get started quickly, and the domain name resolution is smooth after deployment and settings
- For more in-depth use, you need to read the official blog
- The advanced functions have not been studied in depth, and for the time being, only simple domain name resolution functions are used
DnsServer installation and use
Preparation
- Version: v11.4.1
- docker image: technitium/dns-server:11.4.1
- Default port mapping: 53:53/tcp 53:53/udp 5380:5380/tcp (port 53 is used by the DNS service and 5380 is used by the panel)
- Panel access: http://ip:5380
Install using Docker Compose
This article is based on Docker V24 and Docker Compose V2. For installation, please refer to previous articles
Configuration instructions
- Specified version:
technitium/dns-server:11.4.1
- Specify time zone: Asia/Shanghai and enable logs to use UTC time zone
- Specify account admin password:
devops666
- Specify port mapping: 53:53/tcp 53:53/udp 5380:5380 /tcp (port 53 is used by the DNS service, 5380 is the Web panel port)
- Mount data directory:
./data:/data
- Specify network: devopsnetwork (
docker network create devopsnetwork
) - Specified the local access port range:
net.ipv4.ip_local_port_range=1024 65000
Configuration file compose.yml
- Get ready to copy compose.yml to the server
- Then run
docker compose up -d
version: '3.1'
services:
dns-server:
container_name: dns_server_11_4
hostname: dns-server
restart: always
image: technitium/dns-server:11.4.1
ports:
- "5380:5380/tcp" #DNS web console (HTTP)
# - "53443:53443/tcp" #DNS web console (HTTPS)
- "53:53/udp" #DNS service
- "53:53/tcp" #DNS service
environment:
- TZ=Asia/Shanghai
- DNS_SERVER_LOG_USING_LOCAL_TIME=true
- DNS_SERVER_DOMAIN=dns-server #The primary domain name used by this DNS Server to identify itself.
- DNS_SERVER_ADMIN_PASSWORD=devops666 #DNS web console admin user password.
sysctls:
- net.ipv4.ip_local_port_range=1024 65000
volumes:
- ./data:/etc/dns
networks:
-devopsnetwork
networks:
devopsnetwork:
external: true
Deployment successful
Deployment machine IP: 192.168.123.214
Resource usage in the container
DnsServer usage
-
After successful deployment, visit: http://192.168.123.214:5380, use admin devops666 to log in, and you can view some monitoring statistics in the console
Local area network domain name is generally resolved to the specified IP
Same as above, the requirement is to configure dns to resolve test.com to 192.168.123.214
-
Console->Zones->Add Zone creates the main zone test.com
-
Add pan-analytics
-
Set dns
192.168.123.214
and114.114.114.114
on this machine (otherwise you will not be able to access other websites) -
Verify dns, the IP of normal ping test.com exists, and now it is resolved to our own dns
There may be a dns cache, useipconfig /flushdns
to refresh it
View system log
Environment variables TZ=Asia/Shanghai
and DNS_SERVER_LOG_USING_LOCAL_TIME=true
need to be set at the same time to take effect. After setting, the log configuration Use Local Time in the settings will be checked by default
Disable domain name access (Blocked)
You may need to use ipconfig /flushdns
to clear the dns cache
The pit that has been stepped on
- The log shows that the environment variables
TZ=Asia/Shanghai
andDNS_SERVER_LOG_USING_LOCAL_TIME=true
need to be set at the same time to take effect - dns cache clearing:
ipconfig /flushdns
- Incorrect proxy/VPN settings may cause DNS to be good or bad. Remember to check the proxy at this time. Normal DNS will take effect very quickly
Related Documents
- Project address: Github
- Mirror warehouse: DockerHub
- Official blog: technitium.com
- Official docker-compose:docker-compose.yml
后语
Based on DNS services, a lot can be done, such as automatic https, but the research has not been successful. It may be implemented in combination with real own domain names later.
Preview the next part of the painstaking work, Nexus3 manages private nuget, docker, don’t miss it if you pass by~
Author: Yi Mo
Github:yimogit
Pure static tool site: metools
Note: Welcome to make bricks, please point out any shortcomings;
Confusion is probably because you think too much and do too little.