Page 1 of 1

Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 12:13 pm
by freeman7162
Hello!
I have a web server on 192.168.0.2. From internet i can access it by its dns name mysite.com . What should i do to get access in local network by dns name mysite.com instead of typing http://192.168.0.2

Re: Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 1:12 pm
by Experimentator
You need to add a so-called "hairpin NAT" rule.
Here's a good description: http://wiki.mikrotik.com/wiki/Hairpin_NAT

Re: Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 1:19 pm
by freeman7162
what exactly rule for nat i need to add?

Re: Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 1:19 pm
by freeman7162
What exactly rule for NAT i need to add?

Re: Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 1:58 pm
by Experimentator
Should be something like this:
/ip firewall nat
add chain=srcnat src-address=192.168.0.0/24 dst-address=192.168.0.2 protocol=tcp dst-port=80 action=masquerade

Re: Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 2:09 pm
by freeman7162
Should be something like this:
/ip firewall nat
add chain=srcnat src-address=192.168.0.0/24 dst-address=192.168.0.2 protocol=tcp dst-port=80 action=masquerade
it doesnot working!

Re: Access to local web server by its dns name instead of ip

Posted: Thu Nov 20, 2014 4:43 pm
by Experimentator
Well, I'm not an expert, but similar settings work for me just fine.

You have your server running on 192.168.0.2, right? What port your web server is running on? How do you connect to it from outside - is it just the domain.name or domain.name:port ?

Can I see your current NAT configuration?

Re: Access to local web server by its dns name instead of ip

Posted: Fri Nov 21, 2014 8:58 pm
by freeman7162
thanks to all, problem solved by myself with this NAT rules
http://project.eraps.ru/knowledgebase/articles/13