Router Tech 2.1
From Fab Lab wiki
Contents
|
Introduction
The instructions on this page are specific to FF 2.1. You can get the old stuff HERE
FF2.1 nodes are all identical. There is no concept of AP and STA as there was in 1.0, making true meshing a possibility. Every node serves a wireless and wired mesh network, a local lan, and can be uplinked directly to the web. In order to reconfigure the router with all these new features the default router firmware must be replaced with something more flexible. We have chosen [OpenWRT], an open source, linux based, 3rd party router firmware (which uses a modified bourne shell, for those of you who plan to write scripts) to replace the default firmware. The following sections detail the downloading, installation, and configuration of this firmware for the Linksys WRT54GL for FabFi version 2.0
NEW!!
- New Routers are being added to the mix (wiki pages coming soon)
- We're building Firmware (see next section)
Installing OpenWRT
OpenWRT supports a variety of routers, but we will be focsuing on the Linksys WRT54GL (because that's all we know anything about). No matter what router you use you must be ABSOLUTELY SURE that is is supported before installing OpenWRT, or there's no telling what could happen. NO TELLING!
Note: if you're using a WRT54GL, you can skip down to Installing OpenWRT on a WRT54GL
OpenWRT for non-WRT54GL users
Follow these instructions to get your router set up before joining us in the 54GL world for configuration
Determining if Your Router is Supported
https://wiki.openwrt.org/oldwiki/tableofhardware contains a comprehensive hardware support list for wireless routers. Determine the Make, Model and Hardware Revision of the router. This information is usually located on a sticker underneath the router. Then, go to the link above and scroll down to the hardware support table. Find your router in the table according to the Make, Model and Hardware Revision. Once you locate it, scan all the way to the rightmost column in the row for your router. If that cell says "Supported", then your router will work. If it says anything else, go find a supported router. If your router is not in the list, go find a supported router.
Downloading and Installing OpenWRT Firmware
If your router is supported, clicking on the word "Supported" will bring you to a hardware specific page for your router. Somewhere on the page will likely be listed the name of a file ending in ".bin". There may not be a direct link to the file. If this is the case, search for the following in Google:
[filename.bin] site:download.openwrt.org
This will bring you to the correct page to download the file.
If the name of the .bin file is not listed, you will have to determine the chipset of your device (usually Atheros or Broadcom in one of a few different versions) and download the OpenWRT .bin for that chipset (look on the pages for devices with similar chipsets for the name of the binary).
Once you have the binary on your computer, go back to the hardware page for your router and follow the instructions in the "Installation" section to install the binary.
Installing OpenWRT on a WRT54GL
When you take your WRT54GL out of the box, it will be preloaded with a web-based admin GUI. This GUI's firmware upgrade feature will be used to install OpenWRT
Downloading OpenWRT
A copy of the current FabFi firmware binary is always available [directly from us]. As of this posting it is identical to the OpenWRT 8.09.1 "kamikaze" release, which can be downloaded here:
http://downloads.openwrt.org/kamikaze/8.09.1/brcm-2.4/openwrt-wrt54g-squashfs.bin
If you are looking for the binary associated with a particular release, take a look at our [distribution page].
Save the binary to your local machine.
Updating your Router's Firmware to OpenWRT
- Plug your PC or laptop into one of the four LAN ports on the WRT54G. If you have WiFi or a second ethernet port on your computer, disable it.
- Open a browser and go to http://192.168.1.1
- Enter default user name and password (<blank> / admin)
- Go to 'Administration' tab
- Go to 'Firmware Upgrade' subtab
- Click 'Browse' and enter the .bin file you downloaded
- Click upgrade. The Power LED on the WRT54G should start flashing and continue to do so until the firmware upgrade is complete.
- Wait for router to reboot
- Close browser
Upgrading From Earlier Versions of OpenWRT (This is mostly relevant when upgrading from FF1.0)
- Download the openWRT binary to your computer as explained above.
- Boot into failsafe mode by pressing the reset button on the back of the case as soon as the DMZ light comes on during router boot-up. Hold the button until both the power and DMZ lights are flashing.
- Temporarily change your computer to a static IP address in your computer's "Network Preferences" under "manual". Type in 192.168.1.0 for the IP address space and 192.168.1.1 for the gateway (if there is that field).
- Plug in an ethernet cable from your computer to the router's LAN port
- Telnet into the router and type
firstboot
- When the command returns, power down the router
- For windows users, open a command prompt and type:
tftp -i 192.168.1.1 PUT <path to binary on your computer>
Then you need some timing...
- Power up the router and about a half second after all the lights flash on, hit enter in your command window. If you are successful, the light for your LAN port will blink a whole bunch and the command will return with some sort of success message. DO NOT POWER OFF YOUR ROUTER BEFORE IT IS FULLY BOOTED (unless you need more doorstops).
- When everything is all booted up, you now have a default-config 8.09.1 box.
- Don't forget to change the IP address setting of your computer back to the way it was. This was probably "Auto DHCP" or something similar.
- All other OS users (including windows users who don't like my explanation) follow the instructions here: http://oldwiki.openwrt.org/OpenWrtDocs(2f)Installing(2f)TFTP.html
Configuring the Router
OpenWRT, being a linux based firmware, holds all of its configuration variables (that you care about) in plain text files. The files we change from the default build are too numerous to list here, but you can see what is changed by reading the config script
To edit files manually, one must log on to the router using telnet or SSH (depending on whether or not you've set a password already). This is generally not necessary to get things running.
The FabFi Config Script
If you were an average person configuring an OpenWRT router, you would log into the the device with telnet or SSH and manually edit the files listed above with
vi
you would also install software with
ipkg
and set your password using
passwd
Savvy users might even use the [uci interface], for which you can find a reference [here], though there are some peculiarities it does not explain. (check out the source of our config script to see some of the common ones. We use uci to set all of our variables)
Because there is a significant amount of stuff to change, we have written a shell script that walks through the entire configuration step by step. It will prompt the user to name the link, set a password and download required software. Based on the link name provided, the script selects IP addresses using our Addressing Scheme. After completing the script for two or more nodes, the link is ready to deploy.
Your First-Ever Login
Once OpenWRT has been installed on your router you be able to connect directly to the router with a command shell. For your first login ONLY, you will use telnet. For linux users, simply type:
telnet 192.168.1.1
in your terminal (you should already to be connected to the router through one of the LAN ports and the router should be powered on)
If you're a windows user, you can type a similar command at your command prompt, but because you'll need SSH for all of the following steps, you should download a telnet/SSH client now. We use PuTTY, which can be found here:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Once you've downloaded PuTTY, select the telnet radio button in its login window and type the ip (192.168.1.1) into it's Host Name field.
Once you're telnetted in, you'll see the OpenWRT splash screen and a command prompt.
Downloading and Running the Config Script
- Plug a network cable into the WAN (labeled 'Internet') port on your router that's connected to the internet
- Plug a second network cable into PORT 4 of the router and then into your computer. If you do not use port 4 you will not be able to communicate with the router after the configuration script completes and you reboot the router.
- If you haven't already telnetted into your router do so as explained above. (for routers that have already had the password set, you must use SSH)
- Download the config script to your router following command
cd /tmp && wget http://fabfi.fabfolk.com/download/software/base_config/2_1/fabfi-setup
- see below for offline installs
- run the script by typing
sh fabfi-setup
if you have trouble running the script type
chmod +x fabfi-setup
and try running the script again
- Follow the instructions in the script. It will ask you for the following:
- if you need to download config files. If you have not manually placed fabfi-files.tgz in the /tmp/setup directory, or run fabfi-setup answering 'y' here since the last reboot you should answer 'y'.
- Wireless Channel (must be the same for any two nodes you intend to talk over a wireless link) See HERE for more information about slecting channels.
- Longest expected distance between this node and it's farthest direct neighbor
- WEP key (must be the same for any two nodes talking directly over wireless. TYPE 'd' to use the default WEP key.)
- Number of the Fabfi (should be unique for every node in the network)
- Determines IP addresses for the device.
- The script will prompt you to enter a root password. You will need to use it to log in from now on, so don't forget it.
Remember that if you attempt to configure the router via ethernet, you MUST be plugged into PORT 4, otherwise you will not be able to communicate with the router.
You're done!
WARNING: if you abort the script after you see the list of settings printed out but before you set a password, you will have to use ssh and the password cisco123 to log in the next time (see below for ssh commands). Everything else will work the same as above.
ADDITIONAL CONFIG NOTE: Our script adds a clone of the root user in case someone accidentally changes the root password and forgets it (it's a dirty hack, I know. We'll figure out a better solution at a later date). If you're creating your own system and don't want our username and password to let you into our system, just delete the 'fab' user in
/etc/passwd
Running the Script Offline
If you won't have access to the internet when configuring the router, you can run offline as long as fabfi-setup is in the /tmp directory and fabfi-files.tgz is in /tmp/setup For a new install of OpenWRT you will need to set a root password with the
passwd
command, then transfer the files using scp. On my Windows machine, I like to use WinSCP to transfer files.
Manual File Download
Don't like the config script? A tarball with everything you need for setup can be found at
http://fabfi.fabfolk.com/download/software/base_config/2_1/fabfi-files.tgz
place this file in
/tmp/setup
and unzip it with this command (warning: will overwrite files in your etc directory)
tar -C /tmp -xzf <path to tarball>
Upgrading from Fabfi 2.0
- If you are updating from the LAN
- Plug a network cable into the WAN (labeled 'Internet') port on your router that's connected to the internet
- Plug a second network cable into PORT 4 of the router and then into your computer.
(NOTE: You can try to update from the network, but I haven't tested the remote reboot)
- If you haven't already telnetted into your router do so as explained above. (for routers that have already had the password set, you must use SSH)
- Download the config script to your router following command
cd /tmp && wget http://fabfi.fabfolk.com/download/software/base_config/2_1/fabfi-update
- run the script by typing
sh fabfi-update
- Reboot your router when the script completes
Using the Web GUI to make manual changes
One of the most exciting features of OpenWRT 8 is that it comes with an integrated web GUI. (yes, Mr. Linux geek, GUIs are unnecessary overhead and prone to bugs, but sometimes you just don't want to leave your browser, K?).
Logging into the web GUI
In our setup, the web server on each node listens for connections on port
8080
in order to log in, you type thefollowing in your browser:
http://10.103.<FF#>.1:8080
where "<FF#>" is the number of your Fabfi. For example fabfi20 would be:
http://10.103.20.1:8080
you will then be prompted for a username and password. you should use your SSH username and password here.
Remember that if you attempt to configure the router via ethernet, you MUST be plugged into PORT 4!
GUI Configuration WARNING!!!!
- As of OpenWRT 8.09.1, there are a number of minor bugs in the web GUI, mainly having to do with things not getting updated when you click "save & apply". I'm not going to list all the bugs here (mainly because I'm not sure exactly what they all are), but beware that if it hasn't been explicitly tried and explained below, it may or may not work from the GUI.
- There are some relationships between settings (such as between channel, ESSID and BSSID) that are required for FabFi, but aren't captured in the GUI, so be sure you know what you're doing before you use the GUI to start changing things.
- Not everything has a GUI interface.
FabFi Specific configuration instuctions
All of the sections below detail settings changes I have tested from the web GUI. There are lots of things not listed here that also work, but make sure you test anything not listed here in a safe environment before working on a deployed node (especially if it's remote).
Changing the wireless channel
The wireless meshing protocol in FabFi depends on the BSSID to identify if a wireless signal is a member of it's mesh. There is a peculiar "feature" of the implementation that if a node hears from a neighboring node on boot using the correct BSSID it will switch it's wireless channel to that of the node it hears. It will then stay on this channel for perpetuity unless banged on really hard to switch. The resulting effect is that if you have one node on the wrong channel in a particular mesh, it is possible that over multiple reboots the entire network will switch to that channel (bad!!!). As a result, there must be a 1:1 correlation between the BSSID of the mesh and the channel of that mesh.
For every fabfi, the BSSID is set to:
##:fa:bf:1f:ab:f1
where ## is the channel of the network. For instance a network on channel 6 would be:
06:fa:bf:1f:ab:f1
ch 11 would be:
11:fa:bf:1f:ab:f1
For every fabfi, the ESSID is set to:
fabfi#
where ## is the channel of the network. For instance a network on channel 6 would be:
fabfi6
ch 11 would be:
fabfi11
When changing the wireless channel in the web GUI, one must change BOTH the channel and the BSSID at the same time. Here's how to do it:
- Log into the web GUI
- Click "Administration" on the top right
- Go to "Network > wireless > wl0"
- In the "Channel" section, select your channel
- In the ESSID section change the ESSID to end with the channel # as shown above
- In the BSSID section change the BSSID to start with the channel # as shown above
- Click "Save & Apply" and WAIT FOR THE PAGE TO RETURN.
- Power cycle your router (I am testing the way to ensure the channel is changed when doing remote admin and will post when done)
Tweaks for Weak Signals
NOTE: This is probably irrelevant in AD-Hoc mode, but it stays here as a placeholder for something you might want to check out:
By default, OpenWRT STAs are configured to search for new APs when the signal dips below -60dB. If you only have one SSID configured the setting probably doesn't really matter, but just in case, you can change this setting in the
/etc/init.d/custom-user-startup
file by adding the line
wl roam_trigger -##
where ## is the dB level below which you want the router to roam. For our bikg link in Jalalabad, I have this set at -87dB because the noise floor is so low, and our signal strength is nominally in the mid -70s
Logging into your configured router with SSH
Once you have set a password for your router, telnet will no longer be available. The next time you log in (and from now on) you must use SSH:
- from the web
ssh root@<external IP of router> (this is only used if you're connecting from the public internet)
- from the LAN (You must be plugged into PORT 4!)
ssh root@10.103.<FF#>.1 (this is the LAN IP, and best if you are directly connected to the router you are SSHing to)
or
ssh root@10.101.0.<FF#> (this is the MESH IP, and should be visible from anywhere inside the FabFi network)
or
ssh root@10.102.0.<FF#> (this is the WIFIMESHIP, and should be visible from anywhere inside the FabFi network)
For windows users, use PuTTY and select the SSH radio button.
Get the latest
Follow the play-by-play of new router stuff on the blog (filtered for Router Tech)
Wtgphoben: 13:28, 09 September 2010 (UTC)


