High Performance Node - Setup

From WirelessAfrica
Revision as of 15:56, 1 August 2008 by Tom (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This document is specifically for the Bokkie routers at Ndlovu, but the instructions could be adapted for other sites. It's meant for someone with networking experience but almost no Unix or Linux-specific knowledge.

This is how you would configure a new node to be added to the mesh.
Note, however, that many of the values here would have to change, and
they can't just be arbitrary! It depends on what other nodes this one is
going to point to, so that channels and IP addresses don't interfere.
We'll make an assumption about these values and then go from there; it's
a good idea to consult with Johann or at least take a hard look at the
physical layout of the nodes to make sure that channels aren't
interfering and you're using a proper IP range. I'm attaching the
version of the layout I have, but as you know it's out of date.

Lets assume this is node number 12. So all it's IP4 addresses are going
to end with 12.

Config instructions:

Plug into the Ethernet port of the node with your laptop and get a DHCP
lease. 

Look at your default gateway after you get a lease; this is the IP
address of the node. 

SSH to default gateway.

You can either use Putty on Windows or the following command on *nix
[note: the "$" indicates that you can run this as a normal user, it
represents a command prompt; you actually type the part coming
afterwards. This is a standard convention.]

$ ssh coin@10.36.145.1

where 10.36.145.1 is the IP address of the router; it will be different
on each one. Enter the password when prompted.

Once you're logged into the node you should get a shell. Make yourself
the root user with the command:

$ su

It shouldn't ask you for a password. Now you're root, and you can
execute commands that start with a "#" (again, don't actually type the
"#").

First, you need to mount the entire filesystem read/write (it's
read-only by default).

# mount -u -w /

Next, edit that crucial file:

# vi /conf/default/etc/rc.conf.local

This will bring up VI, in command mode, editing this file (which may not
exist yet). Press "i" to go into insert mode, then add:

hostname="Ndlovu"
olsrd4_enable="YES"
ifconfig_ath0="10.0.10.12/24 mode 11a channel 136 mediaopt adhoc ssid
ptabb bssid 22:b7:1a:b8:9c:7f"
ifconfig_ath1="10.0.50.12/24 mode 11a channel 128 mediaopt adhoc ssid
ptabb"

Note that these values vary per-node! So change the hostname to
something reasonable, but make sure that the IP addresses and channels
are correct for the place you're putting the node. Note that each of
thoese something="something else" lines is one line, but it in some
views it can wrap.

Save and quit VI by going into command mode (hit ESC while in insert
mode), then typing ":wq" and pressing return. Once out of VI, reboot:

# shutdown -r now

You don't need to do anything in olsrd4.conf, because
the /conf/default/rc.early script on the Ndlovu routers will generate
the olsrd4.conf file, with all it's HNA entries, if you enable 
olsrd4 in rc.conf.local. After the reboot you can do:

$ ps -ax | grep olsrd

And look for lines that list "olsrd4" to ensure that olsrd4 is running
(i.e. OLSR is working for IPv4).

Note that some of the non-deployed nodes may not have the right rc.early
script. If that's the the case, you can copy the /conf/default/rc.early
script from anyone the other routers, or the one from the tar file
attached to this email. To do that, you want to either use an SFTP
client on Windows to copy the rc.early file to /conf/default/rc.early
(after mounting the filesystem read-write as above!), or from a *nix
machine you can run:

$ scp /path/on/local/computer/to/rc.early coin@10.36.145.1:

Where 10.36.145.1 is again the IP of the node, your default gateway.
Then log into the box, run:

$ ls

To make sure that the file is there (in your current directory, which
should be /root). Then you can do this (note again that anything with a
"#" in front of it you need to first be root to do):

# cp rc.early /conf/default/etc/rc.early

Reboot, as above, and you should be good. Check again for olsrd4.

Debugging:

Login to router using SSH as above.

Do a "list sta" to see if you can see the other nodes. Should be
something like this:

# ifconfig ath0 list sta

ADDR               AID CHAN RATE RSSI IDLE  TXSEQ  RXSEQ CAPS FLAG
00:80:48:50:9a:0b    0  136  18M   38    0  29660  61984 I    A
00:80:48:50:9e:c1    0  136  48M   43    0  26851   7568 I    A

OR, if you want to fine tune the alignment, this is a continuous
printout of the above:

# rssi -i ath0 

Do a ping Ndlovu and other sites to test connectivity.

$ ping 10.0.10.4

Some general hints:


To inspect a node's routing table in FreeBSD:

# netstat -r

To make it more readable, print only IPv4 addresses:

# netstat -r -f inet


To change the default gateway of a node to 1.2.3.4:

Temporarily:

# route add default 1.2.3.4

Permanently:

Edit /conf/default/etc/rc.conf as root, and at the end of the file add
the line:

defaultrouter="1.2.3.4"


To get a list of network interfaces and their IP addresses, etc:

$ ifconfig

On your routers, ones that start npe are Ethernet, ones that start ath
are wireless.

To look at *all* traffic going through a particular interface:

# tcpdump -i npe0

To make this more readable, search for only certain lines. To filter any
command's output to only lines that include a specific text, add

 | grep "search"

to the end of it. For example:

# tcpdump -i npe0 | grep "ICMP"

dumps all traffic on the npe0 interface, but only shows lines that
include "ICMP" (eg Ping traffic). Note that the search is
case-sensitive! To make it not so, use `grep -i "search"` instead.


To simply view a file:

$ less /path/to/file.txt

To navigate use arrow keys, to exit this press "q".

To quit any general command, particularly continuous ones like ping or
tcpdump, press Control+C.


How to use that beast of a program, VI: 

http://www.cs.colostate.edu/helpdocs/vi.html