SNAT out via OSPF route not outside interface

Evening Folks,

Trying to SNAT without specifying an outbound interface. Would like to SNAT with a specific inside IP out whatever OSPF path is active. Can’t seem to figure out a way to do it.

Thank you for any help!


Welcome to the Vyos forums!

I don’t think you can do SNAT without specifying an outbound Interface.

The rewrite happens when the packet leaves an Interface.

If you have OSPF and have multiple potential egress points, you probably just want two NAT rules, both the same, with a different “outbound-interface” statement.

I don’t think it’s possible to say, assign an IP to a loopback Interface and have SNAT use that as the address it rewrites.

Thanks @tjh . That’s what I’m deducing as well. I didn’t think about trying two SNAT statements. I’ll try that and see if that works and report back.


1 Like

You can also configure a source NAT rule with ‘outbound-interface any’.


I did not know that! That’s very helpful! Thanks @Jeff!