Monday, March 06, 2006

VPN Made Easy

Building a Virtual Private Network made easy:

My Scenario :

- My Office PC running Windows 2k is connected to internet 24x7
with out a Static IP

- I connect my Laptop running Linux to internet with out any Static IP provided by
my ISP Sify.

I need to access my Office PC from home as in Local Area Network.

The easiest solution I found for this is using Hamachi

How does Hamchi Work ?
You need to download hamachi Installer for u r respective OS.

Once done you can create a network with installer in Hamachi's Server.

While creating network it will prompt you for Password.

This password needs to be shared with other users connecting to
your network.

Note :

" Hamachi assigns a unique static IP address in the 5.x.x.x range
(e.g., that allows the Hamachi mediation server to
locate your machine and allow it to establish secure peer-to-peer
connections with other PCs. In Windows XP, the software creates
a virtual network interface driver to direct traffic to and from the
5.x.x.x address. Note the Hamachi-assigned IPs are hidden behind
the NAT from public view while allowing configuration-free NAT and
firewall traversal. Creating a network is as simple as designating a
name and password. "

Heres what I did to Create a Network in Linux :

[root@mybox sriram]# cd /usr/local/src/vpn/

[root@mybox vpn]# ls
hamachi- hamachi-

[root@mybox vpn]# cd hamachi-

[root@mybox hamachi-]# ls
CHANGES LICENSE LICENSE.openssl Makefile tuncfg/
hamachi* LICENSE.openssh LICENSE.tuncfg README

[root@mybox hamachi-]# make install

Copying hamachi into /usr/bin ..
Creating hamachi-init symlink ..
Compiling tuncfg ..
Copying tuncfg into /sbin ..

Hamachi is installed. See README for what to do next.

[root@mybox hamachi-]# ham
hamachi hamachi-init

[root@mybox hamachi-]# hamachi-init
Initializing Hamachi configuration (/root/.hamachi). Please wait ..

generating 2048-bit RSA keypair .. ok
making /root/.hamachi directory .. ok
saving /root/.hamachi/ .. ok
saving /root/.hamachi/client.pri .. ok
saving /root/.hamachi/state .. ok

Authentication information has been created. Hamachi can now
be started with 'hamachi start' command and then brought online
with 'hamachi login'.

Before Starting Hamachi you need to run tuncfg

root@mybox hamachi-]# cd tuncfg/

[root@mybox tuncfg]# ls
Makefile tuncfg* tuncfg.c

[root@mybox tuncfg]# ./tuncfg

[root@mybox tuncfg]# cd ..

[root@mybox hamachi-]# hamachi start
Starting Hamachi hamachi-lnx- .. ok

[root@mybox hamachi-]# hamachi login
Logging in ....>....... ok

For more hamachi join options type :

[root@mybox hamachi-]# hamachi join

This will list all options available.

Now Creating a Network :

[root@mybox hamachi-]# hamachi create sriramsreedhar

Creating sriramsreedhar .. ok

[root@mybox hamachi-]# hamachi list

[root@mybox vpn]# ifconfig

ham0 Link encap:Ethernet HWaddr 8A:ED:3B:AA:9D:C8
inet addr: Bcast: Mask:
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:8844 (8.6 KiB)

Now Install Hamachi in your windows System at office and join the
network sriramsreedhar

In Windows XP, the software creates a virtual network interface driver
to direct traffic to and from the 5.x.x.x address

That all you need to do to build a Virtual-Private-LAN