English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/freewrt_1_0/docs/handbook/user/handbook.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2547 - (show annotations) (download) (as text)
Sat May 19 10:36:16 2007 UTC (6 years, 9 months ago) by wbx
File MIME type: application/x-tex
File size: 59309 byte(s)
cleanup WLAN examples
1 \documentclass[12pt,a4paper,openany,smallheadings,headinclude,headsepline,final]{scrreprt}
2 %\usepackage{ucs} % Unicode support
3 \usepackage[utf8]{inputenc} % UTF-8 characters as input are allowed
4 %\usepackage{amsmath}
5 %\usepackage{amsfonts}
6 %\usepackage{amssymb}
7 %\usepackage{caption2}
8 \usepackage[english]{babel} % Sets the layout to English style
9 \usepackage{varioref} % Intelligent page references
10 %\usepackage{txfonts}
11 \usepackage[pdftex]{color} % Colour control for LaTeX documents
12 \usepackage[pdftex]{graphicx} % Enhanced support for graphics
13 %\usepackage{listings}
14 \usepackage{makeidx} % Standard LaTeX package for creating indexes
15 \usepackage{longtable} % Allow tables to flow over page boundaries
16 \usepackage[T1]{fontenc} % T1-fonts
17 \usepackage{fancyvrb} % Sophisticated verbatim text
18 \usepackage[a4paper,rmargin=2cm,lmargin=2cm,tmargin=2.5cm,bmargin=3.5cm]{geometry} % Flexible and complete interface to document dimensions
19 \usepackage{fixltx2e, mparhack} % Patches for LaTeX; A workaround for a LaTeX bug in marginpars
20 \usepackage[nofancy]{svninfo} % Typeset Subversion Keywords
21 \usepackage{float} % Improved interface for floating objects
22 \usepackage{hyperref} % Extensive support for hypertext in LaTeX
23
24
25 % marvosym macht Pfeil kaputt, also sichern
26 % line 28, /usr/share/texmf/tex/latex/marvosym/marvosym.sty
27 %\let\RescueRightarrow=\Rightarrow
28 %\usepackage{marvosym}
29 %\renewcommand{\Rightarrow}{\RescueRightarrow}
30
31 \definecolor{skyblue}{rgb}{0,0.3323,0.5720}
32 \restylefloat{figure}
33 \hypersetup{
34 colorlinks=true,anchorcolor=red,
35 breaklinks=true,linkcolor=blue,urlcolor=red,
36 citecolor=skyblue,
37 pdfauthor={The FreeWRT Team},
38 pdftitle={FreeWRT User Handbook},
39 pdfcreator={tetex and VIM},
40 pdfsubject={Open Source},
41 pdfview=FitV,
42 pdfstartview=FitV,
43 pdfstartpage={1},
44 pdfpagelayout=SinglePage,
45 pdfpagemode=None,
46 pdfkeywords={FreeWRT}
47 }
48 \fvset{fontsize=\small, frame=single} % fancyvrb: set small font size and enable frames
49 %\usepackage{cancel}
50 %\usepackage[final, activate, verbose=true]{microtype}
51 %\usepackage{ngerman}
52 %\usepackage{bookman}
53 %\usepackage[a4paper,twoside,rmargin=2cm,lmargin=2cm,tmargin=2.5cm]{geometry}
54 %\usepackage[a4paper,rmargin=2cm,lmargin=2cm,tmargin=2.5cm,bmargin=3.5cm]{geometry}
55 %\usepackage{ncntrsbk}
56 %\usepackage{float}
57 %\restylefloat{figure}
58 %\bibliographystyle{alphadin}
59 %\bibliographystyle{alpha}
60
61 % Generate index in preamble
62 \makeindex
63
64 \begin{document}
65 \svnInfo $Id$
66 \setlength{\marginparwidth}{10mm}
67
68 \include{cover}
69
70 \renewcommand{\thepage}{\roman{page}}
71 \tableofcontents
72 %Set Arabic Numbering 1,2,3,...
73 % Clear needed to renumber from the right position
74 \cleardoublepage
75 \renewcommand{\thepage}{\arabic{page}}
76 %Reset Counter
77 %\setcounter{page}{1}
78
79 % Set marks where it should Change
80 \renewcommand{\chaptermark}[1]{%
81 \markboth{\large \thechapter.\ \normalsize \scshape #1}{}}
82 \renewcommand{\sectionmark}[1]{\markright{\thesection.\ \scshape #1}}
83
84
85 % Create some new commands for designing the text
86 % applications
87 \newcommand{\app}[1]{%
88 \textsf{\textit{#1}}}
89 % terminology, vendor or product names
90 \newcommand{\term}[1]{%
91 \textsc{#1}}
92 % filenames and directories
93 \newcommand{\file}[1]{%
94 \textsf{#1}}
95 % user input
96 \newcommand{\command}[1]{%
97 \texttt{\textbf{#1}}}
98 % example code, output of applications
99 \newcommand{\code}[1]{%
100 \texttt{#1}}
101 % emphasized text (nicer than \emph{})
102 \newcommand{\strong}[1]{%
103 \textbf{#1}}
104
105
106 \chapter{Introduction}
107
108 Welcome to FreeWRT! This handbook covers the building, installation and usage
109 aspects of the FreeWRT 1.0 Linux distribution. FreeWRT is a portable, secure
110 and functional Linux distribution for embedded systems. As FreeWRT is a source
111 code distribution, it does not provide any pre-compiled firmware for embedded
112 systems. The latest version of this document is always available at the FreeWRT
113 website. If you have any comments, criticism or found some wrong description,
114 please send us an e-mail to
115 \href{mailto:freewrt-handbook@freewrt.org}{freewrt-handbook@freewrt.org}, we
116 are always happy about getting feedback to this document, and will try to
117 update or correct the issues mentioned by you.
118
119 The FreeWRT User handbook is split into several distinct chapters.
120 \nameref{ch:ADK} covers the building of FreeWRT firmware images. In
121 \autoref{ch:installing}, \nameref{ch:installing}, all aspects regarding the
122 installation and deinstallation of FreeWRT firmware images are covered. The
123 next chapter, \nameref{ch:administration}, covers administrational tasks, such
124 as network configuration, the FreeWRT configuration filesystem, package
125 management and update mechanism. The last chapter,
126 \nameref{ch:troubleshooting}, helps troubleshooting problems and recovering a
127 bad firmware installation. The appendix contains board specific information.
128 For FreeWRT 1.0 these are only Broadcom based embedded systems.
129
130 The intended audience for this handbook are advanced users with basic knowledge
131 about Linux, networking and software development. The reader should be aware of
132 basic command line tools, the vi editor and a shell. FreeWRT does not contain
133 any high level administration tools (e.g. web based administration) and is
134 fully configured via command line.
135
136 \section{Typographic Conventions}
137
138 Examples starting with \code{\#} indicate a command that must be invoked as
139 super user. You can use \command{su} to gain super user privileges.
140
141 \begin{Verbatim}[label=example for a command line with super user privileges]
142 # fwcf commit
143 \end{Verbatim}
144
145 Examples starting with \code{\$} indicate a command that can be invoked as a
146 normal user. The default user account on a freshly installed FreeWRT system is
147 "\code{admin}", the password "\code{FreeWRT}".
148
149 \begin{Verbatim}[label=example for a command line as non-privileged user]
150 $ cat /etc/banner
151 \end{Verbatim}
152
153 %\chapter{Web Interface Builder (WIB)}\label{ch:WIB}
154 %
155 %FIXME It is named later in the text, but not explained what it is. Probably
156 %this chapter can be joined with the chapter about ADK
157
158 \chapter{Appliance Development Kit (ADK)}\label{ch:ADK}
159
160 The ADK is the core of FreeWRT and contains all scripts and sources to create
161 firmware images for every supported embedded system. FreeWRT 1.0 supports the
162 following embedded systems:
163
164 \begin{itemize}
165 \item Asus WL500g
166 \item Asus WL500g deluxe
167 \item Asus WL500g premium
168 \item Linksys WRT54G v2.0
169 \item Linksys WRT54G v2.2
170 \item Linksys WRT54G v3.0
171 \item Linksys WRT54G v3.1
172 \item Linksys WRT54G v4.0
173 \item Linksys WRT54GS v1.0
174 \item Linksys WRT54GS v1.1
175 \item Linksys WRT54GS v4
176 \item Linksys WRT54G3G
177 \item Linksys WRT54GL
178 \item Netgear WGT634u
179 \end{itemize}
180
181 In this release we only support the Linux 2.4 kernel. The ADK contains over 600
182 software packages.
183
184 \section{Prerequisites}
185
186 Here is a list of all supported and tested host systems. The host system is
187 needed to create a firmware for your embedded system.
188
189 The list of supported GNU/Linux build systems is not an exclusive one, these
190 are just the ones tested and verified. The other millions of linux
191 distributions are very likely to work, too.
192
193 \begin{itemize}
194 \item Debian GNU/Linux
195 \item Gentoo Linux
196 \item OpenSuSE
197 \item Ubuntu GNU/Linux
198 \item Fedora Core
199 \item OpenBSD (partial support)
200 \footnote{some addon packages does not compile}
201 \item MirOS BSD (partial support)
202 \footnote{some addon packages does not compile}
203 \end{itemize}
204
205 Please install the following software, which is needed to build a basic
206 firmware image. If you choose more packages some more prerequisites might be
207 needed. The ADK host checks will warn you about any software you need to
208 install to compile a specific package. Here is a list of the required
209 software:
210
211 \begin{itemize}
212 \item gcc3 or higher
213 \item g++
214 \item binutils
215 \item patch
216 \item gzip
217 \item bzip2
218 \item unzip
219 \item flex
220 \item bison
221 \item GNU make
222 \item zlib (+headers)
223 \item ncurses (+headers)
224 \item (g)libc headers
225 \item perl
226 \end{itemize}
227
228 The ADK scripts will check for the required versions of these tools in advance.
229
230 To build FreeWRT with the ADK it is recommended to have an unprivileged user.
231 Please \underline{never} build FreeWRT as super user. Because all necessary
232 source tarballs are downloaded from the internet automatically, your host
233 system needs a working internet connection.
234
235 \section{Getting the source}
236
237 Now go to a directory where you want to build the firmware. Depending on the
238 features you select you will need about 2.5--5 GB free disk space. This
239 includes the ADK itself, any source archives which will be downloaded and their
240 extracted copies (for compiling).
241
242 To get the latest stable FreeWRT ADK try one of these commands:
243 \begin{Verbatim}[label=Check out the 1.0-branch of FreeWRT ADK via HTTP protocol]
244 $ svn co http://www.freewrt.org/svn/tags/freewrt_1_0_x freewrt
245 \end{Verbatim}
246 \begin{Verbatim}[label=Check out the 1.0-branch of FreeWRT ADK via subversion protocol]
247 $ svn co svn://www.freewrt.org/itags/freewrt_1_0_x freewrt
248 \end{Verbatim}
249
250 The value $x$ is a place holder for the latest minor release number. Take a
251 look at our project page to find out which minor release number is the latest
252 one.
253
254 After successfully downloading, enter the directory:
255
256 \begin{Verbatim}
257 $ cd freewrt
258 \end{Verbatim}
259
260 This directory will be referred to as the ADK root later on.
261
262 \section{Some Theory First}
263
264 Building a FreeWRT firmware image is just like building a new Linux kernel, but
265 a little more complex. There is a \app{ncurses}-based configuration menu at the
266 beginning, the changes made are saved into a file named \file{.config} in the
267 ADK root. The build is done by the various Makefiles, compiling and linking the
268 sources together accordingly to the symbols defined in \file{.config}.
269
270 Unlike kernel compilation, FreeWRT needs to be cross-compiled. This leads to
271 special premises, as most of the tools need to be specially build. But no
272 panic, FreeWRT will do this all for you. In fact, this is done at the second
273 run of \command{make} (the first one opens the configuration), and therefore
274 can be seen as part of the first firmware build. For clarity though, we will
275 discuss these two things separately.
276
277 \section{Preparing the Build Process}
278
279 After downloading the FreeWRT ADK, it's time to prepare the ADK for the
280 building of firmware images (for explanations see the chapter above).
281
282 \subsection{Creating A Configuration}
283
284 The first step is to run \command{make}. After checking some prerequisites (see
285 \nameref{ch:troubleshooting} below for aid in problems), a console based
286 configuration menu should start. Theoretically no choices have to be made, but
287 it's proven useful to at least:
288 \begin{itemize}
289 \item select a target (menu: \code{Embedded System})
290 \item select the root filesystem type (menu: \code{Target Firmware type})
291 \end{itemize}
292
293 Then quit saving changes. If you forgot that, just run \command{make} again,
294 redo your changes, then save.
295
296 \subsection{Building ADK}
297
298 Now that you have a first minimal configuration, it is time to build the
299 toolchain for cross-compiling. To do this, just enter \command{make} again. The
300 build starts downloading and compiling each needed part of the toolchain, and
301 later continues with building the first firmware image. Later one can be taken
302 as proof of a working ADK.
303
304 Already experienced in compiling \app{gcc}? Then you know\dots If not, better
305 be told that it takes \underline{really long} to finish. In the meantime I
306 suggest reading the next chapter dealing with internals about cross-compiling.
307
308 \section{Details Of Cross-Compiling}
309
310 A cross-compile toolchain exists of a set of tools: a compiler, linker,
311 assembler, debugger and a C~library. A cross-compile toolchain runs on your
312 host system and creates native binaries for your target system. A cross-compile
313 toolchain is basically created in six steps:
314
315 \begin{enumerate}
316 \item Get and prepare the Kernel and C~library headers of your target system
317 \item Compile the binutils package for your target
318 \item Compile a static C~compiler for your target
319 \item Compile and install a C~library for your target
320 \item Compile and install a full C/C++~compiler
321 \item Compile and install the GNU debugger
322 \end{enumerate}
323
324 The cross-compile toolchain is created in
325 \file{staging\_dir\_\$(cpu\_arch)}\footnote{e.g. mipsel, which stands for MIPS
326 Little Endian}. All the tools running on the host, but used to create, analyze
327 or debug for the target are kept in this directory. All addon headers and
328 libraries are installed to this directory.
329
330 If you want to compile a simple application without using the ADK, just use the
331 compiler directly (e.g. compiling a MIPS Little Endian application):
332 \begin{Verbatim}[label=compile a simple application with the cross-compiler]
333 ./staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc -o myapp myapp.c
334 \end{Verbatim}
335
336 Check with the tool \app{file} if you got a MIPS binary:
337 \begin{Verbatim}[label=check the binary with \app{file}]
338 $ file myapp
339 myapp: ELF 32-bit LSB MIPS-I executable, MIPS, version 1 (SYSV), dynamically
340 linked (uses shared libs), not stripped
341 \end{Verbatim}
342
343 \section{Building A FreeWRT Firmware Image}
344
345 Your local copy of the FreeWRT ADK should now be prepared for building firmware
346 images. The next step is to do an extensive configuration for the image you
347 want to create. To start the configuration menu, type \command{make
348 menuconfig}.
349
350 When selecting packages, \code{<*>} means it will be inserted into the firmware
351 images and \code{<M>} means it will be build as an addon package which can be
352 installed later at runtime.
353
354 The target device and filesystem should already been chosen by you to the right
355 value, if not you will have to issue a \command{make clean} before actually
356 building the firmware image. Otherwise things get messed up. A smooth rebuild
357 is a missing feature in the current ADK. For the packages, if unsure, you can
358 just select one of the package collections. After that, you can still manually
359 check the choices made by the collection and correct them if appropriate. Do
360 not forget to save your configuration when leaving!
361
362 After leaving the menubased configuration, type \command{make} again to build
363 the new FreeWRT firmware image. Depending on your package selections and
364 underlying hardware, this will take different amounts of time. For your spare
365 time there is the following chapter giving some explanation about what is done
366 at this point.
367
368 \section{Firmware Build Process In Detail}
369
370 Just like when building the ADK's toolchain, the sources for the selected
371 packages are downloaded from the internet first, then built using the
372 cross-compiler and libraries of the ADK.
373
374 The detailed order of firmware image building is:
375
376 \begin{itemize}
377 \item compile the Linux kernel and all supported kernel modules
378 \item compile all selected packages
379 \item clean the target root directory
380 \item install all packages to the target root directory
381 \item create the root filesystem image
382 \item create the firmware image (bootloader, kernel and root
383 filesystem)
384 \end{itemize}
385
386 The result of the build process is created in the directory \file{bin/}. You
387 will find a firmware image in the top level directory. Check the size of the
388 binary image file to see if it is small enough to fit into flash memory of your
389 embedded system. Furthermore there is a directory \file{package/}, which
390 contains all base and add--on packages.
391
392 \section{Troubleshooting}
393
394 This section deals with various tips for problems with the ADK installation.
395
396 \subsection{Errors During Prerequisites Check}
397
398 To re-issue the checks, use \command{make prereq}.
399
400 \begin{itemize}
401 \item GNU make 3.80 too old \\
402 On a Fedora Core 4 hostsystem the first you'll get is
403 \begin{Verbatim}[label=error message with too old GNU make]
404 $ make
405 GNU make 3.80 too old.
406 Please install GNU make 3.81 or higher to continue.
407 You can override this check, see http://www.freewrt.org/faq for details.
408 It is suggested to upgrade your copy of bison to
409 GNU Bison 2.3 because of its bug fixes.
410 make: *** [.prereq_done] Error 1
411 \end{Verbatim}
412 it is quite a nice error that tells you to use more up to date software, but
413 we can anyhow give this hostsystem a try and tell make to ignore those
414 errors/warnings running \command{make prereq-noerror}.
415 \end{itemize}
416
417 \subsection{Compilation errors}
418
419 If you encounter any compilation errors, then first try to reproduce the error.
420 First update your ADK tree via \command{svn update}, to be sure that the error
421 is not already fixed in the subversion repository. After that do a
422 \command{make clean \&\& make}, to reproduce your problem.
423
424 If you can reproduce the problem, please file a bug report. Please always
425 report following information:
426 \begin{itemize}
427 \item Operating system type and version
428 \item GCC and Binutils versions of your host system
429 \item complete error message, not only the last 4 lines
430 \end{itemize}
431
432 \chapter{Installing FreeWRT Firmware Images}\label{ch:installing}
433
434 The FreeWRT ADK produces a single image holding both kernel and root
435 filesystem. This image can be written into your hardware's builtin flash memory
436 on serveral ways (ordered by needed skills, increasing downwards):
437 \begin{itemize}
438 \item via the original firmware's web interface
439 (\autoref{sec:webinterface})
440 \item via \texttt{mtd} when reflashing or migrating from another third
441 party distribution (\autoref{sec:mtd})
442 \item via network using a TFTP client (\autoref{sec:tftp})
443 \end{itemize}
444
445 \section{Flashing The Firmware}
446
447 \subsection{Web Interface Method}\label{sec:webinterface}
448
449 The following text describes how to use the original firmware's web interface
450 to flash FreeWRT. The object of demonstration is an \term{Asus WL500gP}, but
451 this guide should fit more or less fine for other systems, too.
452
453 If you flash a router from \term{Linksys}, we strongly suggest to use the
454 popular \term{ping exploit} to allow recovery, if your image is broken or the
455 flash process was interrupted by a power shortage.
456
457 There are some things that you should have done previously:
458 \begin{itemize}
459 \item read the special documentation page about your hardware in our wiki, some
460 systems need special precaution before flashing
461 \item a firmware image has to be built (matching the used hardware, of course)
462 \item the router has to be powered on
463 \item your computer needs to be connected to one of the LAN ports
464 (using IP address \file{192.168.1.2})
465 \end{itemize}
466
467 \parbox{17em}{
468 After preparation is complete, open your favourite browser and type
469 \command{192.168.1.1} into the address bar. You should reach the web
470 interface's startup page:
471 }\hfill\parbox{20em}{
472 \includegraphics[width=20em]{pics/asus-startup.png}
473 } \\ [1em]
474 \parbox{17em}{
475 Then click on \code{System Setup}:
476 }\hfill\parbox{20em}{
477 \includegraphics[width=20em]{pics/asus-system_setup.png}
478 } \\ [1em]
479 \parbox{17em}{
480 In the new menu click on \code{Firmware Upgrade}, and enter the name of your
481 firmware image into the appropriate field:
482 }\hfill\parbox{20em}{
483 \includegraphics[width=20em]{pics/asus-fw_upgrade.png}
484 } \\ [1em]
485 Finally click on \code{Upload}. As the whole process of writing the image to
486 flash and rebooting (don't forget that it creates \app{ssh} hostkeys on first
487 boot) takes quite long (yes, a couple of minutes). Better go and get a coffee
488 or tea.
489
490 When everything went well, you can login using \app{ssh}. The default username
491 is "\code{admin}". The default password for images created via WIB or ADK is
492 "\code{FreeWRT}". It is possible to change this password in the ADK, before
493 image creation.
494
495 \subsection{\texttt{mtd} -- The Flash Utility}\label{sec:mtd}
496
497 For this method to work, you need to copy the file containing the firmware
498 image to the router, preferably into \file{/tmp/}, the memory filesystem should
499 be big enough to hold the full image. If not, use \app{wget} to get the image
500 via http or ftp and pipe the result into \app{mtd}.
501
502 Then the image is written to flash using \app{mtd}, optionally giving
503 additional options (see below).
504
505 The \app{mtd} utility was written with simplicity and code size in mind. It's
506 features were derived from the
507 \href{http://sources.redhat.com/jffs2/}{\app{mtd-utils}}, combining the needed
508 parts into a single small tool providing all the functionality necessary for
509 FreeWRT, and leaving everything out that's not.
510
511 \app{mtd} provides the following features:
512 \begin{description}
513 \item[unlock] some chips need unlocking before they can be written to
514 \item[erase] this is a filesystem independent method to delete all
515 contents on the flash. Basically this is like \app{format} in
516 MS--DOS.
517 \item[write] this is generally the same functionality as using \app{dd}
518 or \app{rawrite}, but \app{mtd} takes care of the quirks that
519 have to be paid attention to for correctly handling the type of
520 flash in use
521 \end{description}
522
523 Further it can request your system to reboot. Some of the features mentioned
524 here can also be combined, so it is e.g. possible to immediately reboot the
525 system after the flash has been written.
526
527 Mostly, similar to the sample usage shown in the help output should be all that
528 has to be done to write the firmware to flash:
529 \begin{Verbatim}[label=write a previously downloaded new firmware-file into flash]
530 # mtd -e linux -r write freewrt.bin linux &
531 \end{Verbatim}
532 Or via wget pipe:
533 \begin{Verbatim}[label=download and write a new firmware-file into flash]
534 # wget -O - http://www.yourserver.com/freewrt.bin | mtd -e linux -r write - linux &
535 \end{Verbatim}
536 The parameters explained in detail:
537 \begin{description}
538 \item[\command{-e linux}] erase existing data in flash
539 \item[\command{-r}] trigger rebooting right after finishing work
540 \item[\command{write}] write the firmware image contained in the file
541 given as next parameter to flash
542 \item[\command{freewrt.bin}] the actual image to write -- ignore the
543 suffix, it is detected at runtime
544 \item[\command{linux}] this is an abstract identifier for a certain
545 partition in flash, so don't change this
546 \item[\command{\&}] put the process into background, to prevent
547 accidentally stopping
548 \end{description}
549
550 \subsection{Installation using TFTP}\label{sec:tftp}
551
552 All supported target devices are shipped with a builtin bootloader, comparable
553 to the BIOS of \term{x86} machines. This bootloader is used to bootstrap the
554 system until it can boot a regular operating system. Besides the ability to
555 load the executable code from flash, it can be received from another node in
556 the local area network via the famous TFTP protocol.
557
558 For doing this, there are two ways:
559 \begin{itemize}
560 \item the device acts as a client, asks the local \app{dhcpd} for a
561 lease, the address of the next \app{tftpd} and the filename to
562 download
563 \item the device acts as a server, having a known IP address and
564 waiting for any TFTP client to connect and send the file
565 \end{itemize}
566
567 Most of the hardware supported by FreeWRT 1.0 uses the second method. Only the
568 device \term{Netgear WGT634u} is using the first method, the bootloader
569 provides a DHCP/TFTP client. Though this may be a little confusing to people
570 being familiar with netboot technologies, it is definitely the easier way of
571 doing it. Otherwise one had to setup both DHCP and TFTP servers and configure
572 them right.
573
574 The even quite simple task of sending the flash image to the target device is
575 made even more easy by providing a little shell script for the job. Invocation
576 is as follows:
577 \begin{Verbatim}[label=sending the new firmware via TFTP]
578 $ ./scripts/flash.sh firmware.bin [address]
579 \end{Verbatim}
580 The second Parameter \code{address} is used to specify a different IP address
581 of the target device than the default \file{192.168.1.1}.
582
583 \strong{Beware:} do not rename the firmware image before flashing it using the
584 script as the original name is parsed to guess what hardware is to be flashed.
585
586 To actually being able to flash the device, it has to wait for a tftp
587 connection when booting. To complicate installation of third vendor's firmware
588 images and to improve bootup time, of course, this feature is disabled by
589 default. The following list shows what has to be done for a certain device to
590 get it to wait at boot: \\
591 \begin{center}
592 \begin{tabular}{l|l|p{7cm}} % TODO: fill this table
593 \strong{Target Device} & \strong{Action to be taken} & \strong{Comments} \\
594 \hline
595 All supported Linksys models & Ping Exploit & nvram variable \code{boot\_wait}
596 needs to be on \\
597 All supported Asus models & Recovery mode & power off $\rightarrow$ push and
598 hold the reset button $\rightarrow$
599 power on $\rightarrow$ power led is
600 flashing \\
601 \end{tabular}
602 \end{center}
603
604 \chapter{FreeWRT Administration}\label{ch:administration}
605
606 After the FreeWRT firmware image has been built by the ADK and later flashed
607 onto the hardware, the resulting operating system has to be configured. This
608 section provides the necessary information to do that, including tips and
609 guides for using FreeWRT in general, of course.
610
611 \section{Network Configuration}
612
613 <<<<<<< .mine
614 The device names for real network interfaces in Linux are named \code{ethx} (\code{x} is
615 \code{0--9}). If the device has a switch, the different ports are separated via VLAN
616 technology. The vlan interfaces are named \code{ethx.y}. The network configuration in
617 FreeWRT is managed via \app{Busybox}'s \app{ifupdown} implementation. \app{Busybox}'s builtin \app{ip}
618 command configures the network interfaces. There is no \app{ifconfig} or \app{route}, you can activate
619 it in the ADK menue, if you like.
620
621 =======
622 The device names for real network interfaces in Linux are named \code{ethx}
623 (\code{x} is \code{0--9}). If the device has a switch, the different ports are
624 separated via VLAN technology. The vlan interfaces are named \code{ethx.y}.
625 The network configuration in FreeWRT is managed via \app{Busybox}'s
626 \app{ifupdown} implementation. \app{Busybox}'s builtin \app{ip} command
627 configures the network interfaces. There is no \app{ifconfig} or \app{route}.
628 >>>>>>> .r2546
629 To show all configured network interfaces use:
630 \begin{Verbatim}[label=show IP address]
631 $ ip addr show
632 \end{Verbatim}
633 To show the kernel routing table use:
634 \begin{Verbatim}[label=show routing table]
635 $ ip route show
636 \end{Verbatim}
637
638 All available network settings can be found in \file{/etc/network/interfaces}
639 which has the common form:
640 \begin{Verbatim}[label=common form of \file{/etc/network/interfaces}]
641 auto <iface-name>
642 iface <iface-name> inet <method>
643 <option-x> <value>
644 <option-y> <value>
645 <option-z> <value>
646 \end{Verbatim}
647
648 <<<<<<< .mine
649 <b>ATTENTION: Be sure you have no whitespaces at the and of any value!</b>
650
651 \code{auto <iface-name>} is optional and, if set, tells the \app{ifup} script to
652 start this interface automatically on bootup.
653 =======
654 \code{auto <iface-name>} is optional and, if set, tells the \app{ifup} script
655 to start this interface automatically on bootup.
656 >>>>>>> .r2546
657
658 Each interface needs a unique name which, depending on the method, represents
659 either a physical interface or a logical interface name like \code{eth0.1} for
660 a physical VLAN or \code{umts} as a logical name for a PPP interface.
661
662 Possible methods are:
663 \begin{description}
664 \item[static] use the given options to configure the interface
665 statically
666 \item[dhcp] just start a dhcp client using the interface
667 \code{iface-name}
668 \item[manual] don't configure the interface but start \code{pre-up.d}
669 hook scripts
670 \item[ppp] run \code{pon <provider>} where \code{<provider>} is given
671 as an interface option
672 \end{description}
673
674 \subsection{Switch/VLAN}
675 The switch built-in into the most routers is capable of separating each port
676 using VLAN tagging. You can configure the switch by simply adding the interface
677 to the config file and giving the desired switch-ports:
678 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
679 auto eth0.0
680 iface eth0.0 inet static
681 switch-ports 1 2 5*
682 address 192.168.1.1
683 netmask 255.255.255.0
684
685 auto eth0.1
686 iface eth0.1 inet static
687 switch-ports 3 4 5
688 address 192.168.2.1
689 netmask 255.255.255.0
690
691 auto eth0.2
692 iface eth0.2 inet static
693 switch-ports 0 5
694 address 172.16.1.42
695 netmask 255.255.255.0
696 gateway 172.16.1.1
697 \end{Verbatim}
698
699 This configures three VLAN interfaces \code{eth0.0} on ports 1 and 2,
700 \code{eth0.1} on port 3 and 4 and \code{eth0.2} on port 0.
701
702
703 If you need to do some advanced settings, because you have for example a
704 powerful switch with a VLAN trunking port connected to one of your switch
705 ports, the configuration would look like this:
706
707 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
708 auto eth0.1
709 iface eth0.1 inet static
710 switch-ports 2 3 4 5*
711 address 192.168.1.1
712 netmask 255.255.255.0
713
714 auto eth0.2
715 iface eth0.2 inet static
716 switch-ports 1t 5
717 address 10.2.0.1
718 netmask 255.255.255.0
719 broadcast +
720
721 auto eth0.3
722 iface eth0.3 inet static
723 switch-ports 1t 5
724 address 10.3.0.1
725 netmask 255.255.255.0
726 broadcast +
727
728 auto eth0.4
729 iface eth0.4 inet static
730 switch-ports 1t 5
731 address 10.4.0.1
732 netmask 255.255.255.0
733 broadcast +
734
735 \end{Verbatim}
736
737 This configures four VLAN interfaces, \code{eth0.1} on physical ports 2, 3 and
738 4. The interfaces \code{eth0.2}, \code{eth0.3} and \code{eth0.4} are three
739 different networks with VLAN ID 2--4. The physical port 1 needs to be connected
740 to a VLAN trunking port on a switch with knows the same VLAN IDs.
741
742
743 Explanation:
744 \begin{description}
745 \item[port 0] this is typically the port labeled as WAN
746 \item[port 1--4] these are typically the ports labeled as LAN
747 \item[port 5] this special port represents the port where the
748 router--board is connected to the switch
749 \item[*] one interface always need an asterisk behind port 5 which
750 means it is the default interface and gets all the packages
751 with unknown tags.
752 \end{description}
753
754 \subsection{Static IP configuration}
755 As you can see in the VLAN example three interfaces were configured with static
756 IP settings, so these are the commonly used options:
757 \begin{description}
758 \item[address] the IP address --- required
759 \item[netmask] the netmask --- required
760 \item[broadcast] broadcast address --- only required for legacy
761 applications (if using \code{+}, it will be calculated
762 automatically by the kernel)
763 \item[gateway] an IP address added as default gateway if present
764 \item[mac-address] if you need to change your MAC address (required for
765 some DSL providers)
766 \end{description}
767
768 \subsection{DHCP}
769 That's just as simple as:
770 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
771 auto eth0.1
772 iface eth0.1 inet dhcp
773 switch-ports 0 5
774 \end{Verbatim}
775 Typically this configures the WAN-Port to start a DHCP request on bootup.
776
777 \subsection{WLAN}
778 A router containing a WLAN interface has an additional ethernet device
779 representing it. On Broad\-com-based hardware it is typically \code{eth1}
780 (\term{Linksys}),\code{eth2} (\term{Asus WL500gP}) or on \term{Netgear WGT634u}
781 which has a Madwifi WLAN chip, it is \code{ath0}, \code{ath1}, etc. You can use
782 these interfaces standalone or bridged with other devices, e.g. the internal
783 LAN.
784
785 \subsubsection{Basic Settings}
786
787 Mandatory options and default parameters are in bold font.
788
789 \begin{tabular}{l|l|p{10cm}}
790 \strong{Option} & \strong{Parameter} & \strong{Description} \\
791 \hline\hline
792 \code{\strong{type}} & \code{broadcom} & Broadcom based card \\
793 & \code{atheros} & Madwifi driver \\
794 \hline
795 \code{\strong{mode}} & \code{ap} & Access point mode \\
796 & \code{sta} & Client mode \\
797 & \code{adhoc} & Ad-Hoc mode \\
798 & \code{wds} & WDS point-to-point link over wireless\\
799 & \code{monitor} & The node acts as a passive monitor and
800 only receives packets \\
801 \hline
802 \code{\strong{ssid}} & \code{<String>} & Set the SSID (Network Name) \\
803 \hline
804 \code{country} & \code{\{ALL|DE|JP|US|\ldots\}} & The country code used
805 to determine the
806 regulatory settings. \\
807 \hline
808 \end{tabular}
809
810 \subsubsection{Security Settings}
811 \begin{longtable}{l|l|p{10cm}}
812 \strong{Option} & \strong{Parameter} & \strong{Description} \\
813 \hline\hline
814 \code{\strong{security}} & \code{none} & No authorization \\
815 & \code{wep} & WEP key \\
816 & \code{wpa-psk} & WPA with preshared key \\
817 & \code{8021x} & IEEE 802.1X authentication \\
818 \hline
819 \code{\strong{authorization}} & & \strong{wpa-psk} \\
820 & \code{psk} & WPA PSK \\
821 & \code{psk2} & WPA2 PSK \\
822 & \code{psk psk2} & WPA PSK and WPA2 PSK \\
823 & & \strong{8021x} \\
824 & \code{wpa} & WPA with RADIUS \\
825 & \code{wpa2} & WPA2 with RADIUS \\
826 & \code{wpa wpa2} & WPA and WPA2 \\
827 \hline
828 \code{\strong{encryption}} & & \strong{wep} \\
829 & --- & not needed, automatically by key size \\
830 & & \strong{wpa-psk} \\
831 & \code{tkip} & RC4 encryption \\
832 & \code{aes} & AES encryption \\
833 & \code{aes+tkip} & support both \\
834 & & \strong{8021x} \\
835 & \code{wep} & RC4 encryption (static) \\
836 & \code{tkip} & RC4 encryption \\
837 & \code{aes} & AES encryption \\
838 & \code{aes+tkip} & support both \\
839 \hline
840 \code{eap-type} & & \strong{8021x} \\
841 & \code{\strong{tls}} & Transport Layer Security \\
842 & \code{ttls} & Tunnelled TLS \\
843 & \code{peap} & Protected EAP \\
844 & \code{leap} & Cisco Wireless \\
845 \hline
846 \code{key} & & \strong{wep} \\
847 &\code{\{\strong{1}|2|3|4\}} & Select WEP key to use. \\
848 \hline
849 \code{key[1..4]} & & \strong{wep} \\
850 & \code{<String>} & WEP key. The key must be 5, 13 or 16
851 bytes long, or 10, 26, 32, or 64 hex
852 digits long. The encryption algorithm is
853 automatically selected based on the key
854 size. key1 is the key for WEP client mode.
855 \\
856 \hline
857 \code{wpa-key} & & \strong{wpa-psk} \\
858 & <String> & Password to use with WPA/WPA2 PSK (at least 8, up
859 to 63 chars) \\
860 \hline
861 \code{wpa-gtk-rekey} & & \strong{wpa-psk},
862 \strong{8021x} \\
863 & \code{<Int>} (\strong{3600}) & Rekeying interval in
864 seconds. \\
865 \hline
866 \code{\strong{radius-ipaddr}} & & \strong{8021x} \\
867 & \code{<a.b.c.d>} & IP to connect. \\
868 \hline
869 \code{radius-port} & & \strong{8021x} \\
870 & \code{<Int>} (\strong{1812}) & RADIUS-Port no. to connect
871 \\
872 \hline
873 \strong{radius-key} & & \strong{8021x} \\
874 & \code{<String>} & Shared Secret for connection to the
875 Radius server \\
876 \hline
877 \end{longtable}
878
879 \subsubsection{MAC filter}
880 \begin{tabular}{l|l|p{10cm}}
881 \strong{Option} & \strong{Parameter} & \strong{Description} \\
882 \hline\hline
883 \code{macmode} & \code{\{0|1|2\}} & 0: Disable MAC address matching. \\
884 & & 1: Deny association to stations on the MAC
885 list. \\
886 & & 2: Allow association to stations on the MAC
887 list. \\
888 \hline
889 \code{maclist} & \code{<MAC1> \ldots <MACn>} & List of space separated mac
890 addresses to allow/deny
891 according to \code{macmode}.
892 Addresses should be entered with
893 colons, e.g.:
894 "\code{00:02:2D:08:E2:1D
895 00:03:3E:05:E1:1B}"\\
896 \end{tabular}
897
898 \subsubsection{Wireless Distribution System (WDS)}
899 \begin{tabular}{l|l|p{10cm}}
900 \strong{Option} & \strong{Parameter} & \strong{Description} \\
901 \hline\hline
902 \code{lazywds} & \code{\{0|1\}} & Accept WDS connections
903 from anyone \\
904 \hline
905 \code{wds-bridge} & \code{br\{X\}} & Add WDS peers to bridge
906 brX \\
907 \hline
908 \code{wds-security} & \code{\{wpa-psk\}} & secure the wds bridge
909 with WPA (optional)\\
910 \hline
911 \code{wds-encryption} & \code{\{aes|tkip\}} & Use AES or TKIP as
912 cipher\\
913 \hline
914 \code{wds-wpa-key} & \code{<String>} & Password to use with WPA
915 PSK (at least 8, up to 63
916 chars) \\
917 \hline
918 \code{wds} & \code{<MAC1> \ldots <MACn>} & List of WDS peer mac
919 addresses
920 (\code{xx:xx:xx:xx:xx:xx},
921 space separated) \\
922 \hline
923 \end{tabular}
924
925 \subsubsection{Miscellaneous}
926 \begin{longtable}{l|l|p{10cm}}
927 \strong{Option} & \strong{Parameter} & \strong{Description} \\
928 \hline\hline
929 \code{channel} & \code{\{1--14\}} & The wifi channel \\
930 \hline
931 \code{maxassoc} & \code{\{1--255\}} & Maximum number of associated clients \\
932 \hline
933 % TODO: add descriptions to the different gmode settings
934 \code{gmode} & & Set the 54g Mode \\
935 & \code{\strong{Auto}} & default \\
936 & \code{LegacyB} & \\
937 & \code{GOnly} & \\
938 & \code{BDeferred} & \\
939 & \code{Performance} & \\
940 & \code{LRS} & \\
941 \hline
942 \code{frameburst} & \code{\{\strong{0}|1\}} & Disable/Enable frameburst mode. \\
943 \hline
944 \code{txpower} & \code{\{0--255|\strong{$-1$}\}} & Set the transmit power in dBm \\
945 \hline
946 \code{rate} & \code{<Int> (\strong{$-1$})} & force a fixed rate \\
947 & & valid values for 802.11a are (6,
948 9, 12, 18, 24, 36, 48, 54) \\
949 & & valid values for 802.11b are (1,
950 2, 5.5, 11) \\
951 & & valid values for 802.11g are (1,
952 2, 5.5, 6, 9, 11, 12, 18, 24, 36,
953 48, 54) \\
954 & & $-1$ means automatically determine
955 the best rate \\
956 \hline
957 \code{rts} & \code{\{0-2347\}} & Set the RTS threshhold. \\
958 \hline
959 \code{frag} & \code{\{256-2346\}} & Set the fragmentation
960 threshhold. \\
961 \hline
962 \code{afterburner} & \code{\{\strong{0}|1\}} & Enable Afterburner capability
963 \\
964 \hline
965 \code{isolate} & \code{\{\strong{0}|1\}} & Hide Clients from each other \\
966 \hline
967 \code{bridge-if} & \code{\{br0..brX\}} & The bridge interface (optional)
968 \\
969 \hline
970 \end{longtable}
971
972 \subsubsection{Examples for wireless configuration}
973
974 \paragraph{WLAN with WPA1/WPA2 AES+TKIP}
975
976 This combination works with any kind of WPA client implementation.
977
978 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
979 auto eth1
980 iface eth1 inet static
981 address 192.168.10.1
982 netmask 255.255.255.0
983 broadcast +
984 wireless-type broadcom
985 wireless-country DE
986 wireless-mode ap
987 wireless-ssid FreeWRT
988 wireless-security wpa-psk
989 wireless-authorization psk psk2
990 wireless-encryption aes+tkip
991 wireless-wpa-key 12345678
992 wireless-channel 11
993 \end{Verbatim}
994
995 If you want to do MAC filtering, add the following to the sample above:
996 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
997 wireless-macmode 2
998 wireless-mac 00:01:02:03:04:05 06:07:08:09:0a:0b
999 \end{Verbatim}
1000 this enables the filter and defines the list to contain addresses that should be allowed.
1001
1002 \paragraph{WLAN without encryption}
1003
1004 If you already use VPN to secure your connection, you can just use an unencrypted setup
1005 and setup the firewall on your embedded device.
1006
1007 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1008 auto eth1
1009 iface eth1 inet static
1010 address 192.168.10.1
1011 netmask 255.255.255.0
1012 broadcast +
1013 wireless-type broadcom
1014 wireless-country DE
1015 wireless-mode ap
1016 wireless-ssid FreeWRT
1017 wireless-security none
1018 wireless-channel 11
1019 \end{Verbatim}
1020
1021 \paragraph{WLAN client with WPA2 (AES)}
1022
1023 This can only be used in routing mode, you can not bridge it with LAN or WAN interfaces.
1024
1025 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1026 auto eth1
1027 iface eth1 inet static
1028 address 192.168.10.1
1029 netmask 255.255.255.0
1030 broadcast +
1031 wireless-type broadcom
1032 wireless-country DE
1033 wireless-mode sta
1034 wireless-ssid FreeWRT
1035 wireless-security wpa-psk
1036 wireless-authorization psk2
1037 wireless-encryption aes
1038 wireless-wpa-key 12345678
1039 \end{Verbatim}
1040
1041 WLAN with WDS nodes, the WDS nodes need to have the same
1042 SSID, channel and encryption parameters. The WDS connection is separetely
1043 secured via WPA1 and AES. WPA2 for WDS connection security is \_not\_ working.
1044
1045 WDS node 1 (MAC of Wireless \code{06:05:04:03:02:01})
1046 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1047 auto br0
1048 iface br0 inet static
1049 bridge-ifaces eth1
1050 address 192.168.10.1
1051 netmask 255.255.255.0
1052 broadcast +
1053 wireless-type broadcom
1054 wireless-country DE
1055 wireless-mode wds
1056 wireless-ssid FreeWRT-WDS
1057 wireless-security wpa-psk
1058 wireless-authorization psk psk2
1059 wireless-encryption aes+tkip
1060 wireless-wpa-key apkey
1061 wireless-lazywds 1
1062 wireless-wds-security wpa-psk
1063 wireless-wds-encryption aes
1064 wireless-wds-wpa-key wdskey
1065 wireless-wds 01:02:03:04:05:06
1066 wireless-wds-bridge br0
1067 \end{Verbatim}
1068 WDS node 2 (MAC of Wireless \code{01:02:03:04:05:06})
1069 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1070 auto br0
1071 iface br0 inet static
1072 bridge-ifaces eth1
1073 address 192.168.10.2
1074 netmask 255.255.255.0
1075 broadcast +
1076 wireless-type broadcom
1077 wireless-country DE
1078 wireless-mode wds
1079 wireless-ssid FreeWRT-WDS
1080 wireless-security wpa-psk
1081 wireless-authorization psk psk2
1082 wireless-encryption aes+tkip
1083 wireless-wpa-key apkey
1084 wireless-lazywds 1
1085 wireless-wds-security wpa-psk
1086 wireless-wds-encryption aes
1087 wireless-wds-wpa-key wdskey
1088 wireless-wds 06:05:04:03:02:01
1089 wireless-wds-bridge br0
1090 \end{Verbatim}
1091
1092 \paragraph{Peer-to-Peer/AdHoc mode (no encryption, IP must be static)}
1093 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1094 auto eth1
1095 iface eth1 inet static
1096 address 192.168.10.1
1097 netmask 255.255.255.0
1098 broadcast +
1099 wireless-type broadcom
1100 wireless-country DE
1101 wireless-mode adhoc
1102 wireless-ssid FreeWRT
1103 wireless-security none
1104 wireless-channel 11
1105 \end{Verbatim}
1106
1107 \subsection{Bridging}
1108
1109 This is mostly needed to combine LAN and WLAN to a homogeneous network.
1110 Be sure you have installed the package \app{bridge-utils}.
1111 See the example for a bridging setup, WLAN is secured via WPA/WPA2.
1112
1113 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1114 auto eth0.0
1115 iface eth0.0 inet manual
1116 switch-ports 1 2 3 4 5*
1117
1118 auto eth1
1119 iface eth1 inet manual
1120 wireless-type broadcom
1121 wireless-country DE
1122 wireless-mode ap
1123 wireless-ssid FreeWRT
1124 wireless-channel 11
1125 wireless-security wpa-psk
1126 wireless-authorization psk psk2
1127 wireless-encryption aes+tkip
1128 wireless-wpa-key MyWlanSecret
1129 wireless-bridge-if br0
1130
1131 auto br0
1132 iface br0 inet static
1133 bridge-ifaces eth0.0 eth1
1134 address 192.168.1.1
1135 netmask 255.255.255.0
1136 broadcast +
1137 \end{Verbatim}
1138
1139 This creates a new bridging interface \code{br0} which combines the VLAN
1140 interface \code{eth0.0} (representing the LAN-ports 1--4) and the WLAN interface
1141 \code{eth1} (on some devices like \term{Asus WL500gP} this might be \code{eth2}).
1142 The bridge interface needs always be the last one, otherwise it can not find
1143 the interfaces in \code{bridge-ifaces}.
1144
1145 \subsection{PPP}
1146
1147 PPP comes in various flavours for different situations, the most commonly
1148 needed will likely be DSL and for \term{WRT54G3G} users UMTS. So there exists a
1149 hook-script that evaluates a \code{use-template} option and generates a
1150 ppp-peer. This way everything needed so far can be configured within the
1151 \code{interfaces} file. Be sure you have installed the packages \app{kmod-ppp},
1152 \app{ppp} and \app{ppp-mod-pppoe}. For providers using PPTP for authentication,
1153 instead of PPPoE, you need to install \app{pptp}.
1154
1155 \subsubsection{DSL with PPPoE}
1156 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1157 auto ppp0
1158 iface ppp0 inet ppp
1159 use-template dsl
1160 provider foobar
1161 ppp-username 0001201234563200123456#0001@bar.de
1162 ppp-password bar
1163 ppp-device eth0.1
1164 \end{Verbatim}
1165
1166 Now your DSL connection will be started on boot (\code{auto ppp0}) and you can
1167 manually shut it down with \command{ifdown ppp0} or start it up with
1168 \command{ifup ppp0}. The template \code{dsl} will configure a typical PPPoE
1169 peer for you.
1170
1171 \subsubsection{DSL with PPTP}
1172 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1173 auto ppp0
1174 iface ppp0 inet ppp
1175 use-template pptp
1176 provider foobar
1177 ppp-username foo
1178 ppp-password bar
1179 ppp-modemip 10.0.0.1
1180 ppp-mtu 1480
1181 ppp-device eth0.1
1182 \end{Verbatim}
1183
1184 Now your DSL connection will be started on boot (\code{auto ppp0}) and you can
1185 manually shut it down with \command{ifdown ppp0} or start it up with
1186 \command{ifup ppp0}. The template \code{pptp} will configure a typical PPTP
1187 peer for you.
1188
1189 \subsubsection{UMTS}
1190 Same footprint different template and some specific options. That is all that
1191 is needed for an UMTS connection to Vodafone as it can be seen in this example.
1192 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1193 iface ppp0 inet ppp
1194 use-template umts
1195 provider umts
1196 #ppp-username ""
1197 #ppp-password ""
1198 ppp-device /dev/noz0
1199 umts-apn web.vodafone.de
1200 umts-pincode 1234
1201 umts-mode umts_first
1202 \end{Verbatim}
1203 As you can see: unneeded options like \code{ppp-username} or
1204 \code{ppp-password} can just be removed or commented out. Don't leave them
1205 without a value as that causes a failure in \app{ipup}. It does work if you
1206 give empty double quotes as value like \code{""}.
1207
1208 Note that you have to set the correct APN, username and password for your
1209 provider!
1210
1211 You may also remove the pin from your SIM-card and the configuration if you
1212 like.
1213
1214 For \term{Linksys WRT54G3G} a package called \app{broadcom-watchbutton} will be
1215 installed, this is a small daemon that monitors the UMTS-button of the router
1216 and executes \command{ifup umts} or \command{ifdown umts} on a button press.
1217 You have to set \code{watchbutton=YES} in /etc/rc.conf to have it start
1218 automatically.
1219
1220 This is totally independent from the \code{auto umts} setting. Even if you
1221 start the connection on bootup you can shut it down again with a button press.
1222
1223 \subsection{custom interface hooks}
1224 \subsubsection{per interface}
1225 You can execute various commands on interface startup or shutdown with special
1226 option:
1227 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1228 iface foobar inet static
1229 [...]
1230 pre-up <command>
1231 up <command>
1232 up <command>
1233 down <command>
1234 post-down <command>
1235 \end{Verbatim}
1236
1237 You can give each option multiple times and their commands will be executed in
1238 given order.
1239 \begin{description}
1240 \item[pre-up] before the interface will be started
1241 \item[up] after the interface was started successfully
1242 \item[down] before the interface goes down
1243 \item[post-down] after the interface shut down
1244 \end{description}
1245
1246 \subsubsection{general hooks}
1247 Additionally you can write scripts executed for each interface if you put them
1248 in
1249 \begin{itemize}
1250 \item \texttt{/etc/network/if-pre-up.d}
1251 \item \texttt{/etc/network/if-up.d}
1252 \item \texttt{/etc/network/if-down.d}
1253 \item \texttt{/etc/network/if-post-down.d}
1254 \end{itemize}
1255 Same semantics as above.
1256
1257 \section{FWCF - FreeWRT Configuration Filesystem}
1258
1259 FWCF is a separate flash partition for all changes made to the \file{/etc/}
1260 directory. There is a small tool named \app{fwcf}, which is used to setup the
1261 system or to commit changes to the fwcf partition.
1262
1263 On bootup the script \file{/sbin/mount\_root} is executed, which calls
1264 \command{fwcf setup} to setup \file{/etc/} as memory filesystem and overlay the
1265 changes committed to the fwcf partition.
1266
1267 If you change anything in \file{/etc/} and like to keep the change, it is
1268 required to execute \command{fwcf commit}. This will compress all changed or
1269 new files in \file{/etc/} and write the result into the fwcf partition. The
1270 fwcf partition is 128 Kb in size. This size is not changeable at the moment.
1271
1272 If you need more detailed information, please read the specification of FWCF,
1273 which can be found at
1274 \url{http://www.freewrt.org/trac/wiki/Documentation/Specs/FwCf}
1275
1276 If you want to remove all your changes and start your configuration from
1277 scratch, use \command{fwcf erase}. This is also required if you switch between
1278 compression plugins. Right now LZO plugin is default.
1279
1280 \section{IPKG - Packagemanagement}
1281
1282 All software for FreeWRT is available as a IPKG package. IPKG is a package
1283 manager very similar to Debian's \app{dpkg/apt-get} utilities. It is specially
1284 designed for embedded systems and is widely used. The FreeWRT project use a
1285 special version, which is embedded to the busybox binary. Normally the command
1286 line tool \app{ipkg} is pre-installed.
1287
1288 IPKG uses a configuration file similar to \file{/etc/apt/sources.list}, which
1289 contains a list of software repositories available via HTTP or FTP. The
1290 configuration file \file{/etc/ipkg.conf} contains the official FreeWRT 1.0
1291 repository for your board and kernel version.
1292
1293 To update the list of available packages execute following command as root:
1294 \begin{Verbatim}[label=update list of available packages]
1295 # ipkg update
1296 \end{Verbatim}
1297
1298 This command requires a working internet connection, because it will fetch a
1299 package list from every repository declared in \file{/etc/ipkg.conf}.
1300
1301 To install a new package use following command:
1302 \begin{Verbatim}[label=example installation of \app{tcpdump}]
1303 # ipkg install tcpdump
1304 \end{Verbatim}
1305
1306 This will install the package \app{tcpdump} and all dependencies onto the
1307 flash. Where the data is saved depends on the root filesystem you decided to
1308 use while installing FreeWRT. If you use jffs2 as root filesystem, then the
1309 package is installed on the big linux partition. If you use squashfs-overlay,
1310 then the package is installed on the mini-fo overlay filesystem which writes
1311 its data to the jffs2 data partition. If you use a squashfs-symlinks
1312 filesystem, then the package data is directly install into the jffs2 data
1313 partition, containing symlinks to the read-only squashfs partition.
1314
1315 You can also remove packages, but this is only useful if you are using jffs2 as
1316 root filesystem:
1317 \begin{Verbatim}[label=example removal of \app{tcpdump}]
1318 # ipkg remove tcpdump
1319 \end{Verbatim}
1320
1321 This will not remove any dependencies, installed earlier. For example,
1322 \app{libpcap} is still installed after executing this command. On jffs2 root
1323 filesystem you should never remove any essential packages like \app{busybox},
1324 \app{fwcf} or \app{uclibc}, otherwise you make the embedded system unusable.
1325
1326 Nearly the same as for removing packages, counts for \command{ipkg upgrade}.
1327 Please \strong{never ever} use \command{ipkg upgrade} to update your embedded
1328 system. This command is only useful to upgrade single packages on a jffs2
1329 rootfilesystem or data partition.
1330
1331 \section{Startup scripts}
1332
1333 Some of the available packages containing software which start services at boot
1334 time. For that we provide simple startup scripts, which are installed into the
1335 directory \file{/etc/init.d}. See following example for the package
1336 \app{dnsmasq}, a combined dns and dhcp server daemon:
1337
1338 \begin{Verbatim}[label=\file{/etc/init.d/S50dnsmasq}]
1339 #!/bin/sh
1340
1341 . /etc/rc.conf
1342
1343 case $1 in
1344 autostart)
1345 test x"${dns_dhcp:-NO}" = x"NO" && exit 0
1346 exec $0 start
1347 ;;
1348 start)
1349 [ -f /etc/dnsmasq.conf ] || exit
1350 /usr/sbin/dnsmasq
1351 ;;
1352 stop)
1353 killall dnsmasq
1354 ;;
1355 restart)
1356 $0 stop
1357 $0 start
1358 ;;
1359 *)
1360 echo "Usage: $0 {start | stop | restart}"
1361 ;;
1362 esac
1363 exit 0
1364 \end{Verbatim}
1365
1366 After installation the package postinst script will add all needed changes to
1367 the \file{/etc/} directory. For example packages can add new user and groups,
1368 add new variables to \file{/etc/rc.conf} or just add new values to existing
1369 files as \file{/etc/services}. It is FreeWRT policy not to start any services
1370 after installation or in case of a new boot. To start services on bootup you
1371 need to set \code{\$servicename=YES} in \file{/etc/rc.conf} and commit your
1372 changes via \command{fwcf commit}. For every policy exists an exception, we
1373 start all essential services by default, like ssh daemon, syslog and network
1374 initialisation.
1375
1376 For some services you can control the startup behaviour by modifying the
1377 \code{\$servicename\_flags} variable in \file{/etc/rc.conf}.
1378
1379 For example the variable \code{\$ssh\_opts} is provided as an argument to the
1380 dropbear ssh daemon to control its behaviour.
1381
1382 Having this policy helps you to configure your FreeWRT embedded system without
1383 shooting yourself in the foot. For example if you try to realize a firewall
1384 system and trying to set the rules in \file{/etc/firewall.user}, which is read
1385 by \file{/etc/init.d/S45firewall}, if the iptables package is installed. You
1386 can just reload the changed ruleset via \code{/etc/init.d/S45firewall restart}.
1387 If you managed to kick you out of the system, you can just reboot the system
1388 and you gain access again. As soon as your are ready with the firewall
1389 configuration and you decide to activate the firewall rules on bootup, you set
1390 \code{firewall=YES} in \file{/etc/rc.conf}, commit your changes via
1391 \command{fwcf commit} and reboot. Now the firewall rules will be activated on
1392 bootup.
1393
1394
1395 \chapter{Troubleshooting}\label{ch:troubleshooting}
1396
1397 \section{Failsafe Mode}
1398
1399 Failsafe mode is very useful if you misconfigured your embedded system, so that
1400 you can not access it anymore. E.g. if you accidentially disabled secure shell
1401 or misconfigured the firewall, so that you can not login any more.
1402
1403 When in failsafe mode, the device won't interpret any networking setup files.
1404 It stops even before the root filesystem gets mounted read--write, and fwcf is
1405 set up. It will just set the LAN interface up and give it the IP address
1406 \file{192.168.1.1} and netmask \file{255.255.255.0}. Then it will start a
1407 \app{telnet} daemon, so you get straight access (without depending on the
1408 installed SSH daemon).
1409
1410 \subsection{How It Works}
1411
1412 To get FreeWRT into failsafe mode you need physical access to the device and
1413 the failsafe utility. The failsafe utility is built inside our ADK and is
1414 available in the directory \file{bin/} after a successful build.
1415
1416 If you just want to compile the tool and not a complete firmware image, use
1417 following command:
1418
1419 \begin{Verbatim}[label=building the failsafe utility for the host system]
1420 $ make subdir=tools/failsafe install
1421 \end{Verbatim}
1422
1423 For some operating systems we provide ready to go binaries of failsafe.
1424 Take a look at \url{http://www.freewrt.org/downloads/tools/failsafe}
1425
1426 The tool just opens a network socket and waits for a special UDP packet
1427 from the embedded device. FreeWRT sends the UDP packet via the first
1428 recognized network interface (eth0).
1429
1430 \subsection{Enabling Failsafe Mode}
1431
1432 Connect your computer to the embedded system via direct or crossed network
1433 cable. Use the failsafe port (in most cases one of the LAN ports), see the
1434 device specific page for the exact network port.
1435
1436 Configure your network interface to the IP address \file{192.168.1.2} with
1437 network mask \file{255.255.255.0}. Now start the failsafe utility on your
1438 computer.
1439
1440 \begin{Verbatim}
1441 $ ./failsafe
1442 \end{Verbatim}
1443
1444 After that power on your embedded system and wait for the following message in
1445 your failsafe application running on your computer:
1446
1447 \begin{Verbatim}
1448 Press reset now to enter Failsafe!
1449 \end{Verbatim}
1450
1451 As soon as this message is displayed you should push the reset button of
1452 your embedded system. You have 2 seconds time to push the button. If you
1453 successfully enabled the failsafe mode, following message will be displayed:
1454
1455 \begin{Verbatim}
1456 Entering Failsafe!
1457 \end{Verbatim}
1458
1459 Now you should be able to login to your embedded system via a telnet
1460 application. Just use:
1461
1462 \begin{Verbatim}
1463 $ telnet 192.168.1.1
1464 \end{Verbatim}
1465
1466 \subsection{Repairing Your FreeWRT Configuration}
1467
1468 If you want to repair your configuration, you first need to mount the root
1469 filesystem read--writeable. This is best done via:
1470
1471 \begin{Verbatim}
1472 # mount_root
1473 \end{Verbatim}
1474
1475 After that you need to enable the FreeWRT configuration filesystem:
1476
1477 \begin{Verbatim}
1478 # fwcf setup
1479 \end{Verbatim}
1480
1481 Now you can change files in \file{/etc/} and repair your broken configuration.
1482 Do not forget to commit your changes afterwards.
1483
1484 \begin{Verbatim}
1485 # fwcf commit
1486 \end{Verbatim}
1487
1488 If you want to start over with the default \file{/etc/} directory, just remove
1489 the fwcf partition content with following command:
1490
1491 \begin{Verbatim}
1492 mtd erase fwcf
1493 \end{Verbatim}
1494
1495 You can either use \command{reboot -f} or the option \command{-r} for \app{mtd}
1496 to reboot the system.
1497
1498 %\section{Serial Console}
1499
1500 %\section{JTAG}
1501
1502 % Erstmal auskommentieren. Sind ja paar Seiten die erstmal keiner braucht
1503 %\begin{appendix}
1504 %\include{A-blaetter}
1505 %\end{appendix}
1506
1507 %\cleardoublepage
1508 %\addcontentsline{toc}{chapter}{\glossaryname}
1509 \end{document}

Properties

Name Value
svn:keywords Id

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20