Wirguard: CoreDNS not resolving locally configures hosts


I am trying to use Wireguard as an VPN entry point from which I need to access some local computers. The setup of the used computers is:

  • One computer with a public IP and access to a local network: C1

  • One (at the moment) computer with just access to the local network: C2

I can access C1 from C2 and vice versa and routing is working so I can access public resources (for example google.com) from C2 via C1.

I installed a wireguard docker container on C1. If connecting to C1 with wireguard from a client PC I can communicate with C1 and C2 using the IP addresses.

I created a configuration for coredns looking like this:

. {

hosts /config/coredns/hosts {

reload 60s



forward . <IPs of some more DNS>



The file “/config/coredns/hosts” contains a list of internal hostname in std. hosts- file notation: c2.mydomain.test

After restarting the wirguard container I hoped to be able to use the FQDN defined in the hosts file. But I am not able to ping c2 from a client connected with wireguard od from within the container.

Anybody has a hint what might go wrong here?