Community discussions

MikroTik App
 
stevepat
just joined
Topic Author
Posts: 5
Joined: Sun Jan 12, 2025 3:01 pm

Name resolve in container gives timeout

Fri Jan 17, 2025 7:38 pm

Hi, me again.

I can not manage to get name resolution work within containers. There is a dns property which is not explained in documentation: https://help.mikrotik.com/docs/spaces/R ... Properties. I saw other posts using this property pointing to their gateway. I tried the same but without success:

My containers run on a separate network. Within the client's network name resolution is working fine:
% nslookup www.google.com
Server:		192.168.88.1
Address:	192.168.88.1#53

Non-authoritative answer:
Name:	www.google.com
Address: 142.250.186.36
Within the container I get a timeout:
/container/shell 0
/ # cat /etc/resolv.conf 
nameserver 172.17.0.1
/ # nslookup www.google.com
;; connection timed out; no servers could be reached
This is my configuration:
/ip/dns set allow-remote-requests=yes
/interface/bridge/add name=containers
/ip/address/add address=172.17.0.1/24 interface=containers network=172.17.0.0
/interface/veth/add address=172.17.0.2/24 gateway=172.17.0.1 gateway6="" name=veth1
/ip/firewall/nat add action=masquerade chain=srcnat comment=container-to-internet src-address=172.17.0.0/24
/container/add comment=nginx dns=172.17.0.1 interface=veth1 logging=yes mounts=letsencrypt-challenge,letsencrypt-certificates,nginx-config root-dir=usb2/nginx/root start-on-boot=yes

I hope someone can help me with a hint what to do. Do I need a firewall rule to bring DNS traffic (UDP 53) to MikroTik's DNS server or should it work as I configured it?

Thx,
Stephan