Community discussions

MikroTik App
 
maheshmat
just joined
Topic Author
Posts: 5
Joined: Fri Jul 15, 2016 5:58 pm

DST-NAT port 80 not working

Tue Jun 12, 2018 12:04 pm

Hi,
I want to access a web server that is located in my lan from anywhere using a domain.
I set my router IP address in my domain name server an an A record, so any request to that domain is now sending to my router.

I have this NAT rules:
/ip firewall nat
add action=masquerade chain=srcnat out-interface=pppoe-out1
add action=dst-nat chain=dstnat dst-port=8001 in-interface=pppoe-out1 protocol=tcp to-addresses=192.168.5.10 to-ports=8010

/ip service
set www disabled=yes

now I have 2 problems:
  • It works fine, but if I change the dst-port to 80 (and I have to do so), it doesn't work and page don't load.
  • If I remove in-interface all traffics to port 80 will forward to the server, and if let it still there, I can't access my web server using the domain in local lan

I'm using RB951 and RouterOS 6.42.3
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22673
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DST-NAT port 80 not working

Tue Jun 12, 2018 1:15 pm

Did you intentionally mean to do port translation?
basically in your dstnat rule people will be coming to the WAN side of the router using either the public IP or a dyndns type name with destination port of 8001,
The router will push the traffic to the private IP on your LAN (your server) withLANIP of 192.168.5.10 with destination port 8010.

Both rules seem ok.
This setup is for basic external access to your server only. Internal access to the server would be by the private LANIP.

What you need to setup is something called hairpin nat which will allow the domain access from the LAN side.
 
maheshmat
just joined
Topic Author
Posts: 5
Joined: Fri Jul 15, 2016 5:58 pm

Re: DST-NAT port 80 not working

Wed Jun 13, 2018 4:40 pm

Thanks for your reply.

What you need to setup is something called hairpin nat which will allow the domain access from the LAN side.

How can I setup hairpin nat with Dynamic IP address on my pppoe connection, I read This wiki page?
Also I figured out that the problem with port "80" was in my ISP
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22673
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: DST-NAT port 80 not working

Thu Jun 14, 2018 9:29 pm