Requests sent to my public ip from local network

Hello. I have mail server running with real domain like mail.mydomain.com. Lets say my static ip is “xx.xx.xx.xx” and mail server local ip address is “yy.yy.yy.yy”. What i want to do is redirect requests sent from local network to mail.mydomain.com so “xx.xx.xx.xx” should be redirected to “yy.yy.yy.yy”. Someone suggested me that i could use loopback feature but i’m don’t used it before and not sure how to do that. Can some show me some examples or lead me if is there a better way to do it? Thanks already.

Here’s basic info:

https://wiki.mikrotik.com/wiki/Hairpin_NAT

And some extra hints:

http://forum.mikrotik.com/t/hairpin-nat-is-there-a-simple-solution/140385/19

Finally, after long time i did it thanks to you :slight_smile:

Sorry for stealing your topic but:

I have similar problem:
Web server located on local network. Server uses port 444.
NAT port forwarding all incoming from 443 to 444 enabled.


When I connect to cloud.myserver.lv from outside, everything works.
When I connect to cloud.myserver.lv from local network, browser shows this error

The connection for this site is not secure
cloud.myserver.lv uses an unsupported protocol
ERR_SSL_VERSION_OR_CIPHER_MISMATCH

Tried to add

ip firewall nat add action=dst-nat chain=dstnat dst-address=publicIP dst-port=443 protocol=tcp to-addresses=192.168.88.248
ip firewall nat add action=masquerade chain=srcnat dst-address=192.168.88.248 dst-port=443 out-interface=bridge protocol=tcp src-address=192.168.88.0/24

Now the browser shows this:

This site can’t be reachedcloud.myserver.lv refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

What I’m missing?

Tried to add
ip firewall nat add action=dst-nat chain=dstnat dst-address=publicIP dst-port=443 protocol=tcp to-addresses=192.168.88.248 ???
ip firewall nat add action=masquerade chain=srcnat dst-address=192.168.88.248 dst-port=443 out-interface=bridge protocol=tcp src-address=192.168.88.0/24

TO
ip firewall nat add action=dst-nat chain=dstnat dst-address=publicIP dst-port=443 protocol=tcp to-addresses=192.168.88.248 to-ports=444
ip firewall nat add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=192.168.88.0/24

Alternatively simply move your server to a different subnet and the extra hairpin nat src rule is not required

Thanks, that helped!



About moving server to different network. Will my file server work then? Can i still mount drives to my PC without additional nat rules?

Not sure what you mean if your file server will work? what subnet a file server is on has no bearing on the functionality of the file server itself?
Not sure what you mean about mounting drives??

@jurgis

Will my file server work then? Can i still mount drives to my PC without additional nat rules?

yes, but your PC’s must accept route redirects.