Skip to content

Commit

Permalink
Merge pull request #36 from tomeshnet/module-3
Browse files Browse the repository at this point in the history
Worksheet Module 3
  • Loading branch information
benhylau committed May 1, 2018
2 parents 6a7b0b5 + 55f9948 commit c79dfcd
Show file tree
Hide file tree
Showing 14 changed files with 305 additions and 8 deletions.
16 changes: 8 additions & 8 deletions module-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ Group activity to wirelessly mesh with other groups by configuring Raspberry Pis

### Activity

- As a class review the purpose of each command in a sample starter script
- As a class review the purpose of each command in a sample starter script:
```
ip link set dev wlan1 down
iw wlan1 set type mp
ip link set dev wlan1 up
iw dev wlan1 mesh join MY_MESH_NAME_HERE freq 2412
ip addr add 192.168.0.1/24 dev wlan0
ip link set dev wlanX down
iw wlanX set type mp
ip link set dev wlanX up
iw dev wlanX mesh join MY_MESH_NAME freq 2412
ip addr add 192.168.0.Y/24 dev wlanX
```
- Break into groups of two
- Each group needs a pair of Raspberry Pis
- Each group will connect to their Raspberry Pi's Host AP and initiate a SSH session
- Use ifconfig to identify which wlan interface is which (Hint: look for 10.0.0.1)
- Use ifconfig and iw to create a mesh between the nodes with this sample starter script
- Use `iw wlan1 station dump` to see if connections are established
- Use `iperf3 -s` on one node and `iperf3 -c 192.168.1.x` on another node to test the speed across the link
- Use `iw wlanX station dump` to see if connections are established
- Use `iperf3 -s` on one node and `iperf3 -c 192.168.0.Y` on another node to test the speed across the link
- Once the nodes are properly meshed, have groups seek out another group that has finished
- Work together to integrate all 4 nodes into one mesh
- Encourage group to continue to merge meshes until all the groups are meshed into one
Expand Down
7 changes: 7 additions & 0 deletions module-3/presentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Module 3: Building a node

1. Recap from last week
1. Parts of a node and radio frequency
1. Meshing your nodes
1. Building your own node
1. Wrap-up & homework
11 changes: 11 additions & 0 deletions module-3/presentation/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Summary

* [Recap from last week](part-0/README.md)
* [Parts of a node and radio frequency](part-1/README.md)
* [What is in a node](part-1/what-is-in-a-node.md)
* [Radio and waves](part-1/radio-and-waves.md)
* [Meshing your nodes](part-2/README.md)
* [Connecting with WiFi](part-2/connecting-with-wifi.md)
* [Worksheet](part-2/worksheet.md)
* [Building your own node](part-3/README.md)
* [Wrap-up & homework](part-4/README.md)
13 changes: 13 additions & 0 deletions module-3/presentation/part-0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Recap from last week

**First Week**

Using Raspberry Pis, we formed a `wireless mesh network`.

**Last week**

Using Raspberry Pis, we configured a `wired network`.

**This Week**

Using Raspberry Pis, we will configure a `wireless mesh network`.
1 change: 1 addition & 0 deletions module-3/presentation/part-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Parts of a node and radio frequency
56 changes: 56 additions & 0 deletions module-3/presentation/part-1/radio-and-waves.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Radio and waves

Radio - the technology of using electromagnetic waves to carry information

## Properties of waves

### Frequency

* Measured in Hertz (Hz), or cycles per second
* We tune the radio to hear other people on the same frequency

### Amplitude

* How much power the wave has
* How loud we are talking

### Polarity

* Which direction is the wave cycling
* Orientation of the antenna is important

### Phase

* The offset of peaks and valleys of two waves
* You add the values at each point to calculate the new amplitude
* Two peeks or valleys - wave has double the amplitude
* A peek and a valley - amplitude closer to zero
* Interference happens when waves bounce off walls

### Channel width

* Defines how wide of a frequency band does the signal take up
* Larger channel width:
* Provides more frequencies
* Allows for more data to be sent at once
* Is more susceptible to mode noise

## Frequencies and channels

Channels - human defined numbers that point to a specific frequency

* There are 13 channels defined for WiFi
* In Canada we can only use the first 11
* First channel starts at 2.412 GHz (or 2,412 MHz)
* The channels are spaced out by 5 MHz
* Standard WiFi signals use a channel width of 20 Mhz
* There are only 3 non-overlapping signals in the 2.4 GHz range (1, 6, and 11)

## Licensing

* There are many frequencies coexisting in the air
* Most of them are designated to a specific function
* Government agency tasked with controlling them in Canada is the CRTC
* 2.4 Ghz and 5.0 Ghz do not require any licensing
* Used by many devices, such as microwave ovens, not just WiFi devices
* They look like noise to WiFi devices
36 changes: 36 additions & 0 deletions module-3/presentation/part-1/what-is-in-a-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# What is in a node?

## Single Board Computer

* All the components of a computer on one board
* Components include processors, memory, storage, peripherals
* Smart phone revolution modernized these types of computers
* A node runs our software, processing signals and routing traffic

## Storage

* Many types of storage, each good for different reasons
* Some properties to be aware of:
* Format - how the physical device works?
* Speed - how fast can it access and store data?
* Capacity - how much data can it store?
* Endurance - how long can it store the data for?

## Power supply

* Allow us to power the node
* Consider what power you have available:
* Wall plug - city's power gird
* Batteries - stored power from another source
* Solar, wind, etc. - alternative sources

## Antenna

* Used to receive (Rx) and transmit (Tx)
* Designed for specific frequency ranges and purposes

## Radio

* We use the 802.11 standard known as "WiFi"
* Radios can come in many formats
* They connect to an antenna
1 change: 1 addition & 0 deletions module-3/presentation/part-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Meshing your nodes
36 changes: 36 additions & 0 deletions module-3/presentation/part-2/connecting-with-wifi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Connecting with WiFi

## Infrastructure mode

Most common setup for WiFi:

* Router acts as an Access Point (AP)
* Each device connects to it to communicate
* Single point of failure, the router

## Mesh mode

There are two different modes that we can use to create a mesh:

* Independent Basic Service Set (IBSS)
* Also known as Ad-hoc
* Much older and more supported
* Mesh Point (802.11s)
* A new specification
* Not many devices support this mode
* Many useful features

## Meshing in Linux

To mesh in Linux you issue the following commands:

* Turn off the interface:
* `ip link set dev <interface> down`
* Switch to a mesh mode:
* `iw <interface> set type <mode>`
* Turn on the interface:
* `ip link set dev <interface> up`
* Join a group at a particular frequency:
* `iw dev <interface> <mode> join <group name> <frequency>`
* Assign an IP address:
* `ip addr add <ip address>/24 dev <interface>`
6 changes: 6 additions & 0 deletions module-3/presentation/part-2/worksheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Worksheet

* Break into groups of 2
* Configure the two nodes to mesh together
* Assign IP addresses
* Ping each IP address
1 change: 1 addition & 0 deletions module-3/presentation/part-3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Building your own node
11 changes: 11 additions & 0 deletions module-3/presentation/part-4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Homework

Next session we will discuss wireless links more extensively, both theoretically and the practical aspects when configuring a wireless mesh network.

📝 [A quick tour of a mesh networking installation](https://www.youtube.com/watch?v=aLusYsScrv0) from the [Metamesh YouTube channel](https://www.youtube.com/channel/UCGEnntxbGKMU9J9GIZ1LQUQ)

_Optionally:_

- Read [Wireless Networking in the Developing World](http://wndw.net/pdf/wndw3-en/ch10-deployment-planning.pdf), Chapter 10: Deployment Planning
- Watch [How to install a Smartrek wireless mesh network for sugar making purposes](https://www.youtube.com/watch?v=eKkVEeVNhm8) (4:31)
- Watch [Rural Next Generation Broadband Project](https://www.youtube.com/watch?v=QM7MUWDcNxk) (6:12)
57 changes: 57 additions & 0 deletions module-3/worksheet/2-configuration-cards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
```
ip link set dev wlanX down
iw wlanX set type mp
ip link set dev wlanX up
iw dev wlanX mesh join MY_MESH_NAME freq 2412
ip addr add 192.168.0.Y/24 dev wlanX
```

---

```
ip link set dev wlanX down
iw wlanX set type mp
ip link set dev wlanX up
iw dev wlanX mesh join MY_MESH_NAME freq 5240
ip addr add 192.168.0.Y/24 dev wlanX
```

---

```
ip link set dev wlanX down
iw wlanX set type mp
ip link set dev wlanX up
iw dev wlanX mesh join MY_MESH_NAME freq 2437
ip addr add 192.168.0.Y/24 dev wlanX
```

---

```
ip link set dev wlanX down
iw wlanX set type ibss
ip link set dev wlanX up
iw dev wlanX ibss join MY_MESH_NAME 2437
ip addr add 192.168.0.Y/24 dev wlanX
```

---

```
ip link set dev wlanX down
iw wlanX set type ibss
ip link set dev wlanX up
iw dev wlanX ibss join MY_MESH_NAME 5745
ip addr add 192.168.0.Y/24 dev wlanX
```

---

```
ip link set dev wlanX down
iw wlanX set type ibss
ip link set dev wlanX up
iw dev wlanX ibss join MY_MESH_NAME 5180
ip addr add 192.168.0.Y/24 dev wlanX
```
61 changes: 61 additions & 0 deletions module-3/worksheet/2-mesh-your-node-wirelessly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Mesh your node wirelessly
===========================

## Connecting to your Raspberry Pi

1. Verify that the Raspberry Pi has the SD card in place. Power on the device and wait for a solid green light with a flashing red light.

1. Connect your computer's WiFi Client to the Raspberry Pi's WiFi Access Point:

- SSID: `<hostname>`
- Password: `password`

1. Once your computer is connected to the WiFi Access Point, you can access the Raspberry Pi via a Secure Shell (SSH):

- Host: `<hostname>.local` (or `10.0.0.1`)
- Username: `root`
- Password: `root`

On **macOS or Linux** using **Terminal**, enter `ssh root@example.local` followed by the password `root`.

On **Windows** using the **PuTTY** graphical interface, enter the `Host` and select `SSH` then click `Open` to initiate an SSH session. Enter the `Username` and `Password` when prompted.

You are now connected to and able to run commands from your Raspberry Pi. The Raspberry Pis are currently not connected to all the other ones in the room. Find a partner and we will manually get the two Raspberry Pis to talk over a wireless mesh with a series of commands provided. For the rest of this activity, we will use `example` to represent your node.

## Finding your mesh interface

1. The Raspberry Pi may prepare network interfaces out of order. To make sure we do not accidentally change the settings on the interface running the Access Point (and disconnect us from the Pi) we will first confirm the interface names:

**root@example:~#** `iw dev`

You should see one of the interfaces with `type: AP`. This is the Access Point that your computer uses to connect to the node wirelessly.

1. Make note of the interface that is _not_ your `AP`. It will most likely be `wlan1`.

## Creating your mesh network

1. Partner up with someone at the table to form a new mesh group.

1. Decide on a name for your newly formed mesh. Keep it simple and a single word. Don't spend too much time on this.

1. Use the commands provided to create a mesh network between the two nodes, with the following substitutions:

* Make sure you use the correct `wlanX` network interface that you noted above.
* Replace `MY_MESH_NAME` with the mesh name you decided on.
* Assign each node a different IP address. For example, `192.168.0.1` for the first and `192.168.0.2` for the second.

## Testing your mesh network

1. Use `ping` to ping the other connected node and see if it responds.

1. You can check to see what nodes are connected by doing a station dump:

**root@example:~#** `iw wlanX station dump`

## Growing your mesh network

1. Now that you have successfully created your small mesh network, find another group in your proximity.

1. Expand your mesh to include the new group.

1. Now repeat it with another group.

0 comments on commit c79dfcd

Please sign in to comment.