This is a simple one (I hope), just need a nudge in the right direction.
I want to forward data on the http/https protocol to a specific server depending on the port being used.
For instance, say my local MikroTik’s IP address is 192.168.88.1
If a PC on my network attempts to access say, port 500, i want to be able to redirect that traffic to an alternative server.
I was able to create an application in VB that solved this problem, but my application only works for simple TCP/UDP connections (like VNC) and not for HTTP.
I drew up an example to explain this more clearly.
This network already has fully functional Leased-line with 3G failover in place.
What I’m attempting is to add a faster (less reliable) line, like DSL, and use it for only one specific program, without tinkering with the existing solution.
If i Correct Think About Your idea , You Can Do This With Destination Nat …
i explain that with this example :
you want , if anybody use X.X.X.X:X , that body redirect to X.X.X.X:Y or Y.Y.Y.Y:Y .
Solution can be done with Destination Nat and is very Simple :
ip firewall nat add action=dst-nat chain=dstnat comment=“Redirect To Y Server” disabled=no
dst-address=192.168.88.1 dst-port=80 protocol=tcp to-addresses=Y.Y.Y.Y
Also You Can Redirect to Address And Also Port :
ip firewall nat add action=dst-nat chain=dstnat comment=“Redirect To Y Server” disabled=no
dst-address=192.168.88.1 dst-port=80 protocol=tcp to-addresses=Y.Y.Y.Y to-ports= Y
Hi rezamoghadam, it seems that did the trick!
Many thanks!
It’s a great way of bypassing the default gateway and force a new route for the application to take!
sorry for disturbing you frient
but i have a problem with redirecting to or from squid server
this is setup for internel lan
wan link is on mt 450g (ether1)10.210.2.5/24
ether2 connected to squid (with single lan card)192.168.5.1 mt interface and squid ip is 192.168.5.2/24
and ether3 is used for lan with natting (dhcp server interface on ether3) 10.0.0.1/8
first rule:
masqurade the source to wan outinterface is ether1
0.0.0.0/0 gateway 10.210.2.1
#############
create routing mark
chain=prerouting source add=lan ip (client’ip) protocol= 6(tcp) dest port 80 routing mark= http action mark routing passthrough=yes
and add route for mangle http with mark 0.0.0.0/0 gateway =192.168.5.2/24 routing mark =http
###############
dstnat for ::
/ ip firewall nat
add chain=dstnat source add=10.0.0.0/8 dst-port 80 protocol=tcp action=dstnat to add 192.168.5.2 to port 3128 . also add in-interface = lan (client comes from)
/ip firewall nat
add chain= dstnat source add= 10.0.0.0/8 dstnat=80 protocol=tcp action=accept
also add in-interface=lan (whaere lan client comes from)
############
i think there is little mistake so can you guide is right direction