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

3 posts   •   Page 1 of 1
wifiryan
just joined
 
Posts: 17
Joined: Sat Sep 17, 2011 7:31 pm

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

by wifiryan » Wed Aug 15, 2012 6:18 am

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

User avatar
greencomputing
Frequent Visitor
Frequent Visitor
 
Posts: 95
Joined: Wed Jun 23, 2010 1:12 pm
Location: Italy

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

by greencomputing » Wed Aug 15, 2012 10:20 am

Hi sir

this work as requested .

Code: Select all
/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
If answer was helpful to you why to not plan to... give me karma :)
greencomputing

--------------------
MTCNA / MTCRE certified Senior Mikrotik Consultant

wifiryan
just joined
 
Posts: 17
Joined: Sat Sep 17, 2011 7:31 pm

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

by wifiryan » Tue Aug 21, 2012 6:24 am

greencomputing wrote:Hi sir

this work as requested .

Code: Select all
/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!

3 posts   •   Page 1 of 1

Who is online

Users browsing this forum: Google [Bot] and 33 guests

It is currently Sun Dec 21, 2014 11:06 pm