From MineOS
Jump to: navigation, search

Note, this tutorial is no longer valid, as the Hamachi version here has been end-of-lifed and the newest version of Hamachi will not run on MineOS CRUX

Hamachi is often used to circumvent various limitations in router configuration and other network restrictions, such as being behind an organization's firewall. Hamachi is not recommended over typical processes of using port-forwarding, but in some circumstances may be required.

Following is a reformatted guide based on the Google Groups thread on Is there any way to get hamachi working on MineOS CRUX with special thanks to Martin Ramshøj for kindly re-documenting his adventure in an easily re-formattable way.


Upgrade your kernel

As of this writing, the most recent stable kernel is 3.3.3, which you can get from kernel.org. While you may download more recent versions of the kernel, it is advised to only download a stable kernel--rather than the mainline kernel--to avoid complications.

You can follow more detailed instructions on this step on the wiki page Upgrading the Kernel.

The relevant part to add is listed under FireWire support:

CONFIG_TUN: Universal TUN/TAP device driver support
# IEEE 1394 (FireWire) support
# CONFIG_TUN is not set

Download the Hamachi sources

Next, using the Ports system, download the Hamachi source code. This task must be done as root.

build issues

Depending on the recentness of the port's maintenance, a build issue might arise reporting footprint mismatch.

=======> Build result:
drwxr-xr-x  0 root   root        0 Apr 21 14:41 usr/
drwxr-xr-x  0 root   root        0 Apr 21 14:41 usr/bin/
drwxr-xr-x  0 root   root        0 Apr 21 14:41 usr/sbin/
-rwxr-xr-x  0 root   root     8060 Apr 21 14:41 usr/sbin/tuncfg
-rwxr-xr-x  0 root   root   331144 Apr 21 14:41 usr/bin/hamachi
lrwxrwxrwx  0 root   root        0 Apr 21 14:41 usr/bin/hamachi-init -> /usr/bin/hamachi
=======> ERROR: Footprint mismatch found:
MISSING   drwxr-xr-x      root/root       sbin/
MISSING   -rwxr-xr-x      root/root       sbin/tuncfg
NEW       drwxr-xr-x      root/root       usr/sbin/
NEW       -rwxr-xr-x      root/root       usr/sbin/tuncfg
=======> ERROR: Building '/usr/ports/lennart/hamachi/hamachi#' failed.

-- Packages where install failed

If this should occur, you can safely ignore this issue with the build argument pkgmk -d -i -if for ignore footprint. This should allow it to properly build and install.

Initializing Hamachi

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'.

Starting Hamachi

Starting Hamachi hamachi-lnx- .. ok

Connectivity and iptables

By default, Hamachi traffic is dropped by the firewall. Be sure to adjust iptables accordingly to permit Hamachi traffic!

Starting Hamachi as a service

Starting Hamachi as a service has the advantage of being auto-started and auto-shutdown in accordance with other system services, such as hiawatha webserver, dhcp client, etc. The following file is an example 'service' script which would be +x chmodded and saved as /etc/rc.d/hamachid. It can then be invoked with commands like /etc/rc.d/hamachid start and /etc/rc.d/hamachid stop. Even better, these commands can be executed for you by adding hamachid to your /etc/rc.conf file.

# /etc/rc.d/hamachid: start/stop hamachi daemon
case $1 in
        /usr/bin/hamachi start
        /usr/bin/hamachi login
        /usr/bin/hamachi go-online YourNetworkNameHere
        killall tuncfg
        killall hamachi
	$0 stop
	sleep 2
	$0 start
	echo "usage: $0 [start|stop|restart]"
# End of file