Establishing a Mesh Portal: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
(A few updates)
Line 5: Line 5:
* http://www.cozybit.com/projects/mpp-utils/mpp-utils.tar.gz
* http://www.cozybit.com/projects/mpp-utils/mpp-utils.tar.gz
* A USB ethernet adapter
* A USB ethernet adapter
* One OLPC laptop (XO)



==What to do==
==What to do==
* Plug the USB ethernet adapter into the XO

* Un-gzip and un-tar that somewhere on your mesh portal machine
* Un-gzip and un-tar that somewhere on your mesh portal machine


* in masquerade.sh from the mpp-utils, change EXTIF to your USB wired interface
* in masquerade.sh from the mpp-utils, change EXTIF to your USB wired interface. If the USB ethernet adapter is plugged in at at boot, this will usually be "eth0".


* In masquerade.sh, make the following changes (in patch-style form):
* In masquerade.sh, make the following changes (shown here in patch-style form):


<pre>
<pre>
Line 31: Line 33:
</pre>
</pre>


* Set your init level to '3'; stopping Sugar and X from starting again.
* reboot


<pre>
* Create an ifcfg file for your wired interface. If your wired interface is eth1:
nano /etc/inittab
</pre>

find the line with:

<pre>
id:5:initdefault:
</pre>

and change the '5' to a '3' so it looks like this instead:

<pre>
id:3:initdefault:
</pre>

* reboot


Create /etc/sysconfig/network-scripts/ifcfg-eth1, which should contain:
* Create an ifcfg file for your USB wired interface. For example, if your wired interface is eth0, create /etc/sysconfig/network-scripts/ifcfg-eth0, which should contain:


<pre>
<pre>
DEVICE=eth1
DEVICE=eth0
ONBOOT=no
ONBOOT=no
BOOTPROTO=dhcp
BOOTPROTO=dhcp
</pre>
</pre>

This file will already exist for 'eth0', but if your USB wired interface is _not_ 'eth0', you need to create this file for whatever interface name your wired USB device is.


* Start the wired interface
* Start the wired interface
<pre>ifup eth1</pre>
<pre>ifup eth0</pre>

* Install the DHCP daemon

<pre>
yum -y install dhcp
</pre>

You may have to try this command twice; yum sometimes runs out of memory doing dependency solving, and terminates before actually installing the RPM.

* Configure DHCP to serve on the mesh interface. Edit /etc/sysconfig/dhcpd so it looks like this:

<pre>
# Command line options here
DHCPDARGS=msh0
</pre>

* Set up DHCP to provide leases on the mesh interface. Edit /etc/dhcpd.conf to look like the following. For the "option domain-name-servers", use the domain name servers that your USB Ethernet device returned via DHCP, which should be found in /etc/resolv.conf. Don't leave "option domain-name-servers with the "x.x.x.x" values. If you only have one DNS server, omit the second value from at line.

<pre>
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.5 10.0.0.254;
default-lease-time 3600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option routers 10.0.0.1;
option domain-name-servers x.x.x.x, x.x.x.x;
}
</pre>

* Set DHCP to run on startup
<pre>
chkconfig --level 345 dhcpd on
</pre>


* Configure the mesh interface
* Configure the mesh interface
Line 50: Line 104:


* Assign the address to the mesh interface
* Assign the address to the mesh interface
<pre>ifconfig msh0 169.254.1.1 up</pre>
<pre>ifconfig msh0 10.0.0.1 up</pre>

* Delete the 169.254/16 route on the wired interface
<pre>ip route del 169.254.0.0/16 dev eth1</pre>


* run the mpp.py script
* run the mpp.py script

Revision as of 16:07, 13 April 2007

It's not entirely automatic quite yet; we'll get a more automatic solution in place soon.

Requirements

What to do

  • Plug the USB ethernet adapter into the XO
  • Un-gzip and un-tar that somewhere on your mesh portal machine
  • in masquerade.sh from the mpp-utils, change EXTIF to your USB wired interface. If the USB ethernet adapter is plugged in at at boot, this will usually be "eth0".
  • In masquerade.sh, make the following changes (shown here in patch-style form):
    # This line results in iptables: Unknown error 4294967295
-    #$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
+    $IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPTABLES -A FORWARD -i $EXTIF -o $INTIF  -j ACCEPT
    $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
-    $IPTABLES -A FORWARD -j LOG
+    #$IPTABLES -A FORWARD -j LOG
  • Stop NetworkManager and the 'network' scripts
chkconfig --level 2345 NetworkManager stop
chkconfig --level 2345 network stop
chkconfig --level 2345 dhcdbd stop
  • Set your init level to '3'; stopping Sugar and X from starting again.
nano /etc/inittab

find the line with:

id:5:initdefault:

and change the '5' to a '3' so it looks like this instead:

id:3:initdefault:
  • reboot
  • Create an ifcfg file for your USB wired interface. For example, if your wired interface is eth0, create /etc/sysconfig/network-scripts/ifcfg-eth0, which should contain:
DEVICE=eth0
ONBOOT=no
BOOTPROTO=dhcp

This file will already exist for 'eth0', but if your USB wired interface is _not_ 'eth0', you need to create this file for whatever interface name your wired USB device is.

  • Start the wired interface
ifup eth0
  • Install the DHCP daemon
yum -y install dhcp

You may have to try this command twice; yum sometimes runs out of memory doing dependency solving, and terminates before actually installing the RPM.

  • Configure DHCP to serve on the mesh interface. Edit /etc/sysconfig/dhcpd so it looks like this:
# Command line options here
DHCPDARGS=msh0
  • Set up DHCP to provide leases on the mesh interface. Edit /etc/dhcpd.conf to look like the following. For the "option domain-name-servers", use the domain name servers that your USB Ethernet device returned via DHCP, which should be found in /etc/resolv.conf. Don't leave "option domain-name-servers with the "x.x.x.x" values. If you only have one DNS server, omit the second value from at line.
subnet 10.0.0.0 netmask 255.255.255.0 {
  range 10.0.0.5 10.0.0.254;
  default-lease-time 3600;
  max-lease-time 7200;
  option subnet-mask 255.255.255.0;
  option broadcast-address 10.0.0.255;
  option routers 10.0.0.1;
  option domain-name-servers x.x.x.x, x.x.x.x;
}
  • Set DHCP to run on startup
chkconfig --level 345 dhcpd on
  • Configure the mesh interface
iwconfig msh0 mode ad-hoc channel 11 essid "olpc-mesh"
  • Assign the address to the mesh interface
ifconfig msh0 10.0.0.1 up
  • run the mpp.py script
python mpp.py

and it should all work

Further Reading

More information is available on these topics: