Community discussions

 
IsNoGood
just joined
Topic Author
Posts: 2
Joined: Thu Sep 22, 2016 9:05 pm

Hairpin NAT issue

Fri Sep 23, 2016 5:57 am

Hi all, it seems it quite often problem with correct setup of hairpin nat.

I have domain name and Owncloud server in local network, so i setup port forwarding to get access to my Owncloud from internet it works fine, but i can't access to it via Domain from LAN, it still accessible from local address, but i use some apps on mobile to get access to server and they can use only one type of address. So i want have access to server via Domain both from internet and local network.
I've tried different guides how to setup hairpin nat but still can't make it work.

My setup

Local lan : 192.168.0.0/24 (local bridge - br1-lan)
Gateway : 192.168.0.1
WAN via PPPoE (IP 1.1.1.1) (out-interface = dom.ru-pppoe)
server: 192.168.0.5
Version Router OS : 6.36.3

last used setup is:
/ip firewall nat
add action=masquerade chain=srcnat out-interface=dom.ru-pppoe src-address=192.168.0.0/24
add action=masquerade chain=srcnat comment="hairpin nat" dst-address=!192.168.0.1 src-address=192.168.0.0/24
add action=dst-nat chain=dstnat dst-address=!192.168.0.1 dst-address-type=local dst-port=80 protocol=tcp to-addresses=192.168.0.5 to-ports=80
add action=dst-nat chain=dstnat dst-address=!192.168.0.1 dst-address-type=local dst-port=433 protocol=tcp to-addresses=192.168.0.5 to-ports=433
add action=netmap chain=dstnat dst-address=1.1.1.1 dst-port=80 protocol=tcp to-addresses=192.168.0.5
add action=netmap chain=dstnat dst-address=1.1.1.1 dst-port=443 protocol=tcp to-addresses=192.168.0.5


Any help would be appreciated.

thank you in advance,
 
User avatar
Splash
Member Candidate
Member Candidate
Posts: 151
Joined: Fri Oct 16, 2015 10:09 am
Location: Johannesburg, South Africa

Re: Hairpin NAT issue

Fri Sep 23, 2016 3:16 pm

You may need to add a local static DNS entry for the local IP of the server, and use the Mikrotik to resolve your DNS queries. There is no need to try access the server using your external IP address, when the server is on your local LAN.
MTCNA, MTCRE, MTCINE, MTCTCE, MTCIPv6E, MTCUME
 
IsNoGood
just joined
Topic Author
Posts: 2
Joined: Thu Sep 22, 2016 9:05 pm

Re: Hairpin NAT issue

Fri Sep 23, 2016 4:41 pm

Thanks, seems it work fine for my purposes.

Who is online

Users browsing this forum: No registered users and 19 guests