Difference between revisions of "HamachiVPN"

From WebOS Internals
Jump to navigation Jump to search
 
(11 intermediate revisions by 6 users not shown)
Line 5: Line 5:
 
Become root:
 
Become root:
  
<pre><nowiki>
+
<source lang="text">
 
sudo su
 
sudo su
</pre></nowiki>
+
</source>
  
 
Make the filesystem writable:
 
Make the filesystem writable:
  
<pre><nowiki>
+
<source lang="text">
 
mount -o remount,rw /
 
mount -o remount,rw /
</pre></nowiki>
+
</source>
  
Download the hamachi binary to your pre via wget:
+
Download the hamachi binary to your pre via wget:  
<pre><nowiki>
+
 
 +
: '''Note:'''  It is recommended that you use the nokia build, because it included the install script. Whereas the direct hamachi link would require that make be installed.
 +
 
 +
<source lang="text">
 
cd /opt/share
 
cd /opt/share
wget http:''files.hamachi.cc/linux/nokia-770/hamachi-0.9.9.9-20-lnx-n770.tar.gz
+
wget http://files.hamachi.cc/linux/nokia-770/hamachi-0.9.9.9-20-lnx-n770.tar.gz
</pre></nowiki>
+
</source>
  
 
Unpack the archive:
 
Unpack the archive:
<pre><nowiki>
+
<source lang="text">
 
tar zxvf hamachi-0.9.9.9-20-lnx-n770.tar.gz
 
tar zxvf hamachi-0.9.9.9-20-lnx-n770.tar.gz
 
cd hamachi-n770-0.9.9.9-20
 
cd hamachi-n770-0.9.9.9-20
</pre></nowiki>
+
</source>
  
 
Hamachi depends on libcrypto.so.0.9.7.  The Palm Pre has libcrypto.so.0.9.8 installed.  I made a symlink, and it worked.  So...
 
Hamachi depends on libcrypto.so.0.9.7.  The Palm Pre has libcrypto.so.0.9.8 installed.  I made a symlink, and it worked.  So...
<pre><nowiki>
+
<source lang="text">
 
ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.0.9.7
 
ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.0.9.7
</pre></nowiki>
+
</source>
  
 
Edit the "install" script using your favorite editor (like vi) to change the installation locations.
 
Edit the "install" script using your favorite editor (like vi) to change the installation locations.
Line 37: Line 40:
 
I changed it to:
 
I changed it to:
  
<pre><nowiki>
+
<source lang="text">
 
HAMACHI_DST=/opt/bin
 
HAMACHI_DST=/opt/bin
 
TUNCFG_DST=/opt/sbin
 
TUNCFG_DST=/opt/sbin
Line 43: Line 46:
 
echo
 
echo
 
echo Copying hamachi into $HAMACHI_DST ..
 
echo Copying hamachi into $HAMACHI_DST ..
</pre></nowiki>
+
</source>
  
 
Then follow the instructions in the README under Quick Start, but basically:
 
Then follow the instructions in the README under Quick Start, but basically:
  
<pre><nowiki>
+
<source lang="text">
 
./install
 
./install
 
/opt/sbin/tuncfg
 
/opt/sbin/tuncfg
Line 56: Line 59:
 
hamachi join <network>
 
hamachi join <network>
 
hamachi go-online
 
hamachi go-online
</pre></nowiki>
+
</source>
  
 
== Hint ==
 
== Hint ==
 +
Adding your Pre to your Windows hamachiVPN.
 +
 +
<source lang="text">
 +
 +
If you want to join a group made on the hamachi.cc (the official logmein page) webpage you need the group ID (joining by group name fails).
 +
On the logmein website click on My Computers and on the left side click on the Network tab.
 +
You can create a new network here under "add network"
 +
To get an ID for an existing network click on "edit" on the right side of the group name.
 +
This will bring up the edit page under the ID is the 9 digit group ID (XXX-XXX-XXX) with dashes these are also part of the group ID.
 +
To join this network on your pre type "hamachi join (9 digit ID don't forget the dashes) (password)".
 +
 +
</source>
  
 
If you use Hamachi to connect to web services running on your machines at home or elsewhere, you might make your life easier by adding some entries to the /etc/hosts file.  Then you can access your servers by name instead of having to use the Hamachi 5.x.x.x IP addresses.
 
If you use Hamachi to connect to web services running on your machines at home or elsewhere, you might make your life easier by adding some entries to the /etc/hosts file.  Then you can access your servers by name instead of having to use the Hamachi 5.x.x.x IP addresses.
Line 64: Line 79:
 
A simple sample entry in /etc/hosts which would allow you to access your server "beaker" at 5.1.2.3 would be:
 
A simple sample entry in /etc/hosts which would allow you to access your server "beaker" at 5.1.2.3 would be:
 
(Add your servers below the "castle" line.)
 
(Add your servers below the "castle" line.)
<pre><nowiki>
+
<source lang="text">
 
127.0.0.1      localhost.localdomain          localhost
 
127.0.0.1      localhost.localdomain          localhost
 
127.0.0.1 castle
 
127.0.0.1 castle
 
5.1.2.3 beaker
 
5.1.2.3 beaker
</pre></nowiki>
+
</source>
  
 
When done, make the filesystem read-only again:
 
When done, make the filesystem read-only again:
<pre><nowiki>
+
<source lang="text">
 
mount -o remount,ro /
 
mount -o remount,ro /
</pre></nowiki>
+
</source>
  
 
== Ping Test ==
 
== Ping Test ==
  
 
When you've got hamachi up, you can try pinging one of your servers.  
 
When you've got hamachi up, you can try pinging one of your servers.  
<pre><nowiki>
+
<source lang="text">
 
root@castle:/var/home/root# ping beaker
 
root@castle:/var/home/root# ping beaker
 
PING beaker (5.1.2.3): 56 data bytes
 
PING beaker (5.1.2.3): 56 data bytes
Line 85: Line 100:
 
64 bytes from 5.1.2.3: seq=2 ttl=128 time=56.976 ms
 
64 bytes from 5.1.2.3: seq=2 ttl=128 time=56.976 ms
 
64 bytes from 5.1.2.3: seq=3 ttl=128 time=74.249 ms
 
64 bytes from 5.1.2.3: seq=3 ttl=128 time=74.249 ms
</pre></nowiki>
+
</source>
  
 
== Sleep/Wake and Battery Impact ==
 
== Sleep/Wake and Battery Impact ==
Line 93: Line 108:
  
 
This morning, while at my workstation, and with the Pre idle in my pocket, I noticed my Pre was available/pingable on Hamachi.  I am not totally sure of what the long-term battery impact might be of running Hamachi on the Pre.  I'm not yet sure if it keeps the device "awake" all the time, which clearly would drain the battery.  I have push GMail IMAP going, so I assume there is some kind of connection either being periodically established or constantly maintained.  But I don't know enough about the networking aspects to determine at this time whether running Hamachi all the time will negatively impact the battery.  Feel free to message me if you learn anything.
 
This morning, while at my workstation, and with the Pre idle in my pocket, I noticed my Pre was available/pingable on Hamachi.  I am not totally sure of what the long-term battery impact might be of running Hamachi on the Pre.  I'm not yet sure if it keeps the device "awake" all the time, which clearly would drain the battery.  I have push GMail IMAP going, so I assume there is some kind of connection either being periodically established or constantly maintained.  But I don't know enough about the networking aspects to determine at this time whether running Hamachi all the time will negatively impact the battery.  Feel free to message me if you learn anything.
 +
 +
Further Testing:
 +
* With Hamachi running I would achieve 12 hours of battery life on my pre
 +
* Without Hamachi running after 12 hours I am sitting at 60% battery life
 +
 +
So to conclude running Hamachi all the time significantly decreases battery life in my situation. I personally would not recommend running Hamachi all the the time.
  
 
== Upstart script ==
 
== Upstart script ==
Line 99: Line 120:
 
Place the following script in /etc/event.d/hamachi
 
Place the following script in /etc/event.d/hamachi
  
<pre><nowiki>
+
<source lang="text">
 
description "Hamachi VPN for WebOS"
 
description "Hamachi VPN for WebOS"
 
version 1.0
 
version 1.0
Line 117: Line 138:
 
   /opt/sbin/tuncfg
 
   /opt/sbin/tuncfg
 
end script
 
end script
</pre></nowiki>
+
</source>

Latest revision as of 16:55, 10 February 2011

Hamachi VPN for Palm Pre

This document assumes you're familiar with the Hamachi VPN, specifically the linux version. It is geared towards a person wanting to "get it working" on the Pre. If you're not familiar, there are endless Googlable web pages that describe running Hamachi on desktop linux systems you can use for reference.

Become root:

<source lang="text"> sudo su </source>

Make the filesystem writable:

<source lang="text"> mount -o remount,rw / </source>

Download the hamachi binary to your pre via wget:

Note: It is recommended that you use the nokia build, because it included the install script. Whereas the direct hamachi link would require that make be installed.

<source lang="text"> cd /opt/share wget http://files.hamachi.cc/linux/nokia-770/hamachi-0.9.9.9-20-lnx-n770.tar.gz </source>

Unpack the archive: <source lang="text"> tar zxvf hamachi-0.9.9.9-20-lnx-n770.tar.gz cd hamachi-n770-0.9.9.9-20 </source>

Hamachi depends on libcrypto.so.0.9.7. The Palm Pre has libcrypto.so.0.9.8 installed. I made a symlink, and it worked. So... <source lang="text"> ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.0.9.7 </source>

Edit the "install" script using your favorite editor (like vi) to change the installation locations. Also fix line 7 or you'll get an error.

I changed it to:

<source lang="text"> HAMACHI_DST=/opt/bin TUNCFG_DST=/opt/sbin

echo echo Copying hamachi into $HAMACHI_DST .. </source>

Then follow the instructions in the README under Quick Start, but basically:

<source lang="text"> ./install /opt/sbin/tuncfg hamachi-init hamachi start hamachi login hamachi set-nick <your nickname> hamachi join <network> hamachi go-online </source>

Hint

Adding your Pre to your Windows hamachiVPN.

<source lang="text">

If you want to join a group made on the hamachi.cc (the official logmein page) webpage you need the group ID (joining by group name fails). On the logmein website click on My Computers and on the left side click on the Network tab. You can create a new network here under "add network" To get an ID for an existing network click on "edit" on the right side of the group name. This will bring up the edit page under the ID is the 9 digit group ID (XXX-XXX-XXX) with dashes these are also part of the group ID. To join this network on your pre type "hamachi join (9 digit ID don't forget the dashes) (password)".

</source>

If you use Hamachi to connect to web services running on your machines at home or elsewhere, you might make your life easier by adding some entries to the /etc/hosts file. Then you can access your servers by name instead of having to use the Hamachi 5.x.x.x IP addresses.

A simple sample entry in /etc/hosts which would allow you to access your server "beaker" at 5.1.2.3 would be: (Add your servers below the "castle" line.) <source lang="text"> 127.0.0.1 localhost.localdomain localhost 127.0.0.1 castle 5.1.2.3 beaker </source>

When done, make the filesystem read-only again: <source lang="text"> mount -o remount,ro / </source>

Ping Test

When you've got hamachi up, you can try pinging one of your servers. <source lang="text"> root@castle:/var/home/root# ping beaker PING beaker (5.1.2.3): 56 data bytes 64 bytes from 5.1.2.3: seq=0 ttl=128 time=5.493 ms 64 bytes from 5.1.2.3: seq=1 ttl=128 time=32.257 ms 64 bytes from 5.1.2.3: seq=2 ttl=128 time=56.976 ms 64 bytes from 5.1.2.3: seq=3 ttl=128 time=74.249 ms </source>

Sleep/Wake and Battery Impact

On first testing:

  • When the device went to sleep, the VPN went down.
  • When the device woke up, the VPN came back up and was pingable again.

This morning, while at my workstation, and with the Pre idle in my pocket, I noticed my Pre was available/pingable on Hamachi. I am not totally sure of what the long-term battery impact might be of running Hamachi on the Pre. I'm not yet sure if it keeps the device "awake" all the time, which clearly would drain the battery. I have push GMail IMAP going, so I assume there is some kind of connection either being periodically established or constantly maintained. But I don't know enough about the networking aspects to determine at this time whether running Hamachi all the time will negatively impact the battery. Feel free to message me if you learn anything.

Further Testing:

  • With Hamachi running I would achieve 12 hours of battery life on my pre
  • Without Hamachi running after 12 hours I am sitting at 60% battery life

So to conclude running Hamachi all the time significantly decreases battery life in my situation. I personally would not recommend running Hamachi all the the time.

Upstart script

This script will start Hamachi up after a reboot.

Place the following script in /etc/event.d/hamachi

<source lang="text"> description "Hamachi VPN for WebOS" version 1.0

  1. don't start until the WebOS finishes it's normal boot
  2. that way no delay is added to the GUI startup

start on stopped finish stop on runlevel [!2]

console output

script

 /opt/bin/hamachi -c /var/home/root/.hamachi start 2>&1 /var/home/root/hamachi.log

end script

pre-start script

 /opt/sbin/tuncfg

end script </source>