📄 users-guide.tex
字号:
\documentclass[10pt,fullpage]{article}\usepackage{pslatex}\newcommand{\mytt}[1]{{\texttt{#1}}}\newcommand{\bv}{\begin{verse}}\newcommand{\ev}{\end{verse}}\newcommand{\cmd}[1]{{\texttt{myprompt\# #1}}}\newcommand{\argdesc}[4]{\begin{description}\itemsep -6pt\item \textit{Number of Input Arguments:} #1\item \textit{Number of Returned Arguments:} #2\item \textit{Default Value:} #3\item \textit{Resets State Machine After Command:} #4\end{description}}\newcommand{\clicmd}[1]{{\textbf{\texttt{#1}}}}\newcommand{\cliparam}[1]{{\texttt{#1}}}\newcommand{\clival}[1]{{\emph{#1}}}\newcommand{\clidemo}[1]{{\texttt{wlan[0,0]-> #1}}}\newcommand{\clidemonobss}[1]{{\texttt{wlan0-> #1}}}\textwidth 6.5in\evensidemargin -0.25in\oddsidemargin -0.25in\topmargin 0in\textheight 9in\setcounter{tocdepth}{3}\setcounter{secnumdepth}{2}\usepackage{color}\definecolor{light}{gray}{.75}\newenvironment{example}{\begin{quote}\textbf{\textit{Example}:}}{\end{quote}}\begin{document}\title{Madwifi/Atheros Wireless Linux Driver Users Guide}\author{Protocols Group}\maketitle\tableofcontents\section{Configuring MadWifi using Wireless Extensions}This section describes the configuration of the Atheros wirelessdriver using the Wireless Extension Tools.\subsection{Using \mytt{iwconfig}}The generic \mytt{iwconfig} tool is used to set parameters whichcommon across most drivers. For a detailed description of\mytt{iwconfig}, please use \mytt{man iwconfig}. In this Section, wewill describe the use of iwconfig in the Madwifi driver. The formatsof the \mytt{iwconfig} command is:\bv\begin{tabular}{lll}\mytt{iwconfig} & --help & \\\mytt{iwconfig} & --version & \\\mytt{iwconfig} & [\textit{interface}] & \\\mytt{iwconfig} & \textit{interface} & [\mytt{essid X}] [\mytt{freq F}] [\mytt{channel C}] [\mytt{sens S}] [\mytt{ap A}] [\mytt{rate R}]\\& & [\mytt{rts RT}] [\mytt{frag FT}] [\mytt{txpower T}] [\mytt{enc E}] [\mytt{key K}] [\mytt{retry R}]\\\end{tabular}\evThe first form of the \mytt{iwconfig} command gives a brief helpmessage. The second form of the \mytt{iwconfig} command returns thecurrent version of \mytt{iwconfig} along with the version of thewireless extensions with which it was built.In the third form of the \mytt{iwconfig} command, the current wirelessstatus of the \textit{interface} is returned. If no\textit{interface} is specified, the current wireless status of everynetwork interface is returned. Non-wireless devices will not returnany wireless status.The last form of the \mytt{iwconfig} command allows the user to changeany of the optional parameters. Only the parameters which you wish tochange need to be specified. Unspecified parameters will not bemodified. Each parameter is described below.\subsubsection{\mytt{essid} - ESSID or Network Name}Set the ESSID (also known as network name) to the given value. Instation mode, the driver will attempt to join the network with the sameESSID. In AP mode, the driver will use the parameter as the ESSID.\begin{example} The following command sets the ssid to ``Atheros Wireless Network'' on \mytt{ath0}: \bv \cmd{iwconfig ath0 essid "Atheros Wireless Network"}\\ \ev\end{example}\subsubsection{\mytt{freq}/\mytt{channel} - RF Frequency or Channel}Set the frequency or channel of the device to the given value. Valuesbelow 1000 are interpreted as channel numbers. Values above 1000 areinterpreted as frequency measured in Hz. For frequency values, thesuffix \mytt{k}, \mytt{M}, or \mytt{G} can be appended to the value tospecify kilohertz, Megahertz, and Gigahertz, so that \mytt{2.412G},\mytt{2412M}, and \mytt{2412000000} refer to the same frequency. Setting the channel to a specific value will override the private\mytt{mode} control described in Section~\ref{sec:iwprivs}.\begin{example} The following command sets the operating frequency to 5.2GHz: \bv \cmd{iwconfig ath0 freq 5.2G} \ev Either of the following commands set device to operate on channel 11: \bv \cmd{iwconfig ath0 freq 11}\\ \cmd{iwconfig ath0 channel 11} \ev\end{example}\subsubsection{\mytt{sens} - Sensitivity Threshold}Set the sensitivity threshold to the given value. This is the lowestsignal strength at which the packets are received. Currently, thisthreshold is not implemented and any returned value is meaningless.\subsubsection{\mytt{ap} - Use a Specific AP}Specify which AP the device should associate with. The supplied valueshould be the MAC address of the desired AP or any of the keywords\clival{any}, \clival{auto}, or \clival{off}.\begin{example} The following command instructs the \mytt{ath0} device to associate with the AP that has MAC address 00:03:7f:03:a0:0d. \bv \cmd{iwconfig ath0 ap 00:03:7f:03:a0:0d} \ev\end{example}\subsubsection{\mytt{rate} - Set the Data Transmit Rate}Set the bit rate for transmitted packets. The value is specified inbits per second and the values can be suffixed by \mytt{k}, \mytt{M}, or\mytt{G} for kilobits, megabits, and gigabits respectively. The value\mytt{auto} is also valid and causes the device to use the bit rateselected by the rate control module. It's also possible to supply thebit rate followed by \mytt{auto}, in which case the driver willautomatically select from the bit rates not exceeding that rate.\begin{example} The following commands sets the maximum bit rate to 36Mbs. Thus, the driver will automatically select the best rate less than or equal to 36Mbs. \bv \cmd{iwconfig ath0 rate 36M auto} \ev\end{example}\subsubsection{\mytt{rts} - Set the RTS/CTS Threshold}Set the minimum packet size for which the device sends an RTS using theRTS/CTS handshake. The parameter is the threshold in bytes or the\clival{off} keyword. If it's set to \clival{off} or the maximum packetsize, RTS/CTS will be disabled.\begin{example} The following command sets the minimum packet size to use the RTS/CTS handshake to 40. \bv \cmd{iwconfig ath0 rts 40} \ev\end{example}\subsubsection{\mytt{frag} - Set the Fragmentation Threshold}Set the maximum fragment size. The parameter is either the threshold inbytes, or the \clival{off} keyword, which disables fragmentation.\begin{example} The following command sets \mytt{ath0} to fragment all packets to at most 512 bytes. \bv \cmd{iwconfig ath0 frag 512} \ev\end{example}\subsubsection{\mytt{key/enc} - Manipulate WEP Encryption Keys and Mode}This parameter is used to manipulate the WEP key and authenticationmode. It can be used to set the key, change the key, select the activekey, enable and disable WEP, and set the authentication mode. Thedriver can store up to 4 keys. Each instance of the \mytt{key} commandmanipulates only one key. Thus, to change all 4 keys, 4 separatecommands must be used.The key value can be specified as is in the hexadecimal form. If anASCII string is used for the key value, prepend ``\mytt{s:}'' to thekey. To change a key other than the current key, prepend``[\mytt{index}]'' to the key value, where \mytt{index} is the number ofthe key you wish to change. To select which key is active, use``[\mytt{index}]'' without supplying any keys, where \mytt{index} is thedesired key number. Including the keywords \mytt{open} or\mytt{restricted} changes the authentication mode between openauthentication and restricted authentication. Use the \mytt{off}keyword to disable WEP.\begin{example} The following command sets the default key to be key 3: \bv \cmd{iwconfig ath0 key [3]} \ev The following command sets the default key to be the hex key 0xDEAD-BEEF-AA: \bv \cmd{iwconfig ath0 key DEAD-BEEF-AA} \ev The following command sets key 2 to the ASCII phrase ``password'' and sets the authentication type to open: \bv \cmd{iwconfig ath0 key [2] s:password open} \ev The following command disables WEP: \bv \cmd{iwconfig ath0 key off} \ev\end{example}\subsubsection{\mytt{txpower} - Set Transmit Power}Set the transmit power for data packets. Bare numbers are interpretedas values in dBm. If the number is followed by \clival{mW}, the valueis interpreted in milliwatts. The value can also be \clival{auto} forautomatic power control and \clival{off} for disabling the radiotransmission.\begin{example} The following command sets all data packets to transmit at either 30 dBm or the maximum allowed in the current regulatory domain: \bv \cmd{iwconfig ath0 txpower 30} \ev\end{example}\subsubsection{\mytt{retry} - Set Retry Limit}This parameter sets the maximum number of retries used in the softwareretry algorithm. Currently, the driver does not implement softwareretry, thus this parameter is meaningless.\subsection{Using \mytt{wlanconfig}}\label{sec:wlanconfig}The current MadWifi driver supports multiple APs and concurrentAP/Station mode operation on the same device. The devices arerestricted to using the same underlying hardware, thus are limited tocoexisting on the same channel and using the same physical layerfeatures. Each instance of an AP or station is called a Virtual AP(or VAP). Each VAP can be in either AP mode, station mode, ``special''station mode, and monitor mode. Every VAP has an associatedunderlying base device, which is created when the driver is loaded.Creating and destroying VAPs are done through the \mytt{wlanconfig}tool found in the MadWifi tools directory. Running the\mytt{wlanconfig} utility with no arguments returns a brief helpline. The format of the \mytt{wlanconfig} command takes two forms:\bv\mytt{wlanconfig} \clival{VAP} \mytt{create wlandev}\clival{Base Device} \mytt{wlanmode} \clival{mode}[\mytt{bssid}$\|$\mytt{-bssid}] [\mytt{nosbeacon}]\\\mytt{wlanconfig} \clival{VAP} \mytt{destroy}\evEvery Linux network device consists of a prefix followed by a numberindicating the device number of the network device. For instance, theethernet devices are named \mytt{eth0}, \mytt{eth1}, \mytt{eth2},etc. Each VAP which is created is also registered as a Linux networkdevice. The value \clival{VAP} can be either a prefix name of the Linuxnetwork device, or it can be the entire device name. For instance,specifying \clival{VAP} as \mytt{ath} lets the Linux kernel add thenetwork device as the next device with the prefix \mytt{ath}. Thus,the Linux kernel appends the proper number to the end to form the fulldevice name, e.g., \mytt{ath1} if \mytt{ath0} already exists.However, the full device name can also be specified. For instance,\clival{VAP} can also be \mytt{ath2}. In this case, the networkdevice \mytt{ath2} is registered, regardless of whether \mytt{ath1}exists.The \clival{Base Device} is the underlying wireless network devicename created when the driver is loaded. The MadWifi driver creates\mytt{wifi0}, \mytt{wifi1}, etc.\ as the underlying devices. Byspecifying the \clival{Base Device}, the VAP is created with the\clival{Base Device} as the parent device.The \clival{mode} is the operating mode of the VAP. The operatingmode of the VAP cannot be changed once it is created. In specialcases, the operatingmode of the VAP can be different from the operating mode of theunderlying parent device. The first VAP which is \emph{created} setsthe operating mode of the underlying device. If the first VAP isdeleted and a new VAP is created with a different operating mode thanthe original VAP, then the operating mode of the underlying device ischanged to the new operating mode. The valid operating modes andtheir descriptions are given in Table~\ref{tab:wlanOpMode}.\begin{table}[h*] \centering \begin{tabular}{|l|l|} \hline Mode & Description \\ \hline Auto & Auto select operating mode \\ Managed & Station mode for infrastructure networks\\ Master & AP mode \\ Monitor & Passive monitor (promiscuous) mode \\ \hline \end{tabular} \caption{\mytt{wlanconfig} Operating Modes} \label{tab:wlanOpMode}\end{table}Only one station VAP can exist on a device. If the station VAP is thefirst VAP created, then no other VAPs are allowed to be created. Ifthe first VAP created is in AP (Master) mode, then one station VAP isallowed to be created. In this case, other AP VAPs can also becreated after the station VAP. When AP and station VAPs coexist, the\mytt{nosbeacon} flag must be used when creating the station. Thisflag disables the use of hardware beacon timers for station modeoperation. This is necessary because concurrent AP and stationoperation implies the station should not modify the TSF clock for theAPs.Creating multiple VAPs typically implies that the MAC address of eachVAP is different. However, if the \mytt{-bssid} flag is used, thenthe MAC address of the underlying wireless device is cloned for theVAP being created.To destroy a VAP, the \mytt{wlanconfig} command is used with the\mytt{destroy} parameter. In this case, the full device name must beused, i.e.\ you must specify the entire name, not just the deviceprefix.\begin{example} If we wish to use the system as a station only, we would create a single station VAP once the driver is loaded. The following command creates a single station VAP named \mytt{ath0} on device \mytt{wifi0}: \bv \cmd{wlanconfig ath create wlandev wifi0 wlanmode sta} \ev Note that no other VAPs can be created since the we are assuming this is the first VAP created on \mytt{wifi0}. Since this is the first VAP created, we only need to specify \mytt{ath}, not \mytt{ath0}. However, the following command would also be correct: \bv \cmd{wlanconfig ath0 create wlandev wifi0 wlanmode sta} \ev The MAC address of the station VAP is the same as the underlying device's MAC address since it is the first VAP created.\end{example}\begin{example} Now, we wish to create two AP VAPs on device \mytt{wifi0}. The first device will have a cloned MAC address taken from the underlying device. The second VAP will have a ``virtual'' MAC address formed from the underlying device's MAC address. The first VAP will be \mytt{ath0} and the second device will be \mytt{ath2}. \bv \cmd{wlanconfig ath create wlandev wifi0 wlanmode ap}\\ \cmd{wlanconfig ath2 create wlandev wifi0 wlanmode ap} \ev\end{example}\begin{example} Now, we wish to create two AP VAPs on device \mytt{wifi0}. Both devices will have the same MAC address cloned from the underlying device. The first VAP will be \mytt{ath0} and the second VAP will be \mytt{ath1}. \bv \cmd{wlanconfig ath create wlandev wifi0 wlanmode ap -bssid}\\ \cmd{wlanconfig ath create wlandev wifi0 wlanmode ap -bssid} \ev\end{example}\begin{example} Now, we wish to create two AP VAPs and one station VAP. The AP VAPs will be \mytt{ath0} and \mytt{ath2} and the station VAP will be \mytt{ath1}. \bv \cmd{wlanconfig ath create wlandev wifi0 wlanmode ap}\\ \cmd{wlanconfig ath create wlandev wifi0 wlanmode sta nosbeacon}\\ \cmd{wlanconfig ath create wlandev wifi0 wlanmode ap} \ev
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -