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., 5.190.65.30) 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-0.9.9.9-15-lnx/ hamachi-0.9.9.9-15-lnx.tar.gz

[root@mybox vpn]# cd hamachi-0.9.9.9-15-lnx/

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

[root@mybox hamachi-0.9.9.9-15-lnx]# 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-0.9.9.9-15-lnx]# ham
hamachi hamachi-init

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

generating 2048-bit RSA keypair .. ok
making /root/.hamachi directory .. ok
saving /root/.hamachi/client.pub .. 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-0.9.9.9-15-lnx]# cd tuncfg/

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

[root@mybox tuncfg]# ./tuncfg

[root@mybox tuncfg]# cd ..

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

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

For more hamachi join options type :

[root@mybox hamachi-0.9.9.9-15-lnx]# hamachi join

This will list all options available.

Now Creating a Network :

[root@mybox hamachi-0.9.9.9-15-lnx]# hamachi create sriramsreedhar
password

Creating sriramsreedhar .. ok

[root@mybox hamachi-0.9.9.9-15-lnx]# hamachi list
[sriramsreedhar]

[root@mybox vpn]# ifconfig

ham0 Link encap:Ethernet HWaddr 8A:ED:3B:AA:9D:C8
inet addr:5.24.164.156 Bcast:5.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1200 Metric:1
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