Building a VPN....

Started by
3 comments, last by Bregma 17 years, 5 months ago
(I posted this elsewhere already - Web Development - but I may have posted to the wrong forum the first time.) 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!
Advertisement
Oh come on!

You guys are brilliant! This is simple for you!
Let me just first say, yes it is difficult.

There are a dozen different situations, and a dozen differnt ways of doing it - but let me just go with a simple approach here. I am assuming you want to create a simple VPN, one Windows PC to a server.


Generally, there would first be a driver written which pretends to be a network interface on the host computer (ie - behaves exactly the same as a network driver) but instead of sending the actual I/O to the physical network card, it would package it all up in some kind of buffer somewhere (file/shared memory/...). Then there would be a separate service which frequently picks up the data from this buffer, packages it up and sends it to the server, which unpackages it, and forwards it on.

Note that this is a dirty solution, and real VPNs are much, much more complicated than this. But this is a simple view of it.

Yes, you could make it to send the VPN data through the UDP hole in the firewall. But then UDP has a whole host of problems like - for example there is no way for you to know if a packet reached the target or not, so you would most likely have to implement your own sliding window type thing to ensure delivery. Otherwise massive chunks of data could be lost and you'd never know.

In conclusion - why do you want to write VPN software? There are plenty of good and open solutions available now (OpenVPN/ssh port forwarding etc. etc. etc.) that can do what you ask. If you really want to know how to make one - go read the source code for OpenVPN. Based on your question you would have an awful lot to learn (OSI/packet format/...).
Actually I wanted to code a simple VPN in VB.Net 2005.

It's purpose is to remain free and not sell out like Hamachi did.

I probably need to learn C++, but I'd rather hire people to write it than to do that. It'd take so much time to learn to write device dirvers and such that somebody else would probably get it done before me.

I also want to make neat technologies available to more people via simple to use controls. To bring the RAD of VB together with the really cool stuff that could make so many applications that much more interactive and just plain cool.

For instance, I'd like a VNC server CONTROL that you could use to extend and make your own remote control server. I'd like a VNC activeX CONTROL to go with it.

In fact, I have written permission from the guys that wrote the mirror driver for TightVNC to use thier mirror drivers for such a client/server solution, but I don't even know enough C++ to put the damned thing to use. Do you?

I want to create a server and client control to make NAT transversal easy for anybody. I think I can pull this one off myself entirely in managed code - but that means a bloated .Net framework, which I really HATE.

I've even sunk as low as to go on RentACoder and try and hire someone. But, the really good programmers are few and far between on there. Most of them are too busy for new projects.

I'm not a rich man by any means, but I'd pay someone to develop some of these ideas.....if I could find someone that knew kung-fu from kung-pow and was interested.

Oh well....

I was project lead for a project that implemented VPNs. On the Windows side it was as easy as reimplementing the entire winsock2 library. You don't need to know any C++, only C. It took my two Windows gurus only about 18 months of full-time work to get something that worked reliably with most popular applications. Even then, there were a number of Microsoft applications that used undocumented APIs and managed to bypass the official network stacks.

Good luck doing it in VB on your own.

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement