Difference between revisions of "Hamachi"

From MineOS Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
'''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.
 
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.
  
Line 80: Line 82:
  
 
By default, Hamachi traffic is dropped by the firewall.  Be sure to adjust [[iptables]] accordingly to permit Hamachi traffic!
 
By default, Hamachi traffic is dropped by the firewall.  Be sure to adjust [[iptables]] accordingly to permit Hamachi traffic!
 
=== Accommodating older clients ===
 
Some users using Hamachi 2 may run into connection issues with their clients dropping sporadically. This is due to a high default KeepAlive value.  To ensure these clients stay connected, you can create a <tt>config</tt> file with a lower value (default:90).
 
 
{{executeasroot
 
| commands = cd /root/.hamachi
 
echo "KeepAlive 15" > /root/.hamachi/config
 
chmod 644 config}}
 
  
 
== Starting Hamachi as a service ==
 
== Starting Hamachi as a service ==
Line 107: Line 101:
 
;;
 
;;
 
stop)
 
stop)
         /usr/bin/hamachi stop
+
         killall tuncfg
        sleep 1
+
         killall hamachi
         kill $(pidof hamachi)
 
kill $(pidof tuncfg)
 
 
;;
 
;;
 
restart)
 
restart)

Latest revision as of 15:36, 12 June 2013

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#0.9.9.9-20-lnx-2.pkg.tar.gz' failed.

-- Packages where install failed
hamachi

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

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

Starting Hamachi

<syntaxhighlight> Starting Hamachi hamachi-lnx-0.9.9.9-20 .. ok </syntaxhighlight>

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.

<syntaxhighlight>

  1. !/bin/sh
  2. /etc/rc.d/hamachid: start/stop hamachi daemon

case $1 in start) /usr/sbin/tuncfg

       /usr/bin/hamachi start
       /usr/bin/hamachi login
       /usr/bin/hamachi go-online YourNetworkNameHere

;; stop)

       killall tuncfg
       killall hamachi

;; restart) $0 stop sleep 2 $0 start ;;

  • )

echo "usage: $0 [start|stop|restart]" ;; esac

  1. End of file

</syntaxhighlight>