1

I just moved and my new provider is blocking all the ports (22, 25, 80,...) to be reachable from the internet. And got a dynamic IP.

I host all my services at home (mail, web, VPN, ...) on my server. I also have a VPS hosted.

How can I build a VPN from the server to the VPS ( 2nd VPN server) and reroute the ports trough the VPN tunnel to access my "homeserver" from the internet and bypass the provider's blocked network?

vps: centos 6 64 bit

homeserver: mac mini server

vpn server on the the vps openvpn-as

internet --> vps ---vpn--> server weppage

1
  • Yes you can do this, but no, its not reasonable to ask for a howto in superuser. OpenVPN can do this for you and there are howtos on how to do this. I note that you don't need a VPS at home, you can just set up a VPN
    – davidgo
    Nov 30, 2013 at 1:59

2 Answers 2

2

The more I thought about it, the more I realized that you have 2 options and I'll jot them down for you:

Option A - Easy

If possible, host your content out of your home just on different ports. So, for web, you would host it out of port 8080 and email out of port 8081, for the sake of argument. Then, on your VPS-hosted server, just configure Apache to proxy your web request to your "home server" on port 8080. No need for VPN and it's a LOT lighter in configuration.

So, if someone comes to http://www.mydomain.com, Apache on the VPS server will accept the request and reverse-proxy it to your IP address at home, http://1.2.3.4:8080. The same concept can be used with mail as well. Now, I know for residential services, your IP address will change at some point. I would suggest you get something like DynDNS to make your IP address as predictable as possible making Apache proxy administration much easier.

Option B - Not so easy

At a high level overview, what you'll need to do is establish a Site-to-Site VPN with a product like OpenVPN. You can google "openvpn site-to-site" and you'll get back numerous examples on how to achieve this.

Once you have set up a site-to-site tunnel, it could be as simple as just providing the VPN IP address of your web server that hosts your content in Apache. Or you can abstract (my preferred) your services via proxy services but then you're getting into Option A territory. Additionally, you would want your home server to establish your VPN connections as the IP address on the VPS server will be static.

Hope this helps!

0

Hi thanks you for the hint

what i did is

installed on my vps

RHEL/CentOS 6 64-Bit

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm

followed this

http://www.maxwhale.com/how-to-install-l2tp-vpn-on-CentOS/

many thanks to Maxhale.com because it is working great!!!

I assigned fixed ips to my vpn clients so i could forward the trafic to a specific client (in my case 10.1.2.3)

and in iptables i did this

for http iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT \ --to 10.1.2.3

the reason I did this is because all the ports are bloced at home and had already all the servers setup at home. did not want to reinstall apache, mysql, openfire, mailserver and could access my proxmox serversfarm for KVM and openvz ( got 35 vms on it)

best regards

Fred

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .