Mark route and srcnat

Hello

I would like to redirect some traffic to another gateway

This works fine if I mark route & setup default gateway with that mark.

Only I need to srcnat now (gateway does not nat)

How do I scrnat and redirect to another gateway.

EG
203.1.1.1 is public IP on router for ISP 1
203.2.2.2 is public IP on same router ISP2

I need to redirect some to isp2 and srcnat to 203.2.2.2

Is this possible?

Thanks

is each ISP on its own interface? just use src-nat / masq based on which interface it’s leaving.

Sam

Hello,

No, they share an interface.

I can src Nat but it will alwasy go out the default gateway.
I was wondering if I can srcnat & mark route at the same time

Thanks

That’s why I asked if you had 2 interfaces. If you mark the route and it’s going out interface1, it will srn-nat with interface1’s range. If your mark the route and it’s leaving interface2, it will src-nat with interface2’s range. On a shared interface you don’t have as much flexibility because now you’ve eliminated the interface decision.

Maybe you marked the connection at the same time you route marked right ? You should be able to use that connection mark in the nat chain as well.

Hello,

It is working

Routes: add route for packets marked “test” to gw2
Mangle: connection/packect and mark routing “test” (for me this was WOW games & Voip)

Nat: Srcnat to second IP all data marked with routing mark “test”

Works very well :slight_smile: :slight_smile: