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