Page 1 of 1

how to redirect traffic from an IP address to another way

Posted: Thu Apr 23, 2015 11:24 am
by wilsongamo
Hello All
My lan its 193.190.15.0/24
My comptuer 193.190.15.9
GW1 1.1.1.1
GW2 1.1.2.2

all my network computers using the GW1
want to know how to make the 193.190.15.9 uses GW2

Thanks

Re: how to redirect traffic from an IP address to another way

Posted: Thu Apr 23, 2015 2:17 pm
by adyb76
You need to use IP firewall mangle rule to add a route mark to packets from the IP you want to leave via the different gateway and add a default rule specifying the gateway and the packet mark.
I don't have a router board to hand right now, but the script it along these lines:

/ip firewall mangle add chain=forward src-address=193.190.15.9 action=mark-routing new-routing-mark=via-gw2
/ip route add dst-address=0.0.0.0/0 gateway=1.1.2.2 routing-mark=via-gw2

Hope this helps.

Ade

Re: how to redirect traffic from an IP address to another way

Posted: Thu Apr 23, 2015 4:08 pm
by wilsongamo
chain forward is not working

Re: how to redirect traffic from an IP address to another way

Posted: Thu Apr 23, 2015 5:35 pm
by adyb76
My bad, it should be prerouting chain