i know, this has been answered, but i can't get it to work. so. I would like to route traffic from/to my server using different route than the rest of my devices.
i have 2 public IPs, one dynamic by DHCP and one static. Each IP is also using its own gateway, which I'd like to use (and proove it's working using tracerouting from my server).
So far:
1. I've learned I've got to mark routing connection from server in prerouting mangle.
2. Default route, created by DHCP client, is set automatically. I only need to add default route for my marked connections. Also have to add static external ip.
3. Nat connections to/from my server
Code: Select all
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address=<static_ip> in-interface-list=WAN new-routing-mark=server passthrough=yes
add action=mark-routing chain=prerouting new-routing-mark=server passthrough=yes src-address-list=list-server
/ip route
add distance=1 gateway=<static_ips_gateway> routing-mark=server
/ip address
add address=<static_ip/mask> interface=sfp1 network=<static_network>
/ip firewall nat
add action=src-nat chain=srcnat comment="static IP from server" src-address-list=list-server to-addresses=<static_ip>
add action=dst-nat chain=dstnat comment="web server" dst-address=<static_ip> dst-port=80,443 protocol=tcp to-addresses=<internal_server_ip>
Yes, there is more efficient way of marking connection and I'm using src-address-list instead of simply using src-address, but that's not the point.
Help?