Jump to content
  • Advertisement
Sign in to follow this  
smerf

How do VPNs work?

This topic is 4415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Suppose I wanted to code a software VPN. How does a software VPN client work with a VPN server to make the client PC seem like it is on the VPN server's network? Does using multiple application (each requiring a different port) require multiple connections from client to server? Woudl it be that difficult to write a dumb VPN solution if I have an available UDP connection that the 2 networks leave open to pass data thru now? Could the existing UDP hole in the firewall be used for such an app? And, would such an app let my users play more than 1 game simultaneously between the networked PCs and the client PC? I'm starting work on this from scrathc - hence the very basic questions. Thanks for any help you can provide!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by smerf
Suppose I wanted to code a software VPN. How does a software VPN client work with a VPN server to make the client PC seem like it is on the VPN server's network?


It uses the operating system's facilities to create a "fake" network interface. The application receives all packets the OS routes via this VPN interface, encrypts them and encapsulates them as necessary, then sends them out via the real network interface to the other end, which does exactly the same.

Quote:

Does using multiple application (each requiring a different port) require multiple connections from client to server?


Usually, yes.

Quote:

Woudl it be that difficult to write a dumb VPN solution if I have an available UDP connection that the 2 networks leave open to pass data thru now?


It is very difficult to create a VPN solution:

- Interfacing with the OS to capture / inject packets into the stack is nontrivial (Under Linux at least - under Windows it's even harder probably)
- Creating a secure encryption system is difficult to do correctly (key exchange protocols etc)

Quote:

Could the existing UDP hole in the firewall be used for such an app?


Yes. VPNs use a variety of different underlying protocols - some use UDP, some TCP, some others use other IP-layer protocols (neither UDP nor TCP).

Quote:

And, would such an app let my users play more than 1 game simultaneously between the networked PCs and the client PC?


I have no idea what relevance this has on anything.

Regardless of whether you use a VPN or a real network, every should be able to play against anyone they want if your protocol is correctly designed.

Mark

Share this post


Link to post
Share on other sites
Quote:
Does using multiple application (each requiring a different port) require multiple connections from client to server?


The answer is clearly no. This is because of how VPNs work:

A VPN inserts itself in the client OS as a network card driver, not necessarily much different from a driver for a USB Ethernet interface, for example.

The VPN then, instead of generating Ethernet link frames, wraps the payload in some kind of higher-layer messaging, and sends it back through the high-level networking stack, aimed at the remote server.

As long as the client interface code, and the VPN server on the other end, agree on the protocol, you could use UDP, TCP, or carrier pigeon; it doesn't matter.

In a nutshell, that's "all" there is to it. However, actually making it work right is trickier than it might seem, because the VPN device needs to become the default interface for all new applications, while it still needs to be able to use the existing interfaces for underlying transport.

There exist open source VPN solutions that tunnel through UDP already; you're probably better off getting something like that than trying to write your own. Unless you have six months of full-time work, and thousands of dollars to buy documentation and attend driver development seminars :-)
(I recommend www.osr.com for that, btw)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!