Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
using a VPS IP for mail locally hosted mail server.
« previous
next »
Print
Pages: [
1
]
Author
Topic: using a VPS IP for mail locally hosted mail server. (Read 809 times)
crash
Newbie
Posts: 13
Karma: 0
using a VPS IP for mail locally hosted mail server.
«
on:
November 17, 2023, 05:32:31 pm »
so here is my network:
vps is running ubuntu server and I'm running ospf on all of the nodes.
What I want to do is to forward all traffic on specific ports to my mail local mail server which I have done by running this command on my vps:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m multiport --dports 25,110,143,465,587,993,995,4190 -j DNAT --to-destination x.x.x.1
However I'm not sure how should I do the return path on opnsense so packets originating from x.x.x.1:(port range above) be sent out via vps's public ip.(z.z.z.z).
The best thing that I can think of is to set a second ip on my vps's wan interface (eth0) with a local ip (say 192.168.20.1/24) and set that IP as a gateway for specific traffic originating from x.x.x.1 but It doesn't work unfortunately .
do note I have put the gw on LAN reason being I want to to be independent of tunnel interfaces (so I can have one rule doing all the work).
any tips would be appreciated.
«
Last Edit: November 17, 2023, 06:58:17 pm by crash
»
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
using a VPS IP for mail locally hosted mail server.