Page 1 of 1

Nat ONLY SMTP (port 25) to a particular interface/IP on MT

Posted: Wed Mar 18, 2015 6:55 am
by omnicron
I need to NAT all outgoing SMPT Port 25 traffic to a particular MT interface with an IP address.

I tried something like in ip firewall nat

add action=masquerade chain=srcnat dst-port=25 out-interface=ether3-out protocol=tcp to-addresses=x.x.x.x (ip on MT)

but it does not seem to work. I have tried numerous other ideas and re-re-read the NAT/MASQ rules and just can't seem to hit on a combination of how to make it work.... I usually NAT the other way so this is a little bit of a mind bender for me.

Any one better at this give me a hint?

Thanks...

Re: Nat ONLY SMTP (port 25) to a particular interface/IP on MT

Posted: Wed Mar 18, 2015 8:40 am
by seb4itik
Hi omnicron,

Is the IP address you want to nat SMTP outgoing connexions on the same interface that you default gateway ?
Can you give more details about your configuration or, even, copy it here ?
Thanks.

Re: Nat ONLY SMTP (port 25) to a particular interface/IP on MT

Posted: Wed Mar 18, 2015 8:57 am
by omnicron
It is not the same as the default gateway interface for the network, but it is for the MT router.

I am not going to paste my config with IPs etc here... It is just not that complicated.

It is almost like a reverse NAT idea I want to do.

All internal traffic destined to TCP port 25 on any on src-address not equal to ether1 interface but destined to ether1 interface (0.0.0.0/0) gets it src-address rewritten to the src-address on ether1 interface. The dst-address can vary.

Omnicron

Re: Nat ONLY SMTP (port 25) to a particular interface/IP on MT

Posted: Thu Mar 19, 2015 9:57 am
by seb4itik
I am not going to paste my config with IPs etc here... It is just not that complicated.
Maybe you can just change the IPs before posting your config here... It is just not that complicated.
And maybe it can help people that spend time trying to help you...

Re: Nat ONLY SMTP (port 25) to a particular interface/IP on MT

Posted: Thu Mar 19, 2015 6:13 pm
by rmmccann
Just to clarify what you're doing:

You want to src-nat all outbound port 25 smtp traffic to a particular IP on your MT, correct? In other words, if you have an outbound 25 smtp, you want it to appear to always come from the same IP on your MT?

If so, I think you can just adjust your rule as follows:
add action=src-nat chain=srcnat dst-port=25 out-interface=ether3-out protocol=tcp to-addresses=x.x.x.x