Changeset 6d2a418 in freewrt for docs


Ignore:
Timestamp:
Dec 5, 2006, 7:38:17 PM (19 years ago)
Author:
Phil Sutter <n0-1@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
62a8cfc
Parents:
94fa7ac
Message:

imported networking howto

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@1260 afb5a338-a214-0410-bd46-81f09a774fd1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/handbook/user/00-allinone.tex

    r94fa7ac r6d2a418  
    284284\end{Verbatim}
    285285\end{itemize}
     286
     287
     288\chapter{The FreeWRT Operating System}
     289After the FreeWRT firmware image has been built by the ADK and later flashed
     290onto the hardware, the resulting operating system has to be aministrated. This
     291section provides the necessary information to do that, including tips and
     292guides for using FreeWRT in general, of course.
     293
     294\section{Network Configuration}
     295The device names for real network interfaces in Linux are named ethx (x is
     2960-9). If the device has a switch, the different ports are separated via VLAN
     297technology. The vlan interfaces are named ethx.y.  The network configuration in
     298FreeWRT is managed via Busybox's ifupdown implementation. Busybox's ip builtin
     299command configures the network interfaces. There is no \texttt{ifconfig} or \texttt{route}.
     300To show all configured network interfaces use:
     301\begin{Verbatim}
     302$ ip addr show
     303\end{Verbatim}
     304To show the kernel routing table use:
     305\begin{Verbatim}
     306$ ip route show
     307\end{Verbatim}
     308
     309All available network settings can be found in \texttt{/etc/network/interfaces}
     310which has the common form:
     311\begin{Verbatim}[label=/etc/network/interfaces]
     312auto <iface-name>
     313iface <iface-name> inet <method>
     314  <option-x> <value>
     315  <option-y> <value>
     316  <option-z> <value>
     317\end{Verbatim}
     318
     319\texttt{auto <iface-name>} is optional and, if set, tells the "ifup" script to
     320start this interface automatically on bootup.
     321
     322Each interface needs a unique name which, depending on the method, represents
     323either a physical interface or a logical interface name like "eth0.1" for a
     324physical VLAN or "umts" as a logical name for a ppp interface.
     325
     326Possible methods are:
     327\begin{description}
     328\item[static] use the given options to configure the interface statically
     329\item[dhcp] just start a dhcp client using the interface \texttt{iface-name}
     330\item[manual] don't configure the interface but start pre-up.d hook scripts
     331\item[ppp] run \texttt{pon <provider>} where \texttt{<provider>} is given as an interface option
     332\end{description}
     333
     334\subsection{Switch/VLAN}
     335The switch built-in into the most routers is capable of separating each port
     336using VLAN tagging. You can configure the switch by simply adding the interface
     337to the config file and giving the desired switch-ports:
     338\begin{Verbatim}[label=/etc/network/interfaces]
     339auto eth0.0
     340iface eth0.0 inet static
     341    switch-ports 1 2 5*
     342    address 192.168.1.1
     343    netmask 255.255.255.0
     344
     345auto eth0.1
     346iface eth0.1 inet static
     347    switch-ports  3 4 5
     348    address 192.168.2.1
     349    netmask 255.255.255.0
     350
     351auto eth0.2
     352iface eth0.2 inet static
     353    switch-ports 0 5
     354    address 172.16.1.42
     355    netmask 255.255.255.0
     356    gateway 172.16.1.1
     357\end{Verbatim}
     358
     359This configures three VLAN interfaces \texttt{eth0.0} on ports 1 and 2,
     360\texttt{eth0.1} on port 3 and 4 and \texttt{eth0.2} on port 0.
     361
     362Explanation:
     363\begin{description}
     364\item[port 0] this is typically the port labeled as WAN
     365\item[port 1-4] these are typically the ports labeled as LAN
     366\item[port 5] this special port represents the port where the router-board is
     367        connected to the switch
     368\item[*] one interface always need an asterisk behind port 5 which means it is
     369        the default interface and gets all the packages with unknown tags.
     370\end{description}
     371
     372\subsection{Static IP configuration}
     373As you can see in the VLAN example three interfaces were configured with static
     374IP settings, so these are the commonly used options:
     375\begin{description}
     376\item[address] the IP address  - required
     377\item[netmask] the netmask     - required
     378\item[gateway] an IP address added as default gateway if present
     379\end{description}
     380
     381\subsection{DHCP}
     382That's just as simple as:
     383\begin{Verbatim}[label=/etc/network/interfaces]
     384auto eth0.1
     385iface eth0.1 inet dhcp
     386    switch-ports  0 5
     387\end{Verbatim}
     388Typically this configures the WAN-Port to start a DHCP request on bootup.
     389
     390\subsection{Bridging}
     391This is mostly needed to combine LAN and WLAN to a homogeneous network like:
     392\begin{Verbatim}[label=/etc/network/interfaces]
     393auto eth0.0
     394iface eth0.0 inet manual
     395    switch-ports 1 2 3 4 5*
     396
     397auto eth1
     398iface eth1 inet manual
     399    [... wifi-settings, see below ...]
     400
     401auto br0
     402iface br0 inet static
     403    bridge-ifaces eth0.0 eth1
     404    address 192.168.1.1
     405    netmask 255.255.255.0
     406\end{Verbatim}
     407This creates a new bridging interface \texttt{br0} which combines the VLAN
     408interface \texttt{eth0.0} (representing the LAN-ports 1-4) and the WLAN
     409interface \texttt{eth1} (on some devices like Asus WL500g or Linksys WRT54G
     410v1.1 this might be \texttt{eth2}).
     411
     412\subsection{WLAN}
     413A router containing a WLAN interface has an additional ethernet device
     414representing it. On Broadcom-based hardware it is typically \texttt{eth1}
     415(Linksys) or \texttt{eth2} (Asus) (in the current driver version), on Madwifi
     416devices it is \texttt{ath0}, \texttt{ath1}, etc. You can use these interfaces
     417standalone or bridged with other devices, e.g. the internal LAN.
     418
     419\subsubsection{Basic Settings}
     420$\star$ with Option means mandatory, $\star$ with Parameter means default.
     421
     422\begin{tabular}{l|l|l}
     423\textbf{Option} & \textbf{Parameter} & \textbf{Description} \\
     424\hline
     425type$\star$  & broadcom        & Broadcom based card \\
     426             & atheros         & Madwifi driver \\
     427mode$\star$  & ap              & Access point mode \\
     428             & sta             & Client mode \\
     429             & adhoc           & Ad-Hoc mode \\
     430             & wds             & WDS point-to-point link \\
     431             & monitor         & The node acts as a passive monitor and only receives packets \\
     432ssid$\star$  & <String>        & Set the SSID (Network Name) \\
     433country      & {ALL|DE|JP|US|...} & The country code used to determine the regulatory settings. \\
     434\end{tabular}
     435
     436\subsubsection{Security Settings}
     437\begin{tabular}{l|l|l}
     438\textbf{Option} & \textbf{Parameter} & \textbf{Description} \\
     439\hline
     440security$\star$ & none            & No authorization \\
     441             & wep             & WEP key \\
     442             & wpa-psk         & WPA with preshared key \\
     443             & 8021x           & IEEE 802.1X authentication \\
     444authorization$\star$ &            & \textbf{wep} \\
     445             & open            & Only Open System Authentication \\
     446             & shared          & Only Shared Key Authentication \\
     447             & open+shared$\star$ & Both Open System and Shared Key Authentication
     448                                 \\
     449             &                 & \textbf{wpa-psk} \\
     450             & psk             & WPA PSK \\
     451             & psk2            & WPA2 PSK \\
     452             & psk psk2        & WPA PSK and WPA2 PSK \\
     453             &                 & \textbf{8021x} \\
     454             & open            & Only Open System Authentication \\
     455             & shared          & Only Shared Key Authentication \\
     456             & wpa             & WPA with RADIUS \\
     457             & wpa2            & WPA2 with RADIUS \\
     458             & wpa wpa2        & WPA and WPA2 \\
     459encryption$\star$ &            & \textbf{wep} \\
     460             & -               & not needed, automatically by key size \\
     461             &                 & \textbf{wpa-psk} \\
     462             & tkip            & RC4 encryption \\
     463             & aes             & AES encryption \\
     464             & aes+tkip        & support both \\
     465             &                 & \textbf{8021x} \\
     466             & wep             & RC4 encryption (static) \\
     467             & tkip            & RC4 encryption \\
     468             & aes             & AES encryption \\
     469             & aes+tkip        & support both \\
     470eap-type     &                 & \textbf{8021x} \\
     471             & tls$\star$      & Transport Layer Security \\
     472             & ttls            & Tunnelled TLS \\
     473             & peap            & Protected EAP \\
     474             & leap            & Cisco Wireless \\
     475key          &                 & \textbf{wep} \\
     476             & \{1$\star$|2|3|4\}    & Select WEP key to use. \\
     477key[1..4]    &                 & \textbf{wep} \\
     478             & <String>        & WEP key.  The key must be 5, 13 or 16 bytes
     479                                 long, or 10, 26, 32, or 64 hex digits long.  The encryption
     480                                 algorithm is automatically selected based on the key size. key1 is
     481                                 the key for WEP client mode. \\
     482wpa-key      &                 & \textbf{wpa-psk} \\
     483             & <String>        & Password to use with WPA/WPA2 PSK (at least 8,
     484                                 up to 63 chars) \\
     485wpa-gtk-rekey &                & \textbf{wpa-psk}, \textbf{8021x} \\
     486             & <Int> (3600$\star$) & Rekeying interval in seconds. \\
     487radius-ipaddr$\star$ &             & \textbf{8021x} \\
     488             & <a.b.c.d>       & IP to connect. \\
     489radius-port  &                 & \textbf{8021x} \\
     490             & <Int> (1812$\star$) & RADIUS-Port no. to connect \\
     491radius-key$\star$ &                & \textbf{8021x} \\
     492             & <String>        & Shared Secret for connection to the Radius server \\
     493\end{tabular}
     494
     495\subsubsection{MAC filter}
     496\begin{tabular}{l|l|l}
     497\textbf{Option} & \textbf{Parameter} & \textbf{Description} \\
     498macmode      & {0|1|2}         & 0 - Disable MAC address matching. \\
     499             &                 & 1 - Deny association to stations on the MAC list. \\
     500             &                 & 2 - Allow association to stations on the MAC list. \\
     501maclist      & <MAC1> ... <MACn> & List of space separated mac addresses to
     502allow/deny according to ''macmode''. Addresses should be entered with colons,
     503e.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. \\
     504\end{tabular}
     505
     506\subsubsection{Wireless Distribution System (WDS) / Repeater / Bridge}
     507\begin{tabular}{l|l|l}
     508\texttt{Option} & \texttt{Parameter} & \texttt{Description} \\
     509lazywds      & {0|1}           & Accept WDS connections from anyone \\
     510wds          & <MAC1> ... <MACn> & List of WDS peer mac addresses (xx:xx:xx:xx:xx:xx, space separated) \\
     511\end{tabular}
     512
     513\subsubsection{Miscellaneous}
     514\begin{tabular}{l|l|l}
     515\textbf{Option} & \textbf{Parameter} & \textbf{Description} \\
     516channel      & {1-14}          & The wifi channel \\
     517maxassoc     & {1-255}         & Maximum number of associated clients \\
     518gmode        & {LegacyB| Auto$\star$| GOnly| BDeferred| Performance| LRS} & Set the 54g Mode \\
     519frameburst   & {0$\star$|1}        & Disable/Enable frameburst mode. \\
     520txpower      & {0-255|-1$\star$}   & Set the transmit power in dBm \\
     521rate         & <Int> (-1$\star$)   & force a fixed rate \\
     522             &                 & valid values for 802.11a are (6, 9, 12, 18, 24, 36, 48, 54) \\
     523             &                 & valid values for 802.11b are (1, 2, 5.5, 11) \\
     524             &                 & valid values for 802.11g are (1, 2, 5.5, 6, 9, 11, 12, 18, 24, 36, 48, 54) \\
     525             &                 &-1 means automatically determine the best rate \\
     526rts          & {0-2347}        & Set the RTS threshhold. \\
     527frag         & {256-2346}      & Set the fragmentation threshhold. \\
     528afterburner  & {0$\star$|1}        & Enable Afterburner capability \\
     529isolate      & {0$\star$|1}        & Hide Clients from each other \\
     530\end{tabular}
     531
     532\subsubsection{Examples}
     533WLAN with WEP128
     534\begin{Verbatim}
     535iface eth1 inet static
     536        address 192.168.10.1
     537        netmask 255.255.255.0
     538        wireless-type broadcom
     539        wireless-country DE
     540        wireless-mode ap
     541        wireless-ssid FreeWRT
     542        wireless-security wep
     543        wireless-key1 11223344556677889900112233
     544        wireless-channel 11
     545\end{Verbatim}
     546
     547WLAN without encryption                       
     548\begin{Verbatim}
     549iface eth1 inet static
     550        address 192.168.10.1
     551        netmask 255.255.255.0
     552        wireless-type broadcom
     553        wireless-country DE
     554        wireless-mode ap
     555        wireless-ssid FreeWRT
     556        wireless-security none
     557        wireless-channel 11
     558\end{Verbatim}
     559                                               
     560WLAN with WPA2 (AES)
     561\begin{Verbatim}
     562iface eth1 inet static
     563        address 192.168.10.1
     564        netmask 255.255.255.0
     565        wireless-type broadcom
     566        wireless-country DE
     567        wireless-mode ap
     568        wireless-ssid FreeWRT
     569        wireless-security wpa-psk
     570        wireless-authorization psk2
     571        wireless-encryption aes
     572        wireless-wpa-key 12345678
     573        wireless-channel 11
     574\end{Verbatim}
     575
     576If you want to do MAC filtering, add the following to the sample above:
     577\begin{Verbatim}
     578        wireless-macmode 2
     579        wireless-mac 00:01:02:03:04:05 06:07:08:09:0a:0b
     580\end{Verbatim}
     581this enables the filter and defines the list to contain addresses that should be allowed.
     582
     583To enhance wireless performance, you can enable some flags like Broadcom's SpeedBooster. Normally, these flags are not dangerous:
     584\begin{Verbatim}
     585        wireless-gmode performance
     586        wireless-frameburst 1
     587        wireless-afterburner 1
     588\end{Verbatim}
     589
     590WLAN client with WPA2 (AES) (''untested'')
     591\begin{Verbatim}
     592iface eth1 inet static
     593        address 192.168.10.1
     594        netmask 255.255.255.0
     595        wireless-type broadcom
     596        wireless-country DE
     597        wireless-mode sta
     598        wireless-ssid FreeWRT
     599        wireless-security wpa-psk
     600        wireless-authorization psk2
     601        wireless-encryption aes
     602        wireless-wpa-key 12345678
     603\end{Verbatim}
     604
     605WLAN client with WEP128
     606\begin{Verbatim}
     607iface eth1 inet dhcp
     608        wireless-type broadcom
     609        wireless-country DE
     610        wireless-mode sta
     611        wireless-ssid FreeWRT
     612        wireless-security wep
     613        wireless-key1 11223344556677889900112233
     614\end{Verbatim}
     615
     616Peer-to-Peer mode (no encryption, IP must be static)
     617\begin{Verbatim}
     618iface eth1 inet static
     619        address 192.168.10.1
     620        netmask 255.255.255.0
     621        wireless-type broadcom
     622        wireless-country DE
     623        wireless-mode adhoc
     624        wireless-ssid FreeWRT
     625        wireless-security none
     626        wireless-channel 11
     627\end{Verbatim}
     628
     629\subsection{PPP}
     630PPP comes in various flavours for different situations, the most commonly
     631needed will likely be DSL and for WRT54G3G users UMTS. So there exists a
     632hook-script that evaluates a "use-template" option and generates a ppp-peer.
     633This way everything needed so far can be configured within the
     634\texttt{interfaces} file.
     635
     636\subsubsection{DSL}
     637\begin{Verbatim}
     638auto ppp0
     639iface ppp0 inet ppp
     640        use-template dsl
     641        provider t-online
     642        ppp-username 0001201234563200123456#0001@t-online.de
     643        ppp-password fooBARfoo
     644        ppp-device eth0.1
     645\end{Verbatim}
     646
     647Now your t-online DSL connection will be started on boot (\texttt{auto ppp0})
     648and you can manually shut it down with \texttt{ifdown ppp0} or start it up with
     649\texttt{ifup ppp0}.
     650The template \texttt{dsl} will configure a typical PPPoE peer for you.
     651
     652\subsubsection{UMTS}
     653Same footprint different template and some specific options. That is all that
     654is needed for an UMTS connection to Vodafone as it can be seen in this example.
     655\begin{Verbatim}
     656iface ppp0 inet ppp
     657        use-template    umts
     658        provider        umts
     659        #ppp-username   ""
     660        #ppp-password   ""
     661        ppp-device      /dev/noz0
     662        umts-apn        web.vodafone.de
     663        umts-pincode    1234
     664        umts-mode       umts_first
     665\end{Verbatim}
     666As you can see: unneeded options like \texttt{ppp-username} or
     667\texttt{ppp-password} can just be removed or commented out. Don't leave them
     668without a value as that causes a failure in \texttt{ipup}. It does work if you
     669give empty double quotes as value like "".
     670
     671Note that you have to set the correct APN, username and password for your provider!
     672
     673You may also remove the pin from your SIM-card and the configuration if you like.
     674
     675For Linksys WRT54G3G a package called \texttt{broadcom-watchbutton} will be
     676installed, this is a small daemon that monitors the UMTS-button of the router
     677and executes \texttt{ifup umts} or \texttt{ifdown umts} on a button press.
     678You have to set \texttt{watchdog=YES} in /etc/rc.conf to have it start automatically.
     679
     680This is totally independent from the \texttt{auto umts} setting. Even if you
     681start the connection on bootup you can shut it down again with a button press.
     682
     683\subsection{custom interface hooks}
     684\subsubsection{per interface}
     685You can execute various commands on interface startup or shutdown with special option:
     686\begin{Verbatim}
     687iface foobar inet static
     688    [...]
     689    pre-up <command>
     690    up <command>
     691    up <command>
     692    down <command>
     693    post-down <command>
     694\end{Verbatim}
     695
     696You can give each option multiple times and their commands will be executed in given order.
     697\begin{description}
     698\item[pre-up] before the interface will be started
     699\item[up] after the interface was started successfully
     700\item[down] before the interface goes down
     701\item[post-down] after the interface shut down
     702\end{description}
     703
     704\subsubsection{general hooks}
     705Additionally you can write scripts executed for each interface if you put them in
     706\begin{itemize}
     707\item \texttt{/etc/network/if-pre-up.d}
     708\item \texttt{/etc/network/if-up.d}
     709\item \texttt{/etc/network/if-down.d}
     710\item \texttt{/etc/network/if-post-down.d}
     711\end{itemize}
     712Same semantics as above.
     713
Note: See TracChangeset for help on using the changeset viewer.