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 2536 - (show annotations) (download) (as text)
Thu May 17 20:25:52 2007 UTC (6 years, 9 months ago) by n0-1
File MIME type: application/x-tex
File size: 56873 byte(s)
Integrate some latex improvements into the handbook

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

Properties

Name Value
svn:keywords Id

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