• MikroTik.com
  • RouterBOARD
  • User Meeting
  • Training
  • User Manual
  • Support
  • Downloads
  • Videos
Register |   * Login | HOME

View unanswered posts | View active topics

How do I redirect port 80 to another server, LAN side?  Page 1 of 1
 [ 3 posts ]  Post new topic Reply to topic
  Print view Previous topic | Next topic 
Author Message
wifiryan
 Post subject: How do I redirect port 80 to another server, LAN side?
PostPosted: Wed Aug 15, 2012 5:18 am 
Offline
just joined

Joined: Sat Sep 17, 2011 6:31 pm
Posts: 7
Karma: 0
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


Top
 Profile  
 
greencomputing
 Post subject: Re: How do I redirect port 80 to another server, LAN side?
PostPosted: Wed Aug 15, 2012 9:20 am 
Offline
Frequent Visitor
Frequent Visitor
User avatar

Joined: Wed Jun 23, 2010 12:12 pm
Posts: 91
Karma: 7

Location: Italy
Hi sir

this work as requested .

Code:
/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
--------------------
Senior Mikrotik Consultant - Mediterranean Area (Italy, Greece, North Africa, Middle East, Spain, Portugal)


Top
 Profile  
 
wifiryan
 Post subject: Re: How do I redirect port 80 to another server, LAN side?
PostPosted: Tue Aug 21, 2012 5:24 am 
Offline
just joined

Joined: Sat Sep 17, 2011 6:31 pm
Posts: 7
Karma: 0
greencomputing wrote:
Hi sir

this work as requested .

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 3 posts ] 

Board index » RouterOS » General

All times are UTC + 2 hours


Who is online

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


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Karma functions powered by Karma MOD © 2007, 2009 m157y