Skip to content

Commit

Permalink
default port changed to 10053, docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mguptahub committed Oct 28, 2024
1 parent 0345800 commit 3da1279
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
4 changes: 0 additions & 4 deletions .env → .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ DNS_PORT=10053
# Relay Configuration
DNS_RELAY_SERVERS=8.8.8.8,1.1.1.1

# API Configuration
DNS_API_PORT=8080 # Port for ACME HTTP API
DNS_API_TOKEN=1234

# TTL Configuration (in seconds)
DNS_DEFAULT_TTL=60

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
nanodns
.DS_Store

.env
.env.local
!.env.example
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ chmod +x nanodns-darwin-arm64

| Variable | Description | Default | Example |
|----------|-------------|---------|---------|
| DNS_PORT | UDP port for DNS server | 53 | 5353 |
| DNS_PORT | UDP port for DNS server | 53 | 10053 |
| DNS_RELAY_SERVERS | Comma-separated upstream DNS servers | - | 8.8.8.8:53,1.1.1.1:53 |
| A_xxx | A Record Details | - | - |
| CNAME_xxx | CNAME Record Details | - | - |
Expand Down Expand Up @@ -121,7 +121,7 @@ A_REC2=domain|service:servicename|ttl
```
Example:
```
A_REC1=app.example.com|192.168.1.10|300
A_REC1=app.example.com|10.10.0.1|300
A_REC2=api.example.com|service:webapp
```

Expand Down Expand Up @@ -164,10 +164,10 @@ TXT_REC2=_dmarc.example.com|v=DMARC1; p=reject; rua=mailto:dmarc@example.com
```bash
docker run -d \
--name nanodns \
-p 5353:5353/udp \
-e DNS_PORT=5353 \
-p 10053:10053/udp \
-e DNS_PORT=10053 \
-e DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 \ # Optional relay configuration
-e "A_REC1=app.example.com|192.168.1.10|300" \
-e "A_REC1=app.example.com|10.10.0.1|300" \
-e "A_REC2=api.example.com|service:webapp" \
-e "TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all" \
ghcr.io/mguptahub/nanodns:latest
Expand All @@ -182,15 +182,15 @@ services:
image: ghcr.io/mguptahub/nanodns:latest
environment:
# DNS Server Configuration
- DNS_PORT=5353 # Optional, defaults to 53
- DNS_PORT=10053 # Optional, defaults to 53
- DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 # Optional relay servers

# Local Records
- A_REC1=app.example.com|service:webapp
- A_REC2=api.example.com|192.168.1.10|300
- A_REC2=api.example.com|10.10.0.5|300
- TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all
ports:
- "${DNS_PORT:-5353}:${DNS_PORT:-5353}/udp"
- "${DNS_PORT:-10053}:${DNS_PORT:-10053}/udp"
networks:
- app_network

Expand All @@ -207,9 +207,9 @@ For detailed instructions on deploying NanoDNS in Kubernetes, see our [Kubernete
```bash
# Set environment variables
export DNS_PORT=5353
export DNS_PORT=10053
export DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53
export A_REC1=app.example.com|192.168.1.10
export A_REC1=app.example.com|10.10.0.7
export TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all

# Run the server
Expand All @@ -220,26 +220,26 @@ export TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all

```bash
# Test local records
dig @localhost -p 5353 app.example.com A
dig @localhost -p 10053 app.example.com A

# Test relay resolution (for non-local domains)
dig @localhost -p 5353 google.com A
dig @localhost -p 10053 google.com A

# Test other record types
dig @localhost -p 5353 www.example.com CNAME
dig @localhost -p 5353 example.com MX
dig @localhost -p 5353 example.com TXT
dig @localhost -p 10053 www.example.com CNAME
dig @localhost -p 10053 example.com MX
dig @localhost -p 10053 example.com TXT
```

## Common Issues and Solutions

1. Port 53 already in use (common on macOS and Linux):
- Use a different port by setting `DNS_PORT=5353` or another available port
- Use a different port by setting `DNS_PORT=10053` or another available port
- Update your client configurations to use the custom port

2. Permission denied when using port 53:
- Use a port number above 1024 to avoid requiring root privileges
- Set `DNS_PORT=5353` or another high-numbered port
- Set `DNS_PORT=10053` or another high-numbered port

3. DNS Relay Issues:
- Verify upstream DNS servers are accessible
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Verify the authenticity of releases:
1. **Local Development**
```bash
# Use non-privileged ports
export DNS_PORT=5353
export DNS_PORT=10053
# Keep environment files secure
chmod 600 .env
Expand Down Expand Up @@ -191,7 +191,7 @@ Verify the authenticity of releases:
- no-new-privileges:true
read_only: true
environment:
- DNS_PORT=5353
- DNS_PORT=10053
```
2. **Kubernetes**
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ services:
dns:
build: .
environment:
- DNS_PORT=5353
- DNS_PORT=10053
# A Records (domain|ip[|ttl])
- A_REC1=app.example.com|service:webapp
- A_REC2=api.example.com|service:api|120
- A_REC3=static.example.com|192.168.1.10|300
- A_REC3=static.example.com|10.10.0.1|300

# CNAME Records (domain|target[|ttl])
- CNAME_REC1=www.example.com|app.example.com
Expand All @@ -22,7 +22,7 @@ services:
- TXT_REC2=_dmarc.example.com|v=DMARC1; p=reject; rua=mailto:dmarc@example.com|3600
- TXT_REC3=_acme-challenge.example.com|validation-token-here|60
ports:
- "5353:5353/udp"
- "10053:10053/udp"
networks:
- app_network

Expand Down
12 changes: 6 additions & 6 deletions docs/assets/md/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
```bash
docker run -d \
--name nanodns \
-p 5353:5353/udp \
-e DNS_PORT=5353 \
-p 10053:10053/udp \
-e DNS_PORT=10053 \
-e DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 \
-e "A_REC1=app.example.com|192.168.1.10|300" \
-e "A_REC1=app.example.com|10.10.0.1|300" \
-e "TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all" \
ghcr.io/mguptahub/nanodns:latest
```
Expand All @@ -20,15 +20,15 @@ services:
dns:
image: ghcr.io/mguptahub/nanodns:latest
environment:
- DNS_PORT=5353 # Optional, defaults to 53
- DNS_PORT=10053 # Optional, defaults to 53
- DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53
# A Records
- A_REC1=app.example.com|service:webapp
- A_REC2=api.example.com|192.168.1.10|300
- A_REC2=api.example.com|10.10.0.10|300
# TXT Records
- TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all
ports:
- "${DNS_PORT:-5353}:${DNS_PORT:-5353}/udp" # Uses DNS_PORT if set, otherwise 5353
- "${DNS_PORT:-10053}:${DNS_PORT:-10053}/udp" # Uses DNS_PORT if set, otherwise 10053
networks:
- app_network

Expand Down
8 changes: 4 additions & 4 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data:
# A Records
A_REC1: "app.example.com|service:frontend.default.svc.cluster.local"
A_REC2: "api.example.com|service:backend.default.svc.cluster.local"
A_REC3: "static.example.com|192.168.1.10|300"
A_REC3: "static.example.com|10.10.0.1|300"

# CNAME Records
CNAME_REC1: "www.example.com|app.example.com|3600"
Expand Down Expand Up @@ -156,7 +156,7 @@ data:
DNS_RELAY_SERVERS: "8.8.8.8:53,1.1.1.1:53"

# Custom port example
DNS_RELAY_SERVERS: "custom.dns.server:5353,8.8.8.8:53"
DNS_RELAY_SERVERS: "custom.dns.server:10053,8.8.8.8:53"
```
When using multiple servers:
Expand All @@ -178,7 +178,7 @@ kubectl patch configmap nanodns-config --type merge -p '
{
"data": {
"A_REC1": "app.example.com|service:frontend.default.svc.cluster.local",
"A_REC2": "api.example.com|192.168.1.10|300"
"A_REC2": "api.example.com|10.10.0.2|300"
}
}'
```
Expand All @@ -202,7 +202,7 @@ kubectl rollout status deployment/nanodns
A_REC1: "app.example.com|service:frontend.default.svc.cluster.local"

# External IP with TTL
A_REC2: "api.example.com|192.168.1.10|300"
A_REC2: "api.example.com|25.35.45.55|300"

# Simple internal IP
A_REC3: "internal.example.com|10.0.0.50"
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func TestGetDNSPort(t *testing.T) {
},
{
name: "custom port",
envValue: "5353",
want: "5353",
envValue: "10053",
want: "10053",
},
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DNS_PORT=53
# DNS Records
# Format: domain|value|ttl
# Examples:
# A_REC1=app.local|192.168.1.10|300
# A_REC1=app.local|10.10.0.3|300
# A_REC2=api.local|service:myservice
# CNAME_REC1=www.local|app.local
# MX_REC1=local|10|mail.local
Expand Down

0 comments on commit 3da1279

Please sign in to comment.