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

Properties

Name Value
svn:keywords Id

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