TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.27k stars 418 forks source link

i ran docker image of dnsServer but i cant access app #637

Closed m0x61h0x64i closed 1 year ago

m0x61h0x64i commented 1 year ago

after i installed docker image i ran this command :

$docker run technitium/dns-server -p 5380:5380
Technitium DNS Server was started successfully.
Using config folder: /opt/technitium/dns/config

Note: Open http://b8f6db9b1e57:5380/ in web browser to access web console.

Press [CTRL + C] to stop...

but when im tring to access http://b8f6db9b1e57:5380/ nothing shows...

docker-compose.yml :

version: "3"
services:
  dns-server:
    container_name: dns-server
    hostname: dns-server
    image: technitium/dns-server:latest
    # For DHCP deployments, use "host" network mode and remove all the port mappings, including the ports array by commenting them
    # network_mode: "host"
    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
      # - "853:853/udp" #DNS-over-QUIC service
      # - "853:853/tcp" #DNS-over-TLS service
      # - "443:443/udp" #DNS-over-HTTPS service (HTTP/3)
      # - "443:443/tcp" #DNS-over-HTTPS service (HTTP/1.1, HTTP/2)
      # - "80:80/tcp" #DNS-over-HTTP service (use with reverse proxy or certbot certificate renewal)
      # - "8053:8053/tcp" #DNS-over-HTTP service (use with reverse proxy)
      # - "67:67/udp" #DHCP service      
    environment:
      - DNS_SERVER_DOMAIN=dns-server #The primary domain name used by this DNS Server to identify itself.
      # - DNS_SERVER_ADMIN_PASSWORD=password #DNS web console admin user password.
      # - DNS_SERVER_ADMIN_PASSWORD_FILE=password.txt #The path to a file that contains a plain text password for the DNS web console admin user.
      # - DNS_SERVER_PREFER_IPV6=false #DNS Server will use IPv6 for querying whenever possible with this option enabled.
      # - DNS_SERVER_OPTIONAL_PROTOCOL_DNS_OVER_HTTP=false #Enables DNS server optional protocol DNS-over-HTTP on TCP port 8053 to be used with a TLS terminating reverse proxy like nginx.
      # - DNS_SERVER_RECURSION=AllowOnlyForPrivateNetworks #Recursion options: Allow, Deny, AllowOnlyForPrivateNetworks, UseSpecifiedNetworks.
      # - DNS_SERVER_RECURSION_DENIED_NETWORKS=1.1.1.0/24 #Comma separated list of IP addresses or network addresses to deny recursion. Valid only for `UseSpecifiedNetworks` recursion option.
      # - DNS_SERVER_RECURSION_ALLOWED_NETWORKS=127.0.0.1, 192.168.1.0/24 #Comma separated list of IP addresses or network addresses to allow recursion. Valid only for `UseSpecifiedNetworks` recursion option.
      # - DNS_SERVER_ENABLE_BLOCKING=false #Sets the DNS server to block domain names using Blocked Zone and Block List Zone.
      # - DNS_SERVER_ALLOW_TXT_BLOCKING_REPORT=false #Specifies if the DNS Server should respond with TXT records containing a blocked domain report for TXT type requests.
      # - DNS_SERVER_BLOCK_LIST_URLS= #A comma separated list of block list URLs.
      - DNS_SERVER_FORWARDERS=178.22.122.100:5353, 185.51.200.2:5353 #Comma separated list of forwarder addresses.
      # - DNS_SERVER_FORWARDER_PROTOCOL=Tcp #Forwarder protocol options: Udp, Tcp, Tls, Https, HttpsJson.
      # - DNS_SERVER_LOG_USING_LOCAL_TIME=true #Enable this option to use local time instead of UTC for logging.
    volumes:
      - config:/etc/dns
    restart: unless-stopped
    sysctls:
      - net.ipv4.ip_local_port_range=1024 65000

volumes:
    config:

how can i fix this? i cant open app.

ShreyasZare commented 1 year ago

Thanks for the post.

but when im tring to access http://b8f6db9b1e57:5380/ nothing shows...

The message shown uses the hostname to generate the URL. In this case its the docker container's hostname which may not resolve from elsewhere. You must thus use the IP address of the server instead of the hostname in the URL to access the web panel.

m0x61h0x64i commented 1 year ago

@ShreyasZare thanks for reply, i got the ip address from docker inspect <container id> it gave me 172.17.0.1 as IPAddress but when i open 172.17.0.1:5380 nothing shows...

ShreyasZare commented 1 year ago

@ShreyasZare thanks for reply, i got the ip address from docker inspect <container id> it gave me 172.17.0.1 as IPAddress but when i open 172.17.0.1:5380 nothing shows...

Use the IP of your host machine instead of the container's internal IP.

m0x61h0x64i commented 1 year ago

@ShreyasZare, i used all ips listed here :

$ip --color a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp4s0f2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether ac:22:0b:71:97:1f brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 24:0a:64:17:9d:eb brd ff:ff:ff:ff:ff:ff
    inet 192.168.204.49/24 brd 192.168.204.255 scope global dynamic noprefixroute wlp3s0
       valid_lft 2579sec preferred_lft 2579sec
    inet6 fe80::49fa:500d:8cf1:f6ba/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: br-2ab8c0a9f809: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:68:89:68:69 brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.1/16 brd 172.19.255.255 scope global br-2ab8c0a9f809
       valid_lft forever preferred_lft forever
5: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:e7:92:17:45 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
12: br-2daf30c13e07: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:82:3e:0e:1f brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 brd 172.18.255.255 scope global br-2daf30c13e07
       valid_lft forever preferred_lft forever
24: vethf473d5c@if23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether f2:d7:75:c2:c0:8e brd ff:ff:ff:ff:ff:ff link-netnsid 0

still i cant open app i tested this way-> ip:5380

ShreyasZare commented 1 year ago

Run netstat -nlpt | grep 5380 command and check if the port is listening to confirm if its actually running.

m0x61h0x64i commented 1 year ago

@ShreyasZare, nothing shows...

$sudo netstat -nlpt | grep 5380
ShreyasZare commented 1 year ago

Then your container is not running. Check docker container status.

m0x61h0x64i commented 1 year ago

@ShreyasZare image its running

ShreyasZare commented 1 year ago

I am not sure what the issue is here. Seems to be something specific to your system since if the container is setup with port 5380 then it should show up in netstat command.

m0x61h0x64i commented 1 year ago

@ShreyasZare, its now running on port 5380. i just put the -p before app name in this command and solve the issue :

docker run -p 5380:5380 technitium/dns-server

but another problem is that i configured the environment in docker-compose.yml file but im not getting those configs in my app...

in my app i see : image

but i configured environment like this :

when i try to add these two : 178.22.122.100:5353 185.51.200.2:5353 as forwarders, after i save settings, they dont work.

ShreyasZare commented 1 year ago

The environment variables work only the first time the DNS server starts. So, when the config files are generated, the environment variables are not used. So, you need to manually configure the forwarders now from the web panel.

If the forwarders you added manually are not working then check the DNS logs from the web panel to know what went wrong. Post any errors you see here if you need help understanding them.