I have Windows 2012 domain server with DNS and DHCP, all computers with leased IP are registered on my DNS so I have proper hostname resolution on my LAN. On DNS server as forwarder I have set Mikrotik LAN IP, and on Mikrotik I have OpenDNS servers configured. Everything work as expected but on mikrotik I do not have hostnames resolution, If I ping hostname pc01 it give me error “Invalid value for argument address” if I ping hostname with all domain name pc01.ad.mydomain.com then I have reply with IP from internet not from my LAN.
If I add in IP–>DNS–>Static, name: *.ad.mydomain.com with my local DNS IP 10.1.1.50 this do not help, still getting reply for my hostnames from internet not from my Windows DNS.
Is any way to have locale dns names resolution on mikrotik with my config?
No.
You would want to set a static record for ad.mydomain.com with a NS record pointing to your Windows 2012 server, but RouterOS cannot do that!
The only solution is to configure the Windows 2012 server to use the MikroTik as a resolver and configure the DHCP there to set the Windows 2012 server as DNS resolver for the clients.
When you want DNS for the local systems to work on the MikroTik as well, you need to set the Windows 2012 server as the DNS resolver in the MikroTik, but of course then you need to set the OpenDNS servers directly in the Windows 2012 system (not via the MikroTik) or else you create a loop.
I asked about that because I do redirect remote desktop from internet to my computers on lan, so I use ‘dst-nat’ with ‘to-addresses’ but the problem is that every PC have dynamically allocated IP, so my port forwarding rule working until pc not change its IP address. I could use a script:
/ip firewall nat set [find comment="RDP - to pc02"] to-addresses=[:resolve pc02.ad.mydomain.com]
but if mikrotik can’t resolve my hosts it’s useless for my and I don’t have any idea how to do this? (I don’t want to create reservations in dhcp)
So you need to set it up as I wrote in the last sentence.
Personally I’d avoid port forwarding to LAN hosts with dynamic addresses. If assignments are truly dynamic, then there will always be a time window when router’s port forwarding rule will be out of sync with DHCP/DNS reality.