initial commit for docker dnsmasq and tailscale
This commit is contained in:
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y dnsmasq curl
|
||||||
|
|
||||||
|
# Install Tailscale
|
||||||
|
RUN curl -fsSL https://tailscale.com/install.sh | sh
|
||||||
|
|
||||||
|
COPY dnsmasq.conf /etc/dnsmasq.conf
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD ["dnsmasq", "--keep-in-foreground", "--log-facility=-"]
|
||||||
23
README.md
23
README.md
@@ -1,2 +1,25 @@
|
|||||||
# local-dns-docker
|
# local-dns-docker
|
||||||
|
|
||||||
|
https://www.reddit.com/r/Tailscale/comments/1dql8a6/use_the_same_domain_name_on_home_network_and_on/
|
||||||
|
|
||||||
|
What everybody has already said, but also use the tailnet IP of your DNS server as a global nameserver. I'll post my working steps:
|
||||||
|
|
||||||
|
* Create a subnet router on your DNS host.
|
||||||
|
|
||||||
|
1. On the DNS host you need to set --accept-dns=false
|
||||||
|
2. advertise routes
|
||||||
|
3. https://tailscale.com/kb/1019/subnets
|
||||||
|
sudo tailscale up --accept-dns=false --advertise-routes=192.168.x.x/x
|
||||||
|
|
||||||
|
* In tailscale Machines edit new host and allow new route(s)
|
||||||
|
* In tailscale DNS, create a global namerserver:
|
||||||
|
|
||||||
|
1. set it to the tailnet IP of your DNS server
|
||||||
|
2. you can set split DNS here or you can just use your DNS for everything
|
||||||
|
3. if u have android clients, check the slider to ignore local DNS
|
||||||
|
|
||||||
|
* (optional) do the Linux enhancements mentioned on https://tailscale.com/kb/1019/subnets
|
||||||
|
|
||||||
|
https://tailscale.com/kb/1019/subnets?tab=linux#connect-to-tailscale-as-a-subnet-router
|
||||||
|
|
||||||
|
There is also a procedure to initially register the device with Tailscale server before this whole thing can work. Maybe I will document later. Not necessary as long as using the credentials in /DATA/AppData/tailscale/ so don't delete them.
|
||||||
|
|||||||
27
dnsmasq.conf
Normal file
27
dnsmasq.conf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Don't use /etc/hosts or /etc/resolv.conf
|
||||||
|
no-hosts
|
||||||
|
no-resolv
|
||||||
|
|
||||||
|
# Listen on all interfaces
|
||||||
|
#interface=*
|
||||||
|
interface=eth0
|
||||||
|
interface=tailscale0
|
||||||
|
|
||||||
|
# Resolve *.local to 192.168.1.16
|
||||||
|
address=/.local/192.168.1.16
|
||||||
|
|
||||||
|
# Forward other queries to 192.168.1.1
|
||||||
|
server=192.168.1.1
|
||||||
|
|
||||||
|
# Log queries
|
||||||
|
log-queries
|
||||||
|
log-facility=-
|
||||||
|
|
||||||
|
# Don't use /etc/hosts
|
||||||
|
no-hosts
|
||||||
|
|
||||||
|
# Don't act as a DHCP server
|
||||||
|
no-dhcp-interface=
|
||||||
|
|
||||||
|
# Bind to all interfaces
|
||||||
|
bind-interfaces
|
||||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
dns-server:
|
||||||
|
container_name: dns-server
|
||||||
|
build: .
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_MODULE
|
||||||
|
devices:
|
||||||
|
- /dev/net/tun:/dev/net/tun
|
||||||
|
volumes:
|
||||||
|
- /DATA/AppData/dns-docker:/var/lib/tailscale
|
||||||
|
network_mode: host
|
||||||
|
restart: unless-stopped
|
||||||
4
entrypoint.sh
Normal file
4
entrypoint.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
tailscaled &
|
||||||
|
tailscale up --accept-dns=false --advertise-routes=192.168.1.0/24
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user