Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How can I create a Virtual Network Interface?
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DemonWasp




PostPosted: Fri Aug 21, 2009 3:47 pm   Post subject: How can I create a Virtual Network Interface?

I've tried Google, but I've been unable to find anything that describes how to do what I'm after - perhaps unsurprising, as it's kind of an uncommon task.

What I want to do is have a program that can create a virtual network interface (a subinterface of a physical one), which I can then manipulate programmatically, to form a Virtual Private Network (VPN). There are existing programs to do this, like Hamachi. The problem I have with these programs is that they all either require payment (I may not be poor, but I am cheap) and they all also suck very badly. I'm hoping I can make something better, because I frequently need to use these programs, and the number of issues with the popular ones is...somewhere between astounding and depressing.

I am very inexperienced with making calls to the OS API, particularly in knowing what I can and can't do. Among the things I currently can't do is find any worthwhile documentation. If anyone knows how I can manipulate the set of network interfaces to accomplish what I suggest above, please let me know or point me towards useful documentation.

I'd be happy to have pointers for any operating system, but in specific I'm interested in doing this on Windows (XP, Vista, 7).

Thanks in advance!
Sponsor
Sponsor
Sponsor
sponsor
btiffin




PostPosted: Sat Aug 22, 2009 2:33 am   Post subject: Re: How can I create a Virtual Network Interface?

This may or not help you start;
On Debian GNU/Linux, look into ifconfig, route, and iptables.

code:

$ ifconfig eth0:1 192.168.2.128 netmask 255.255.255.0

On Debian, make this permanent by adding to /etc/network/interfaces
code:

auto eth0:1
iface eth0:1 inet static
        address 192.168.2.128
        netmask 255.255.255.0

and then
code:

$ route add -net 192.168.2.0 netmask 255.255.255.0


The iptables entries for getting some proper routing between your WAN IP to the new eth0:1 interface will be left as an exercise for the reader.

Cheers
DemonWasp




PostPosted: Sat Aug 22, 2009 8:26 pm   Post subject: RE:How can I create a Virtual Network Interface?

Thanks, that's certainly a start. Seems nobody around here knows how to do this sort of thing on Windows...I wonder if it's one of those "you'll need to pay for a book that contains that information" things; it certainly wouldn't be unlike Microsoft.
rdrake




PostPosted: Sat Aug 22, 2009 11:15 pm   Post subject: RE:How can I create a Virtual Network Interface?

You probably want a TUN/TAP driver. It lets you implement a network interface entirely in software.

Check out vtun.
DemonWasp




PostPosted: Sat Aug 22, 2009 11:34 pm   Post subject: RE:How can I create a Virtual Network Interface?

Thanks for the link. Judging by the intensity of the acronyms on its FAQ page, I've got a lot of reading to do...and probably a lot of searching, since it specifically says it has no Windows client (my primary target platform). Thanks for pointing me in the right direction though.
rdrake




PostPosted: Sun Aug 23, 2009 5:08 pm   Post subject: RE:How can I create a Virtual Network Interface?

Well, OpenVPN has a TUN/TAP driver and it runs on Windows. It's under GPL.

It's actually called just tuntap, and this site includes instructions on working with it under Windows.

Edit: Fixed markup.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: