How 2 connect a Mailserver over VPN to the public 'net?

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
RandyK
OpenVpn Newbie
Posts: 2
Joined: Thu Mar 24, 2011 7:19 am

How 2 connect a Mailserver over VPN to the public 'net?

Post by RandyK » Thu Mar 24, 2011 7:32 am

I have a OpenVPN 2.1.4 routed setup connecting a remote server on a static ip with my home LAN on a dynamic ip.

The remove server is setup as the OpenVPN server.

Everything's working client <> server. I can ping in both directions, to and from endpoints and machines on my LAN subnet.

I setup a mail-server on my home LAN that "listens" only @ a private ip:25 on my LAN subnet.

I want to connect that mail-server's in&out-bound traffic over the VPN link to the internet-facing interface with a public IP on the remote server.

How do I do that? Is that routing OUTSIDE of OpenVPN just at the kernel level? Or do I configure that in OpenVPN?

Randy

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: How 2 connect a Mailserver over VPN to the public 'net?

Post by maikcat » Thu Mar 24, 2011 7:38 am

hi there,

it would help up if you posted your configs..
what MTA you use?
can you post the part of its config reffering to network..?

cheers,

michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: How 2 connect a Mailserver over VPN to the public 'net?

Post by janjust » Thu Mar 24, 2011 9:48 am

hi Randy,

this depends a little on your setup, but most likely you have a client/server setup (i.e. server config has 'server xx.yy' in it.
In that case you want to do client-side routing to the server-side. This is covered a little in the OpenVPN HOWTO part "expanding the scope":
http://openvpn.net/index.php/open-sourc ... html#scope

what you'd want to do is set up a client config file (aka CCD file on the server) to tell openvpn that the your home LAN can be found "behind" your opevnpn client.

As an alternative, if your openvpn client is running linux/bsd then you could use some smart iptables/pf portforwarding rule to forward ONLY traffic from and to <home-lan-mail-server>:<port>

RandyK
OpenVpn Newbie
Posts: 2
Joined: Thu Mar 24, 2011 7:19 am

Re: How 2 connect a Mailserver over VPN to the public 'net?

Post by RandyK » Thu Mar 24, 2011 2:12 pm

Hi Jan

I bought & used your book. A big help! :-)

I guess I explained poorly. I already have access to my home lan.

What I need is mail sent to my server's real IP, 1.2.3.4:25, to be 'redirected' to the mailserver on the LAN.

With no OpenVPN in the equation, I'd do that, like you suggest, with a pf 'redirect' rule in the firewall at the server. WITH OpenVPN do I simply treat it the same?

Randy

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: How 2 connect a Mailserver over VPN to the public 'net?

Post by janjust » Thu Mar 24, 2011 3:46 pm

yes, in theory it's the same with a VPN connection in place : if the VPN connection is functioning properly it simply becomes a matter of routing and NATting.

Great to hear that you've bought my book - thanks!

Post Reply