Hamachi on Mac OS X

Over the weekend, I had the need to create a VPN (Virtual Private Network) between a few MUG members and myself to use iChat through a proxy. I should mention that this did not help our paticular situation, as the proxy/firewall we were attempting to bypass was pickier than we first thought. However, I did learn how to use a great VPN tool, Hamachi, and I thought I would detail the steps needed to get it running under Mac OS X. Hamachi has been discussed at length in various episodes of the Security Now! podcast, which I highly recommend (In particular, episode #18 covers most of Hamachi).

The idea behind Hamachi is to create a secure virtual network between computers over the internet, and get them communicating as if they were all on the same local network together. Having all the computers on the same virtual LAN has numerous advantages, including connecting business networks, playing LAN games, and sharing files. Connections are made secure with the use of various encryption and handshake technologies which prevent prying eyes from seeing the information sent back and forth.

Hamachi for Windows is more advanced than the Mac version as far as point-and-click interfaces go, but the Mac version is quite stable and works just as well. To get started using Hamachi, first download and decompress the latest release. You’ll also need to grab the latest Tun/Tap driver here.

First, install the Tap package from the Tun/Tap file you downloaded earlier. Then, open the Terminal in your Applications → Utilities folder, and type cd Desktop to change directory to your Desktop folder inside your Home folder. Do cd [hamachi], where [hamachi] is the folder that was made when you decompressed the downloaded file. In my case, the folder was titled hamachi-0.9.9.9-20-osx, so I did cd hamachi-0.9.9.9-20-osx. Your Terminal window is now navigated inside of the Hamachi folder, and you’re ready to start installing.

Installing Hamachi is quite easy — almost as easy as installing most Mac OS X applications. Type sudo ./install, followed by your administrator password. The admin password is required because Hamachi installs system-level components to make everything work. After the quick install is done, type sudo tuncfg. Tuncfg (tunnel configuration) sets up the VPN tunnel for Hamachi. From this point onward (until you reboot), your administrator password is not required, as Hamchi does all root level functionality in one fell swoop. Type hamachi-init to generate the cryptographic keys that will be used to protect your data as it speeds throughout the internet. Typing hamachi start will load Hamachi and prepare it for use.

As this point, you would also want to get Hamachi running on any other computers you would like on your virtual network, PC or Mac. PC users need only to download and run Hamachi, and they can all connect to the same network. Once that’s done, you’ll need a network for everybody to connect to. Again in the Terminal window, do hamachi create [network] where [network] is the 4 to 64 character name of the network you’d like to create. If the name is already in use, you can simply try again. When prompted for a password, do not enter your administrator password. What you’re being prompted for is the password to log onto your virtual network. Choose a word or phrase not in the dictionary, preferably longer than 8 characters. For security, the longer the password, the better. After your network is created, you can then instruct all your other computers to join the network using the password you chose.

After all the computers are connected in Hamachi, that’s it! You can view members of the network by doing hamachi list, and connect to their IPs (starting with “5.”) as if they were all on your own local network. One popular use for Hamachi is to share music on iTunes with your home computer (under Preferences → Sharing), and then install Hamachi at work. When both computers are connected, iTunes will be fooled into thinking your home computer is on your work computer’s network, so it will allow you to stream music to your workplace via the internet.

I should note that when your computer is restarted, you’ll have to do sudo tuncfg and hamachi start to re-run Hamachi. Also, the Hamachi OS X ReadMe has a listing of commands to delete networks, evict members, and other useful features that are worth a look.

Now that you’ve come this far “the hard way” by typing in commands and learning how to set up Hamachi on your own at the command line level, you should know about two graphical ways to use Hamachi. After using Hamachi for a few minutes, I thought it would be cool to run a Dashboard widget to control it. A single Google search turned up exactly what I had imagined. A third-party Mac OS X program, HamachiX, is also another great front end to Hamachi on the Mac. Both solutions work quite well, and may save you some time in setting up a quick VPN between your computer and others, anywhere else in the world.

20 Responses to “Hamachi on Mac OS X”

  1. Awesome thanks for the writeup. I had heard rumblings of this program since some of my friends use it to share iTunes collections, and recently since apparently Hamachi was bought by Logmein, another program I use. Really good to read a writeup about it from someone who knows what they’re talking about. rock on

  2. I’ve been using Hamachi also for several months, like you as a result of the Security Now podcast. I’ve found Hamachi to be an excellent solution for remote filesharing with my Windows box (ugh) at work and my Ubuntu and Windows boxes at home from my PowerBook.

    I’ve found the Dashboard widget to be unresponsive and prone to timeouts when I move from location to location.

    I have not tried HamachiX, but I read some thigns about it that make me think it’s not yet ready for primetime. Maybe Logmein will do something about that.

  3. My wife handed over an iMac G5 since getting her new laptop. I’m having great fun getting to know the iMac and OS X. One thing I’m trying to figure out though, is HOW to get ’sudo tuncfg’ & ‘hamachi start’ to auto-start. tuncfg needs a password, so I assume there will be a need for an ‘

  4. thanks for explaining hamachi so well. It was pretty easy to load it reading your comments.
    I’d like to connect my g/5 to window’s pc’s at office. I had tried using timbuk tu as my front-end, but it shows the computers for 1 second and then closes the window be it on ‘observe’/'control’ mode (maybe its some bandwidth problem). I have even tried putting the machines to gray-scale but no luck!

    Any ideas what do i use—pref free :)
    tim

  5. With both machines on the same Hamachi network, you should be able to run Microsoft’s Remote Desktop for Mac and connect to the remote Windows machine’s Hamachi IP (5.x.x.x). While RDC isn’t a secure protocol, you’ll be going through an encrypted tunnel, so your traffic is safe from would-be attackers. Lastly, RDC offers a number of bandwidth-saving options in its Performance tab. It’s quite probably the best Mac app Microsoft produces.

    As for auto-starting ’sudo tuncfg’ and ‘hamachi start’…I’m working on a solution I hope to post in the next couple days.

  6. When I try to login at work, I get the message “logging_in…failed.” Is this a firewall issue?

  7. Does the tun/tap driver work on Intel OSX?

    I tried it on a Mini Mac / 10.4.8 and it does not give the correct output in ifconfig.

  8. Hi,
    I use Mac OS X 10.3.9.
    I’m Newbe to the OS X console but to install hamachi worked fine, I can list my other PCs, but how can I acess the data there?
    Thanks for helping!

  9. How come whenever i get to create network it just freezes?can u at least tell me what program to install hamachi into?

  10. Yeah, i try to create a network and the button wont work. Also, how do i put my IP? It says Div X

  11. “saving /Users/BasilBook/.hamachi/client.pub .. failed”

    The only thing I did different was to install the tun driver from the Tun/Tap package. Help please?

  12. This made it so easy to set it up, from using the root commands to install to actually using hamachi thank you so much!

  13. I just cant get it to install, or get the turn/tap to install driving me crazy can any one help i am not familiar with applespacks and i just wanna ply fm08 with my friend online, is there any alternative to hamachi?

  14. I just cant get it to install, or get the turn/tap to install driving me crazy can any one help i am not familiar with macs and i just wanna ply fm08 with my friend online, is there any alternative to hamachi?

  15. when I run the command
    hamachi login [enter]
    i get “logging in….>…. failed”
    I do not know what to do after this ? Does anyone have an idea as to what I can do ?

  16. Same as Prakash above me :(, also all of a sudden i got 24 14:58:27.575 [ 0] [ 1180] tap: connect() failed 2 (No such file or directory)

  17. hi i tried to use this program to play warcraft “Dota” in Lan. however when i created the game, my friends could’t see it does anyone have an idea as to what i can do? thanks

  18. hello, I am new to mac os x leopard and i installed hamachi as well as the Tun/Tap driver, followed the instruction above but when I start hamachi it gives me this message,”tap: config.recv() failed 0 22
    05 23:41:53.357 [ 0] [ 260] Failed to configure tap device to use 5.209.199.178/4278190080″. what will i do? Thanks

  19. Hey has anyone or Collin figured out how to do the auto starting or auto ’sudo tuncfg’ and ‘hamachi start’ yet??
    I have attempted but can’t seem to get it working, i am just learning the Mac.
    Cheers

  20. very good explanation, its runing now

Leave a Reply