diff --git a/docker-compose/bind9/Readme.md b/docker-compose/bind9/Readme.md new file mode 100644 index 00000000..3f89882c --- /dev/null +++ b/docker-compose/bind9/Readme.md @@ -0,0 +1,27 @@ +### [image Bind9 | Ubuntu ](https://hub.docker.com/r/ubuntu/bind9) + +if you are running it on an ubuntu machine first you have to disable `Network Name Resolution` service + +```bash +vim /etc/systemd/resolved.conf +``` + +change `#DNSStubListener=yes` to `DNSStubListener=no` and restart its service + +```bash +sudo systemctl restart systemd-resolved.service +``` + +create following directories and give write access to other users to `cache` directory + +```bash +mkdir ./config ./cache ./records && chmod o+w ./cache +``` + +change your Domain configurations in `./config/named.conf` file + +start `Bind` service with: + +```bash +sudo docker compose up -d +``` diff --git a/docker-compose/bind9/config/example.named.conf b/docker-compose/bind9/config/example.named.conf deleted file mode 100644 index e69de29b..00000000 diff --git a/docker-compose/bind9/config/named.conf b/docker-compose/bind9/config/named.conf new file mode 100644 index 00000000..e88b3afe --- /dev/null +++ b/docker-compose/bind9/config/named.conf @@ -0,0 +1,13 @@ +options { + directory "/var/cache/bind"; + forwarders { + 1.1.1.1; + 8.8.8.8; + }; + listen-on-v6 { any; }; +}; + +zone "yourdomain.home" IN { + type master; + file "/etc/bind/yourdomain.zone"; +}; diff --git a/docker-compose/bind9/config/yourdomain.zone b/docker-compose/bind9/config/yourdomain.zone new file mode 100644 index 00000000..b4fb6c47 --- /dev/null +++ b/docker-compose/bind9/config/yourdomain.zone @@ -0,0 +1,15 @@ +$TTL 300 ; 5 minutes +$ORIGIN yourdomain.home. +@ IN SOA yourdomain.home. ( + 2024021700 ; serial + 12h ; refresh + 15m ; retry + 3w ;expire + 2h ;minimum ttl + ) + + IN NS ns.yourdomain.home. + +ns IN A 192.168.14.2 + +yourserver IN A 192.168.14.3 diff --git a/docker-compose/bind9/docker-compose.yaml b/docker-compose/bind9/docker-compose.yaml index 2f0e2873..52da4533 100644 --- a/docker-compose/bind9/docker-compose.yaml +++ b/docker-compose/bind9/docker-compose.yaml @@ -1,12 +1,15 @@ --- services: bind9: - image: ubuntu/bind9:latest container_name: bind9 + image: ubuntu/bind9:9.18-23.04_edge ports: - - "53:53" + - "53:53/tcp" + - "53:53/udp" + # (optional) allow DNS over TLS, used by RNDC + # - "953:953/tcp" volumes: - - /etc/bind/:/etc/bind/ - - /var/cache/bind:/var/cache/bind - - /var/lib/bind:/var/lib/bind - restart: unless-stopped \ No newline at end of file + - ./config:/etc/bind/ + - ./cache:/var/cache/bind + - ./records:/var/lib/bind + restart: unless-stopped