Saturday, March 22, 2008

Using Hamachi on Linux

LogMeIn Hamachi is a VPN service that easily sets up in 10 minutes, and enables secure remote access to your business network, anywhere there’s an Internet connection.
It works with your existing firewall, and requires no additional configuration. Hamachi is the first networking application to deliver an unprecedented level of direct peer-to-peer connectivity. It is simple, secure, and cost-effective.

Hamachi is a simple way of making a VPN between different computers. Hamachi can be used to anything from printing to your office printer from home to sharing files heavily encrypted over the internet to your friends.

Installing Hamachi

The first thing you need to do is download Hamachi from https://secure.logmein.com/products/hamachi/list.asp

Extract the archive and run make as root:

# tar zxvf hamachi-0.9.9.9-20-lnx.tar.gz

# cd hamachi-0.9.9.9-20-lnx

# make install

Now you need to start the tuncfg daemon as root

# /sbin/tuncfg

Configuring

To begin using Hamachi you first must run with your own user.

$ hamachi-init

When you have completed the initialization you can start Hamachi by simply typing

$ hamachi start

Since you are starting hamachi for the first time you need to tell the client to go online

$ hamachi login

You may want to change you nickname with

$ hamachi change-nick

Once logged in you can create a network with

$ hamachi create networkname

You can then give the network name and password to your friends and ask them to join you. Once you have friends in your network you can list their IP-addresses with

$ hamachi list

You can then use the listed IP-addresses to connect to your friends just like they would be on your LAN.

For more commands and options check the Hamachi Readme.

Automatically starting Hamachi

To get Hamachi to automatically start when you start your computer you need to create a startup script for it.

############################################
### This is a startup script for hamachi ###
############################################

#!/bin/bash

USER=testuser
case "$1" in
start)
/sbin/tuncfg
/bin/su - $USER -c "hamachi start"
;;
stop)
/bin/su - $USER -c "hamachi stop"
;;
restart|force-reload)
/bin/su - $USER -c "hamachi start"
/bin/su - $USER -c "hamachi stop"
;;
*)
exit 1
;;
esac

exit 0

################ End of Hamachi Startup Script ##################

Change the USER variable to your username in the script. Then make the script executable and move it to /etc/init.d/

# chmod +x hamachi

# mv hamachi /etc/init.d

You then need to link the script to the appropriate runlevel

# ln -s /etc/init.d/hamachi /etc/rc3.d/S99hamachi

# ln -s /etc/init.d/hamachi /etc/rc3.d/K99hamachi

Where 3 is the runlevel for which you want Hamachi to start.

1 comment:

Anonymous said...

ok so hamachi is up and running ok on redhat now how do I access that IP address from the internet?

Thanks

Chris