Linux

Suggest an article
Have a good idea for an article? Something you want to know? Suggest an idea for an article and we just might write one for you.
Contact

Using Hamachi in Linux

After hearing Steve Gibson praising Hamachi on Security Now I decided to give it a try.

What is Hamachi you ask? According to their site Hamachi is:

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.

In essence Hamachi is a simple way of making a VPN between different computers. If you’ve ever tried creating a VPN using “traditional methods” you know what a pain it can be. Hamachi makes the process very simple. On windows you download a client which looks like a messaging client and create a network, adding the computers you wish to have access to your network.

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.

Unfortunately the linux Hamachi client is a bit lagging behind its windows counterpart. In this guide I’ll show how to set up Hamachi on Linux and make it start when you log in.

Installing Hamachi

The first thing you need to do is download Hamachi from its homepage

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 sudo make install

Now you need to start the tuncfg daemon as root

sudo /sbin/tuncfg

Configuring

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

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.

Download 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 sudo mv hamachi /etc/init.d

You then need to link the script to the appropriate runlevel

ln -s /etc/init.d/hamachi /etc/rc2.d/S99hamachi ln -s /etc/init.d/hamachi /etc/rc2.d/K99hamachi

Where 2 is the runlevel for which you want Hamachi to start. 2 is the default runlevel in Debian and Ubuntu, in most other distros this is 5.

Posted by Marcus Hellberg - Jul 23, 11:20 AM.
Posted in .

3 Comment(s) for Using Hamachi in Linux

  1. Thanks for the install instructions. It works great on Centos 5.1 (PBXiaF setup).

    James Torres · Jan 3, 03:06 PM

  2. Nice instructions, thanks.
    But is there a way of changing the password once the network is setup and has users?
    I know that network name is unique and to change it you need to delete network and then create new one, but how is with a password?

    Easy web development · Feb 25, 10:24 AM

  3. I have a little problem with hamachi.
    Everything is OK until it passes a little time.
    Then connection between hosts brakes and I need to reconnect hamachi on both linux machines. I need something like keepalive option I suppose.

    Representer · Aug 26, 02:01 PM

Add your comment to this article

(Will not be displayed)
Textile Help