What you experience is the difference between the service ip and the container ip. Swarm routes a publised port towards the service ip, which acts as a virtual ip and is responsible to forward the traffic to the containers. vip is the default behavior for published ports. You can change it to mode: dnsrr to let the service ip always lookup and return the container ip(s).
Did you try to use {servicename}.{networkname} instead of the servicename? Is you traffic routed thru a containerized reverse proxy?
I don’t know clearly about Engine DNS Server. Where can I edit DNS server?
In my case, task1.myservice and task2.myservice is a service using overlay network. If I let node manager to become DNS server, it doesn’t know internal network of myservice to load balancing.