How to Forward all outbound mail port 25 using Outbound Nat to a local IP address on port 26 to Proxmox Mail Gateway
-
I am running Proxmox Mail Gateway, it is an email filtering product.
The inbound Nat rule is straight forward, just forward any traffic from port 25 to the local ip of your proxmox mail gateway. (Most people know how to do an inbound Nat rule so I wont cover that here.)
Previously I had configured All local mail servers to use the proxmox mail gateway as a relay host. This outbound Nat rule makes that no longer necessary.
The below is how to make sure outbound mail also goes through the proxmox mail gateway. Take any traffic port 25 that did NOT originate from the proxmox mail gateway, and forward it to the proxmox mail gateway.
PMG is a firewall Alias
Navigate to: Firewall > Aliases > IP, type Hosts.
Navigate to: Firewall > NAT > Outbound, select Manual Outbound NAT rule generation.
Incase the pictures go down, heres the outbound nat rules in text format:
WAN PMG * * 25 (SMTP) WAN address * PMG to WAN WAN PMG 25 (SMTP) * * WAN address * PMG to WAN WAN any * * 25 (SMTP) PMG 26 All port 25 to PMG:26 WAN any 25 (SMTP) * * PMG 26 All port 25 to PMG:26