Page 1 of 1

How do I redirect port 80 to another server, LAN side?

Posted: Wed Aug 15, 2012 6:18 am
by wifiryan
The IP of my Mikrotik router is 192.168.0.1

When someone from inside the LAN browses to 192.168.0.1 I want to redirect them to a http server at 192.168.0.2, but still show 192.168.0.1 as the server IP in the browser.

Essentially it is port redirecting inside the LAN, just like port forwarding through NAT preserves the original WAN ip the request was sent out to. How do I go about this? I can only use IPTABLES to redirect WAN->LAN traffic, but need to redirect LAN->LAN traffic. I found a simple way to do this from a Windows Router/HTTP server to peform this using port redirection, so surely MikroTik can do this somehow?

Thank you

Re: How do I redirect port 80 to another server, LAN side?

Posted: Wed Aug 15, 2012 10:20 am
by greencomputing
Hi sir

this work as requested .
/ip firewall nat 
add action=dst-nat chain=dstnat disabled=no dst-port=80 protocol=tcp \
    to-addresses= 192.168.0.2

add action=masquerade chain=srcnat disabled=no dst-address=192.168.0.2 \
    dst-port=80 protocol=tcp
let me<know and have a nice day

Re: How do I redirect port 80 to another server, LAN side?

Posted: Tue Aug 21, 2012 6:24 am
by wifiryan
Hi sir

this work as requested .
/ip firewall nat 
add action=dst-nat chain=dstnat disabled=no dst-port=80 protocol=tcp \
    to-addresses= 192.168.0.2

add action=masquerade chain=srcnat disabled=no dst-address=192.168.0.2 \
    dst-port=80 protocol=tcp
let me<know and have a nice day

Thank you! In chain=dstnat I had to add dst. address 192.168.0.1 or all HTTP requests on the entire LAN were redirected, but other than that it works great. Thank you so much saved me hours!

Re: How do I redirect port 80 to another server, LAN side?

Posted: Thu Dec 07, 2017 10:59 pm
by takararonaldo
Thanks!! This is the solution! Helped me a lot!