Maemo PirateBox

(New page: This manual explains how to turn your N810 or N900 Maemo device into a PirateBox. In case you don't know what is piratebox go to [http://wiki.daviddarts.com/PirateBox David Darts page] or...)
(Start access point)
 
(8 intermediate revisions not shown)
Line 1: Line 1:
-
This manual explains how to turn your N810 or N900 Maemo device into a PirateBox.
+
This manual explains how to turn your [[Nokia N810|N810]] or [[Nokia N900|N900]] Maemo device into a PirateBox.
-
 
+
[[Image:Screenshot_lola_rennt.png|350px|thumb|right| n810 connected to n900 piratebox]]
In case you don't know what is piratebox go to [http://wiki.daviddarts.com/PirateBox David Darts page] or [http://www.thepiratebox.net/ here]. Also, there are script called [https://github.com/cr/mkPirateBox mkPirateBox] for hardware router devices.
In case you don't know what is piratebox go to [http://wiki.daviddarts.com/PirateBox David Darts page] or [http://www.thepiratebox.net/ here]. Also, there are script called [https://github.com/cr/mkPirateBox mkPirateBox] for hardware router devices.
 +
I also found [http://talk.maemo.org/member.php?u=51085 Plissken]'s [http://forum.daviddarts.com/read.php?2,57 implementation] for n900, however it requires custom kernel. This solution is much simpler and works with maemo default kernels. It does not support file uploading, and thus is not a "canonical" piratebox. However, it allows to create your own web page with links, and distribute them everywhere you go.
==Install web server==
==Install web server==
-
Basicly what we need is a web server.
 
-
<pre>
 
-
apt-get install lighttpd
 
-
</pre>
 
-
I also edited the server's config file
+
Basically what we need is a web server and wireless-tools:
-
<pre>
+
apt-get install lighttpd wireless-tools
-
vi /etc/lighttpd.conf
+
-
</pre>
+
-
and changed document root directory to /media/mmc1/www
+
-
<pre>
+
-
server.document-root = "/media/mmc1/www/"
+
-
</pre>
+
-
put your website data there and start http server if it's not started.
+
I also edited the server's config file:
-
<pre>/etc/init.d/lighttpd restart</pre>
+
vi /etc/lighttpd.conf
 +
 
 +
and changed document root directory to <code>/media/mmc1/www</code>
 +
 
 +
server.document-root = "/media/mmc1/www/"
 +
 
 +
put your website data there and start http server if it's not started:
 +
 
 +
/etc/init.d/lighttpd restart
==Start access point==
==Start access point==
-
So, dnsmasq is available in maemo out of the box. It is a dns and dhcp server.
+
So, dnsmasq is available in Maemo out of the box. It is a DNs and DHCP server. [[root access|As root]], start the following script:
-
As a root, start the following script:
+
-
<pre>
+
<source lang="bash">
#!/bin/bash
#!/bin/bash
set -x
set -x
Line 42: Line 40:
ifconfig $IFACE down
ifconfig $IFACE down
sleep $INT  
sleep $INT  
-
iwconfig $IFACE mode ad-hoc
 
-
sleep $INT
 
ifconfig $IFACE up  
ifconfig $IFACE up  
 +
sleep $INT
 +
iwconfig $IFACE mode ad-hoc
sleep $INT
sleep $INT
iwconfig $IFACE essid $ESSID
iwconfig $IFACE essid $ESSID
 +
sleep $INT
ifconfig $IFACE $ADDR netmask $NETMASK up
ifconfig $IFACE $ADDR netmask $NETMASK up
 +
sleep $INT
/usr/sbin/dnsmasq -i $IFACE -a $ADDR -I lo -z -d \
/usr/sbin/dnsmasq -i $IFACE -a $ADDR -I lo -z -d \
Line 54: Line 54:
  --address=/#/$ADDR \
  --address=/#/$ADDR \
  --no-resolv
  --no-resolv
-
</pre>
+
</source>
 +
Here <pre>--address=/#/$ADDR</pre> option is used in order to forward all the requests (i. e. to google or facebook) to the local web server.
 +
 
 +
This is it, now anybody can connect to your access point, type any address in the browser's address bar, and see your personal PirateBox on your N900 or N810 running under maemo
 +
 
 +
''I have written some comments and additions here: http://wiki.maemo.org/User:Rolfok#PirateBox''
-
This is it, now anybody can connect to your access point and your personal PirateBox on your n900 or n810 running under maemo
+
[[Category:Software]]

Latest revision as of 22:51, 27 February 2011

This manual explains how to turn your N810 or N900 Maemo device into a PirateBox.

n810 connected to n900 piratebox

In case you don't know what is piratebox go to David Darts page or here. Also, there are script called mkPirateBox for hardware router devices. I also found Plissken's implementation for n900, however it requires custom kernel. This solution is much simpler and works with maemo default kernels. It does not support file uploading, and thus is not a "canonical" piratebox. However, it allows to create your own web page with links, and distribute them everywhere you go.

[edit] Install web server

Basically what we need is a web server and wireless-tools:

apt-get install lighttpd wireless-tools

I also edited the server's config file:

vi /etc/lighttpd.conf

and changed document root directory to /media/mmc1/www

server.document-root = "/media/mmc1/www/"

put your website data there and start http server if it's not started:

/etc/init.d/lighttpd restart

[edit] Start access point

So, dnsmasq is available in Maemo out of the box. It is a DNs and DHCP server. As root, start the following script:

#!/bin/bash
set -x
IFACE=wlan0
ESSID=welcome_to_norayrs_mobile_server #set this yourself
MYTEMPHOSTNAME=maemo
ADDR=23.23.23.23
NETMASK=255.255.255.0
ADDR_MIN=23.23.23.0
ADDR_MAX=23.23.23.255
INT=1
 
ifconfig $IFACE down
sleep $INT 
ifconfig $IFACE up 
sleep $INT
iwconfig $IFACE mode ad-hoc
sleep $INT
iwconfig $IFACE essid $ESSID
sleep $INT
ifconfig $IFACE $ADDR netmask $NETMASK up
sleep $INT
 
/usr/sbin/dnsmasq -i $IFACE -a $ADDR -I lo -z -d \
                  -x /var/run/dnsmasq.$IFACE.pid \
                  --dhcp-range=$ADDR_MIN,$ADDR_MAX,12h \
		  --address=/#/$ADDR \
		  --no-resolv
Here
--address=/#/$ADDR
option is used in order to forward all the requests (i. e. to google or facebook) to the local web server.

This is it, now anybody can connect to your access point, type any address in the browser's address bar, and see your personal PirateBox on your N900 or N810 running under maemo

I have written some comments and additions here: http://wiki.maemo.org/User:Rolfok#PirateBox