Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Help with NAT/VPN.
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Help with NAT/VPN.

KupolKupol Member

Hello mates.

I hope you will be able to help me. I need two things.

I'm behind NAT on my home connection and I would like to access my computers from the outside internet. For this task I need a public IP address which my ISP doesn't offer for its clients. We are behind one IP per flat complex. Changing an ISP isn't an option.

So my question is: Is it possible to buy a VPS with a public IP address and make some sort of VPN and connect to it from my home computer and then just route all the traffic to my home computer from this VPS, so it behaves like a normal connection with a public IP?

If this is possible could you point me out to a tutorial how to set this up or at least tell me some keywords I should search for as I'm completely clueless about networking beyond some basic stuff.

The second thing I would like to know is, if the above scenario is possible to set up I would like to buy a VPS for this task. It should be somewhere in Europe, NL, GER, FR location are fine, I'm from eastern Europe. As for the specs:

64MB RAM,
5GB HDD,
500GB BW

Should be enough I think.

I'm open to annual payment as well.

Thank you for your help.

Comments

  • Are you using Windows or Linux?
    If you use Windows, just use Teamviewer. Install it on the computer and at the other side of the connection.

    If you use Linux, then it's possible to do routing using vpn. I once did it in the past, since our system is only accessible from local net, but having one server that can access the internet. So I just install vpn on the server, and connect to the local network from the internet.

  • @ErawanArifNugroho
    I'm using both Windows and GNU/Linux. I don't want to use Teamviewer as I want to be able to connect to FTP, SSH and other various services.

    So the solution should be to setup some sort of VPN on the VPS with accessible public IP and then connect my router to the VPN?

  • @Kupol, yes, like that. :)

    As for FTP, I'm using vps for running Proftpd, but only accessible from whitelisted IP's :)

  • @spekk
    If I understood correctly that article doesn't describe what I want to achieve.

    Here is an example what I want to achieve:

    Let's say I run a webserver on one of my home PCs it can not be accessed from the internet because it's behind NAT. So I want to install some sort of VPN server on VPS and a VPN client on my webserver PC. Then when someone enters IP of my VPS it routes traffic to my webserver PC over the VPN.

    The scheme should look like this:

    VPS IP ---> VPN server ---> routes traffic to VPN client ---> webserver behind NAT

    I hope you get what I mean.

  • It's just the same case as me and my company

  • Well, I guess I'll try to set up a normal VPN then.

    Now I need a VPS for this task.

  • @Kupol said:
    spekk
    If I understood correctly that article doesn't describe what I want to achieve.

    Here is an example what I want to achieve:

    Let's say I run a webserver on one of my home PCs it can not be accessed from the internet because it's behind NAT. So I want to install some sort of VPN server on VPS and a VPN client on my webserver PC. Then when someone enters IP of my VPS it routes traffic to my webserver PC over the VPN.

    The scheme should look like this:

    VPS IP ---> VPN server ---> routes traffic to VPN client ---> webserver behind NAT

    I hope you get what I mean.

    Why not just run the website off the vps?

  • @sc754
    That was just an example, mate.

  • So basically what you want to do is set up a VPN with your server, and route the traffic which goes to the server to go to your PC through the VPN?

    I haven't tried it yet, but I think it shouldn't be hard, most likely you will just have to add a few rules to iptables. If I do try it I will post here and keep you updated with the results.

  • @Makenai
    Yes exactly that. I would try some stuff but I still haven't found a VPS for this "project".

  • rskrsk Member, Patron Provider

    Good advice is to find a VPS as close to you as possible. Good luck :-)

  • MakenaiMakenai Member
    edited October 2013

    @Kupol said:
    Makenai
    Yes exactly that. I would try some stuff but I still haven't found a VPS for this "project".

    I got it to work!
    So basically what I did. I connected my laptop to VPN server running on my VPS, selected a port which I wanted to route, in my case it was 8881 (On the laptop), because I already have a WEB server running on port 80 on my VPS.
    I added a new rule

        iptables -t nat -A PREROUTING -p tcp --dport 8881 -j DNAT --to-destination 10.9.0.18:8881
    

    If you want to route more than one port, you can use this command.

        iptables -t nat -A PREROUTING -p tcp --dport 513:65535 -j DNAT --to-destination 10.9.0.18:513-65535
    

    After routing the port it should work as expected, no more configuration needed, but keep in mind, that the OpenVPN local address isn't static by default, so it changes every time you connect to your OpenVPN server, if you want to get a static address look at this guide. http://unix-heaven.org/openvpn-static-addresses.

    P.S Make sure you don't accidentally route your SSH and VPN port, it could make your VPS inaccessible.

  • @Makenai
    Woah, thank you very much mate. You have solved my headache!

    Now I need to find some cheap VPS box for this. Should I go for KVM or OpenVZ with tun/tap enabled will work as well?

Sign In or Register to comment.