User:Mistapotta/Hamachi: Difference between revisions
Mistapotta (talk | contribs) (→Starting Hamachi at Boot: Modified to speed up boot) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 48: | Line 48: | ||
In the code above, change olpc to whatever name you want, or leave it. Change <code>NETWORKNAME</code> and <code>NETWORKPASSWORD</code> to the VPN Network Name and Network Password. |
In the code above, change olpc to whatever name you want, or leave it. Change <code>NETWORKNAME</code> and <code>NETWORKPASSWORD</code> to the VPN Network Name and Network Password. |
||
After you create the shell file, type <code>chmod 755 ./hama.sh</code> to make the shell runnable. |
|||
⚫ | |||
⚫ | |||
===At this point...=== |
===At this point...=== |
||
Line 95: | Line 97: | ||
===Starting Hamachi at Boot=== |
===Starting Hamachi at Boot=== |
||
<B><I>(Modified from earlier posting: If your XO doesn't have a wireless network to join, it will hang with the original version of this. You can make the changes in bold italics to prevent this.)</I></B> |
|||
It'd be nice if hamachi was set up to run when we boot up the machine. To do this, we have to create one file and edit another. |
It'd be nice if hamachi was set up to run when we boot up the machine. To do this, we have to create one file and edit another. |
||
We |
<B><I>We'll start by copying the hama.sh file (created above) to the /etc/init.d directory. To do this we type |
||
<code><pre> |
|||
cp hama.sh /etc/init.d |
|||
</PRE></CODE> |
|||
</I></B> |
|||
We then need to create a shell script that will be called when the machine is booted. To do this, we type: |
|||
<code><pre> |
<code><pre> |
||
vi /etc/init.d/hamachi |
vi /etc/init.d/hamachi |
||
Line 108: | Line 117: | ||
hamachi_start() { |
hamachi_start() { |
||
echo "Starting hamachi..." |
echo "Starting hamachi..." |
||
/sbin/tuncfg |
/sbin/tuncfg</PRE> |
||
<B><I><PRE>/etc/init.d/hama.sh &</PRE></I></B> |
|||
/usr/bin/hamachi -c /etc/hamachi start |
|||
<PRE> |
|||
/usr/bin/hamachi -c /etc/hamachi set-nick olpc |
|||
/usr/bin/hamachi -c /etc/hamachi login |
|||
/usr/bin/hamachi -c /etc/hamachi join NETWORKNAME NETWORKPASSWORD |
|||
/usr/bin/hamachi -c /etc/hamachi go-online NETWORKNAME |
|||
} |
} |
||
Line 142: | Line 148: | ||
esac |
esac |
||
</pre></code> |
</pre></code> |
||
and after typing this, type ''':wq''', which writes the file and quits the editor. (Note: you need to change '''NETWORKNAME''' and '''NETWORKPASSWORD''' to the appropriate values, and you can change '''olpc''' to whatever you choose. |
and after typing this, type ESC, then ''':wq''', which writes the file and quits the editor. (Note: you need to change '''NETWORKNAME''' and '''NETWORKPASSWORD''' to the appropriate values, and you can change '''olpc''' to whatever you choose. |
||
Then type <code>chmod 755 /etc/init.d/hamachi</code> to enable it to be run. |
|||
To get this file to be run by the machine when it boots, we have to edit another file. So type |
To get this file to be run by the machine when it boots, we have to edit another file. So type |
||
Line 160: | Line 168: | ||
You should see the "ham0" network adapter. |
You should see the "ham0" network adapter. |
||
===To Do:=== |
===To Do:=== |
||
Latest revision as of 15:44, 1 August 2009
Installing Hamachi
Part of the reason I want to install Hamachi is so my son will be able to view videos on our home server. I have DVD's ripped to the harddrive, and totem
is pre-installed on the OLPC. I've got Hamachi VPN on all the computers in the house, and would like to add it to his XO Laptop.
Please note that Hamachi is not open-source. If you're looking for an open-source alternative, I suggest you look into Open VPN.
Downloading Hamachi
You need to get a copy of the files to install Hamachi and put them in the /usr/src
folder, We'll start by switching to the superuser, then getting the source code
su
cd /usr/src
wget http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz
tar -xvzf hamachi-0.9.9.9-20-lnx.tar.gz
This creates a folder hamachi-0.9.9.9-20-lnx
which will hold the installation files.
Installing make
To continue the install. you have to switch to the directory and type make install
. make
is not already installed on OLPC, so you need to install it by typing
yum install make
yum install binutils
. It should install all the necessary parts to make Hamachi executable from the command line.
Installing the Hamachi program
To install the hamachi executables (hamachi
, hamachi-init
, and tuncfg
), you'll need to change to the directory and type make install
. Then you need to type tuncfg
to start the tunnel configuration (Hamachi uses ssh to tunnel to other members of the VPN.)
cd hamachi-0.9.9.9-20-lnx.tar.gz
make install
tuncfg
Accessing the existing Hamachi VPN
Set up a shell file (I called mine hama.sh
) with the following lines of code:
tuncfg
hamachi-init -c /etc/hamachi
hamachi -c /etc/hamachi start
hamachi -c /etc/hamachi set-nick olpc
hamachi -c /etc/hamachi login
hamachi -c /etc/hamachi join NETWORKNAME NETWORKPASSWORD
hamachi -c /etc/hamachi go-online NETWORKNAME
In the code above, change olpc to whatever name you want, or leave it. Change NETWORKNAME
and NETWORKPASSWORD
to the VPN Network Name and Network Password.
After you create the shell file, type chmod 755 ./hama.sh
to make the shell runnable.
Then type ./hama.sh
to execute it. This will connect you to the network.
At this point...
If you type ifconfig
, you should see something like this:
bash-3.2# ifconfig
eth0 Link encap:Ethernet HWaddr 00:17:C4:0C:D8:DE
inet addr:192.168.1.28 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::217:c4ff:fe0c:d8de/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2884 errors:0 dropped:0 overruns:0 frame:0
TX packets:1942 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:613526 (599.1 KiB) TX bytes:234824 (229.3 KiB)
ham0 Link encap:Ethernet HWaddr 00:FF:95:1F:E7:34
inet addr:5.178.7.95 Bcast:5.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1200 Metric:1
RX packets:76 errors:0 dropped:0 overruns:0 frame:0
TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:12796 (12.4 KiB) TX bytes:17359 (16.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:37 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1868 (1.8 KiB) TX bytes:1868 (1.8 KiB)
msh0 Link encap:Ethernet HWaddr 00:17:C4:0C:D8:DE
inet addr:169.254.9.122 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::217:c4ff:fe0c:d8de/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2887 errors:0 dropped:0 overruns:0 frame:0
TX packets:1951 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:613688 (599.3 KiB) TX bytes:237094 (231.5 KiB)
The important part is you now have ham0
as a network adapter. At this point, you can access other computers (via ssh
, sftp
, ping
etc.) through their Hamachi IP addresses.
Starting Hamachi at Boot
(Modified from earlier posting: If your XO doesn't have a wireless network to join, it will hang with the original version of this. You can make the changes in bold italics to prevent this.)
It'd be nice if hamachi was set up to run when we boot up the machine. To do this, we have to create one file and edit another.
We'll start by copying the hama.sh file (created above) to the /etc/init.d directory. To do this we type
cp hama.sh /etc/init.d
We then need to create a shell script that will be called when the machine is booted. To do this, we type:
vi /etc/init.d/hamachi
which will create the hamachi script file. Type i to be able to insert text, then put the following in the file:
#!/bin/sh
hamachi_start() {
echo "Starting hamachi..."
/sbin/tuncfg
/etc/init.d/hama.sh &
}
hamachi_stop() {
echo "Stopping hamachi..."
killall tuncfg
/usr/bin/hamachi -c /etc/hamachi stop
}
hamachi_restart() {
hamachi_stop
sleep 1
hamachi_start
}
case "$1" in
'start')
hamachi_start
;;
'stop')
hamachi_stop
;;
'restart')
hamachi_restart
;;
*)
hamachi_start
esac
and after typing this, type ESC, then :wq, which writes the file and quits the editor. (Note: you need to change NETWORKNAME and NETWORKPASSWORD to the appropriate values, and you can change olpc to whatever you choose.
Then type chmod 755 /etc/init.d/hamachi
to enable it to be run.
To get this file to be run by the machine when it boots, we have to edit another file. So type
vi /etc/rc.local
to edit the file. Type i to get into insert mode, move to the end of the last entry, type enter, then add the following line:
/etc/init.d/hamachi
and after typing this, type :wq, which writes the file and quits the editor.
At this point, when you reboot your machine, you should automatically log into Hamachi. You can check this by rebooting, running the Terminal Activity, and typing :
ifconfig
You should see the "ham0" network adapter.
To Do:
Mounting shares using /etc/fstab (so file systems show up at boot)