DNS server and WWW behind NAT

If you run your own DNS server and WWW server on the same private network you may ask the following questions:

How do I manage DNS queries for www.mydomain.com coming from my LAN? How will they be answered by the web server's private network IP address while DNS queries coming from the Internet will be get a regular Internet IP address associated with www.mydomain.com?

This assumes you have already made a port mapping for UDP port 53 for DNS resolution, and also TCP port 80 for HTTP services.

You will use WinRoute's built-in DNS forwarder to resolve the problem. At all client PCs you will set WinRoute's DNS forwarder as the DNS server. On the WinRoute PC you will have to perform the following settings:

How will it work?

All DNS queries sent by the client computers from your LAN will be resolved by WinRoute's DNS forwarder first. All queries will be checked against the records in the HOSTS file first. If the corresponding record is found, the query will be answered by the details in the HOSTS file (private IP address in our scenario). Inversely, all DNS queries from the Internet to your DNS server will be mapped directly to the local DNS server, bypassing WinRoute's DNS forwarder.

DNSfwd

If there won't be any record matching the query in HOSTS file the query will be further checked against to the records in WinRoute's DNS cache (that is included in WinRoute DNS forwarder). If DNS cache won't contain matching record the query will be sent further to DNS server that is set in WinRoute DNS forwarder for sending DNS queries to.

All DNS queries coming from the Internet will be forwarded based on Port Mapping settings directly to DNS server and resolved based on its records.

Note! In such scenario you cannot run DNS server at the same computer as WinRoute. It is because both services - WinRoute's DNS forwarder and your DNS server would run on the same port - UDP 53.