CINXE.COM

WiFi/AdHoc - Debian Wiki

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" href="/htdocs/favicon.ico"> <script type="text/javascript" src="/htdocs/bugstatus.js"></script> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta name="robots" content="noindex,nofollow"> <title>WiFi/AdHoc - Debian Wiki</title> <script type="text/javascript" src="/htdocs/common/js/common.js"></script> <script type="text/javascript"> <!-- var search_hint = "Search"; //--> </script> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/debwiki/css/common.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="/htdocs/debwiki/css/screen.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="/htdocs/debwiki/css/print.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="/htdocs/debwiki/css/projection.css"> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/debian-wiki-1.0.css"> <!-- css only for MS IE6/IE7 browsers --> <!--[if lt IE 8]> <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/debwiki/css/msie.css"> <![endif]--> <link rel="alternate" title="Debian Wiki: WiFi/AdHoc" href="/WiFi/AdHoc?diffs=1&amp;show_att=1&amp;action=rss_rc&amp;unique=0&amp;page=WiFi%2FAdHoc&amp;ddiffs=1" type="application/rss+xml"> <link rel="Start" href="/FrontPage"> <link rel="Alternate" title="Wiki Markup" href="/WiFi/AdHoc?action=raw"> <link rel="Alternate" media="print" title="Print View" href="/WiFi/AdHoc?action=print"> <link rel="Up" href="/WiFi"> <link rel="Search" href="/FindPage"> <link rel="Index" href="/TitleIndex"> <link rel="Glossary" href="/WordIndex"> <link rel="Help" href="/HelpOnFormatting"> </head> <body lang="en" dir="ltr"> <div id="logo"><a href="https://www.debian.org" title="Debian Homepage"><img src="https://www.debian.org/Pics/openlogo-50.png" alt="Debian" width="50" height="61"></a></div> <div id="header"> <div id="wikisection"> <p class="section"><a href="/FrontPage" title="Debian Wiki Homepage">Wiki</a></p> <div id="username"><a href="/WiFi/AdHoc?action=login" id="login" rel="nofollow">Login</a></div> </div> <div id="navbar"> <ul id="navibar"> <li class="wikilink"><a href="/FrontPage">FrontPage</a></li><li class="wikilink"><a href="/RecentChanges">RecentChanges</a></li><li class="wikilink"><a href="/FindPage">FindPage</a></li><li class="wikilink"><a href="/HelpContents">HelpContents</a></li><li class="current"><a href="/WiFi/AdHoc">WiFi/AdHoc</a></li> </ul> </div> <form id="searchform" method="get" action="/WiFi/AdHoc"> <div> <input type="hidden" name="action" value="fullsearch"> <input type="hidden" name="context" value="180"> <label for="searchinput">Search:</label> <input id="searchinput" type="text" name="value" value="" size="20" onfocus="searchFocus(this)" onblur="searchBlur(this)" onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search"> <input id="titlesearch" name="titlesearch" type="submit" value="Titles" alt="Search Titles"> <input id="fullsearch" name="fullsearch" type="submit" value="Text" alt="Search Full Text"> </div> </form> <script type="text/javascript"> <!--// Initialize search form var f = document.getElementById('searchform'); f.getElementsByTagName('label')[0].style.display = 'none'; var e = document.getElementById('searchinput'); searchChange(e); searchBlur(e); //--> </script> <div id="logo"><a href="https://www.debian.org" title="Debian Homepage"><img src="https://www.debian.org/Pics/openlogo-50.png" alt="Debian" width="50" height="61"></a></div> <div id="breadcrumbs"><a href="/FrontPage" title="Debian Wiki Homepage">Wiki</a><span class="sep">/</span> </div> <ul class="editbar"><li><a href="/WiFi/AdHoc?action=login" id="login-1" rel="nofollow">Login</a></li><li class="toggleCommentsButton" style="display:none;"><a href="#" class="nbcomment" onClick="toggleComments();return false;">Comments</a></li><li><a class="nbinfo" href="/WiFi/AdHoc?action=info" rel="nofollow">Info</a></li><li><a class="nbattachments" href="/WiFi/AdHoc?action=AttachFile" rel="nofollow">Attachments</a></li><li> <form class="actionsmenu" method="GET" action="/WiFi/AdHoc"> <div> <label>More Actions:</label> <select name="action" onchange="if ((this.selectedIndex != 0) && (this.options[this.selectedIndex].disabled == false)) { this.form.submit(); } this.selectedIndex = 0;"> <option value="raw">Raw Text</option> <option value="print">Print View</option> <option value="RenderAsDocbook">Render as Docbook</option> <option value="show" disabled class="disabled">Delete Cache</option> <option value="show" disabled class="disabled">------------------------</option> <option value="SpellCheck">Check Spelling</option> <option value="LikePages">Like Pages</option> <option value="LocalSiteMap">Local Site Map</option> <option value="show" disabled class="disabled">------------------------</option> <option value="RenamePage" disabled class="disabled">Rename Page</option> <option value="DeletePage" disabled class="disabled">Delete Page</option> <option value="show" disabled class="disabled">------------------------</option> <option value="show" disabled class="disabled">Subscribe User</option> <option value="show" disabled class="disabled">------------------------</option> <option value="show" disabled class="disabled">Remove Spam</option> <option value="show" disabled class="disabled">Revert to this revision</option> <option value="PackagePages">Package Pages</option> <option value="show" disabled class="disabled">------------------------</option> <option value="Load">Load</option> <option value="Save">Save</option> <option value="SlideShow">SlideShow</option> </select> <input type="submit" value="Do"> </div> <script type="text/javascript"> <!--// Init menu actionsMenuInit('More Actions:'); //--> </script> </form> </li></ul> <h1 id="locationline"> <ul id="pagelocation"> <li><a href="/WiFi">WiFi</a></li><li><a href="/WiFi/AdHoc">AdHoc</a></li> </ul> </h1> </div> <div id="page" lang="en" dir="ltr"> <div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span> <span class="anchor" id="line-1"></span><span class="anchor" id="line-2"></span><p class="line867"><small><a href="/DebianWiki/EditorGuide#translation">Translation(s)</a>: English - <a href="/fr/WiFi/AdHoc">Fran莽ais</a> - <a href="/it/WiFi/AdHoc">Italiano</a></small> <span class="anchor" id="line-3"></span><hr /><p class="line874"> <span class="anchor" id="line-4"></span><span class="anchor" id="line-5"></span><p class="line867"> <h1 id="WiFi_Ad-hoc_Network">WiFi Ad-hoc Network</h1> <span class="anchor" id="line-6"></span><p class="line862">This page describes how to establish a decentralized WiFi network. <span class="anchor" id="line-7"></span><span class="anchor" id="line-8"></span><p class="line867"><div class="table-of-contents"><p class="table-of-contents-heading">Contents<ol><li> <a href="#WiFi_Ad-hoc_Network">WiFi Ad-hoc Network</a><ol><li> <a href="#Debian_Method">Debian Method</a></li><li> <a href="#Manual_Method">Manual Method</a></li><li> <a href="#Troubleshooting">Troubleshooting</a></li><li> <a href="#See_Also">See Also</a></li></ol></li></ol></div><p class="line874"> <span class="anchor" id="line-9"></span><span class="anchor" id="line-10"></span><p class="line862">A <a class="interwiki" href="https://en.wikipedia.org/wiki/Wireless_ad-hoc_network" title="WikiPedia">wireless ad-hoc network</a> - also known as Independent Basic Service Set (IBSS) - consists of local wireless devices (nodes) discovering each other and forming a network, each able to forward data for other nodes. An access point is not required for managing this communication. <span class="anchor" id="line-11"></span><span class="anchor" id="line-12"></span><p class="line862">In the following examples, two wireless LAN clients will be configured as ad-hoc network nodes with static IP addressing. Before continuing, install the <a class="interwiki" href="https://packages.debian.org/wireless-tools" title="DebianPkg">wireless-tools</a> package. <span class="anchor" id="line-13"></span><span class="anchor" id="line-14"></span><p class="line867"> <h2 id="Debian_Method">Debian Method</h2> <span class="anchor" id="line-15"></span><span class="anchor" id="line-16"></span><ol type="1"><li><p class="line862">On each node, open <tt>/etc/network/interfaces</tt> in a text editor: <span class="anchor" id="line-17"></span><span class="anchor" id="line-18"></span><span class="anchor" id="line-19"></span><pre><span class="anchor" id="line-1-1"></span>$ su <span class="anchor" id="line-2-1"></span># sensible-editor /etc/network/interfaces</pre><span class="anchor" id="line-20"></span></li><li>Define stanzas for each node's wireless interface, setting the network SSID and the device's operating mode to ad-hoc: <span class="anchor" id="line-21"></span><span class="anchor" id="line-22"></span><p class="line891"><em>Node A</em> <span class="anchor" id="line-23"></span><span class="anchor" id="line-24"></span><span class="anchor" id="line-25"></span><span class="anchor" id="line-26"></span><span class="anchor" id="line-27"></span><span class="anchor" id="line-28"></span><span class="anchor" id="line-29"></span><span class="anchor" id="line-30"></span><pre><span class="anchor" id="line-1-2"></span>auto wlan0 <span class="anchor" id="line-2-2"></span>iface wlan0 inet static <span class="anchor" id="line-3-1"></span> address 192.168.1.1 <span class="anchor" id="line-4-1"></span> netmask 255.255.255.0 <span class="anchor" id="line-5-1"></span> wireless-channel 1 <span class="anchor" id="line-6-1"></span> wireless-essid MYNETWORK <span class="anchor" id="line-7-1"></span> wireless-mode ad-hoc</pre><p class="line862"> <em>Node B</em> <span class="anchor" id="line-31"></span><span class="anchor" id="line-32"></span><span class="anchor" id="line-33"></span><span class="anchor" id="line-34"></span><span class="anchor" id="line-35"></span><span class="anchor" id="line-36"></span><span class="anchor" id="line-37"></span><span class="anchor" id="line-38"></span><pre><span class="anchor" id="line-1-3"></span>auto wlan0 <span class="anchor" id="line-2-3"></span>iface wlan0 inet static <span class="anchor" id="line-3-2"></span> address 192.168.1.2 <span class="anchor" id="line-4-2"></span> netmask 255.255.255.0 <span class="anchor" id="line-5-2"></span> wireless-channel 1 <span class="anchor" id="line-6-2"></span> wireless-essid MYNETWORK <span class="anchor" id="line-7-2"></span> wireless-mode ad-hoc</pre><span class="anchor" id="line-39"></span></li><li>Save the file and exit the editor. <span class="anchor" id="line-40"></span><span class="anchor" id="line-41"></span></li><li class="gap"><p class="line862">Raise the interface on each node: <span class="anchor" id="line-42"></span><span class="anchor" id="line-43"></span><pre><span class="anchor" id="line-1-4"></span># ifup wlan0</pre><span class="anchor" id="line-44"></span></li><li><p class="line862">Scan for ad-hoc cells in range (necessary for some drivers to trigger IBSS scanning): <span class="anchor" id="line-45"></span><span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><span class="anchor" id="line-48"></span><span class="anchor" id="line-49"></span><span class="anchor" id="line-50"></span><span class="anchor" id="line-51"></span><span class="anchor" id="line-52"></span><span class="anchor" id="line-53"></span><span class="anchor" id="line-54"></span><span class="anchor" id="line-55"></span><span class="anchor" id="line-56"></span><span class="anchor" id="line-57"></span><pre><span class="anchor" id="line-1-5"></span># iwlist wlan0 scan <span class="anchor" id="line-2-4"></span>wlan0 Scan completed : <span class="anchor" id="line-3-3"></span> Cell 01 - Address: 02:0F:B5:4F:74:ED <span class="anchor" id="line-4-3"></span> ESSID:&quot;MYNETWORK&quot; <span class="anchor" id="line-5-3"></span> Mode:Ad-Hoc <span class="anchor" id="line-6-3"></span> Frequency:2.412 GHz (Channel 1) <span class="anchor" id="line-7-3"></span> Quality=42/70 Signal level=-53 dBm Noise level=-95 dBm <span class="anchor" id="line-8-1"></span> Encryption key:off <span class="anchor" id="line-9-1"></span> Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s <span class="anchor" id="line-10-1"></span> 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s <span class="anchor" id="line-11-1"></span> 48 Mb/s; 54 Mb/s <span class="anchor" id="line-12-1"></span> Extra:bcn_int=100</pre><span class="anchor" id="line-58"></span></li><li><p class="line862">To test, ping node A from node B: <span class="anchor" id="line-59"></span><span class="anchor" id="line-60"></span><span class="anchor" id="line-61"></span><span class="anchor" id="line-62"></span><span class="anchor" id="line-63"></span><span class="anchor" id="line-64"></span><span class="anchor" id="line-65"></span><span class="anchor" id="line-66"></span><span class="anchor" id="line-67"></span><span class="anchor" id="line-68"></span><span class="anchor" id="line-69"></span><pre><span class="anchor" id="line-1-6"></span>you@nodeB$ ping 192.168.1.1 <span class="anchor" id="line-2-5"></span>PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. <span class="anchor" id="line-3-4"></span>64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.073 ms <span class="anchor" id="line-4-4"></span>64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.061 ms <span class="anchor" id="line-5-4"></span>64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.062 ms <span class="anchor" id="line-6-4"></span>64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.063 ms <span class="anchor" id="line-7-4"></span> <span class="anchor" id="line-8-2"></span>--- 192.168.1.1 ping statistics --- <span class="anchor" id="line-9-2"></span>4 packets transmitted, 4 received, 0% packet loss, time 3001ms <span class="anchor" id="line-10-2"></span>rtt min/avg/max/mdev = 0.061/0.064/0.073/0.010 ms</pre><span class="anchor" id="line-70"></span><span class="anchor" id="line-71"></span></li></ol><p class="line862">For general <tt>/etc/network/interfaces</tt> information, see the <a class="interwiki" href="https://manpages.debian.org/man/5/interfaces" title="DebianMan">interfaces(5)</a> man page. <span class="anchor" id="line-72"></span><span class="anchor" id="line-73"></span><p class="line867"> <h2 id="Manual_Method">Manual Method</h2> <span class="anchor" id="line-74"></span><ol type="1"><li><p class="line862">On each node, bring the wireless interface down, change the device's operating mode and SSID, then raise the interface: <span class="anchor" id="line-75"></span><span class="anchor" id="line-76"></span><span class="anchor" id="line-77"></span><span class="anchor" id="line-78"></span><span class="anchor" id="line-79"></span><pre><span class="anchor" id="line-1-7"></span>$ su <span class="anchor" id="line-2-6"></span># ifconfig wlan0 down <span class="anchor" id="line-3-5"></span># iwconfig wlan0 channel 1 essid MYNETWORK mode ad-hoc <span class="anchor" id="line-4-5"></span># ifconfig wlan0 up</pre><span class="anchor" id="line-80"></span></li><li><p class="line862">Scan for ad-hoc cells in range (necessary for some drivers to trigger IBSS scanning): <span class="anchor" id="line-81"></span><span class="anchor" id="line-82"></span><span class="anchor" id="line-83"></span><span class="anchor" id="line-84"></span><span class="anchor" id="line-85"></span><span class="anchor" id="line-86"></span><span class="anchor" id="line-87"></span><span class="anchor" id="line-88"></span><span class="anchor" id="line-89"></span><span class="anchor" id="line-90"></span><span class="anchor" id="line-91"></span><span class="anchor" id="line-92"></span><span class="anchor" id="line-93"></span><pre><span class="anchor" id="line-1-8"></span>iwlist wlan0 scan <span class="anchor" id="line-2-7"></span>wlan0 Scan completed : <span class="anchor" id="line-3-6"></span> Cell 01 - Address: 02:0F:B5:4F:74:ED <span class="anchor" id="line-4-6"></span> ESSID:&quot;MYNETWORK&quot; <span class="anchor" id="line-5-5"></span> Mode:Ad-Hoc <span class="anchor" id="line-6-5"></span> Frequency:2.412 GHz (Channel 1) <span class="anchor" id="line-7-5"></span> Quality=42/70 Signal level=-53 dBm Noise level=-95 dBm <span class="anchor" id="line-8-3"></span> Encryption key:off <span class="anchor" id="line-9-3"></span> Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s <span class="anchor" id="line-10-3"></span> 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s <span class="anchor" id="line-11-2"></span> 48 Mb/s; 54 Mb/s <span class="anchor" id="line-12-2"></span> Extra:bcn_int=100</pre><span class="anchor" id="line-94"></span></li><li>On each node, assign an IP address to the wireless interface: <span class="anchor" id="line-95"></span><span class="anchor" id="line-96"></span><p class="line891"><em>Node A</em> <span class="anchor" id="line-97"></span><span class="anchor" id="line-98"></span><pre><span class="anchor" id="line-1-9"></span># ifconfig wlan0 192.168.1.1 netmask 255.255.255.0</pre><p class="line862"> <em>Node B</em> <span class="anchor" id="line-99"></span><span class="anchor" id="line-100"></span><pre><span class="anchor" id="line-1-10"></span># ifconfig wlan0 192.168.1.2 netmask 255.255.255.0</pre><span class="anchor" id="line-101"></span></li><li><p class="line862">To test, ping node A from node B: <span class="anchor" id="line-102"></span><span class="anchor" id="line-103"></span><span class="anchor" id="line-104"></span><span class="anchor" id="line-105"></span><span class="anchor" id="line-106"></span><span class="anchor" id="line-107"></span><span class="anchor" id="line-108"></span><span class="anchor" id="line-109"></span><span class="anchor" id="line-110"></span><span class="anchor" id="line-111"></span><span class="anchor" id="line-112"></span><pre><span class="anchor" id="line-1-11"></span>you@nodeB$ ping 192.168.1.1 <span class="anchor" id="line-2-8"></span>PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. <span class="anchor" id="line-3-7"></span>64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.073 ms <span class="anchor" id="line-4-7"></span>64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.061 ms <span class="anchor" id="line-5-6"></span>64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.062 ms <span class="anchor" id="line-6-6"></span>64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.063 ms <span class="anchor" id="line-7-6"></span> <span class="anchor" id="line-8-4"></span>--- 192.168.1.1 ping statistics --- <span class="anchor" id="line-9-4"></span>4 packets transmitted, 4 received, 0% packet loss, time 3001ms <span class="anchor" id="line-10-4"></span>rtt min/avg/max/mdev = 0.061/0.064/0.073/0.010 ms</pre><span class="anchor" id="line-113"></span><span class="anchor" id="line-114"></span></li></ol><p class="line867"> <h2 id="Troubleshooting">Troubleshooting</h2> <span class="anchor" id="line-115"></span><ul><li>The default operating frequency/channel (2.412 GHz: channel 1) is frequently congested. Try using a different channel in the event of difficulties. <span class="anchor" id="line-116"></span></li><li>Wireless LAN devices compliant with IEEE 802.11 specifications will only support a maximum bit rate of 11 Mbit/s. <span class="anchor" id="line-117"></span><span class="anchor" id="line-118"></span></li></ul><p class="line867"> <h2 id="See_Also">See Also</h2> <span class="anchor" id="line-119"></span><ul><li><p class="line891"><a href="/WiFi/HowToUse">WiFi/HowToUse</a> <span class="anchor" id="line-120"></span></li><li><p class="line891"><a href="/WiFi">WiFi</a> <span class="anchor" id="line-121"></span></li><li><p class="line891"><a class="http" href="http://hostap.epitest.fi/">http://hostap.epitest.fi/</a> | <a class="interwiki" href="https://packages.debian.org/hostapd" title="DebianPkg">hostapd</a> is a daemon to turn a computer into an access point. <span class="anchor" id="line-122"></span><span class="anchor" id="line-123"></span></li></ul><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-124"></span><a href="/CategoryNetwork"><strong class="highlight">CategoryNetwork</strong></a> | <a href="/CategoryWireless">CategoryWireless</a> <span class="anchor" id="line-125"></span><span class="anchor" id="bottom"></span></div><div id="pagebottom"></div> </div> <div id="footer"> <p id="pageinfo" class="info" lang="en" dir="ltr">WiFi/AdHoc (<a class="nbinfo" href="/WiFi/AdHoc?action=info" rel="nofollow">last modified 2012-02-22 00:20:07</a>)</p> <ul id="credits"> <li>Debian <a href="https://www.debian.org/legal/privacy">privacy policy</a>, Wiki <a href="/Teams/DebianWiki">team</a>, <a href="https://bugs.debian.org/wiki.debian.org">bugs</a> and <a href="https://salsa.debian.org/debian/wiki.debian.org">config</a>.</li><li>Powered by <a href="https://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin</a> and <a href="https://moinmo.in/Python" title="MoinMoin is written in Python.">Python</a>, with hosting provided by <a href="https://www.man-da.de/">Metropolitan Area Network Darmstadt</a>.</li> </ul> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10