https://wiki.archlinux.org/api.php?action=feedcontributions&user=Doctaweeks&feedformat=atomArchWiki - User contributions [en]2024-03-29T07:22:40ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Software_access_point&diff=279647Software access point2013-10-24T23:15:09Z<p>Doctaweeks: Minor grammar correction</p>
<hr />
<div>[[ru:Software Access Point]]<br />
[[Category:Wireless Networking]]<br />
{{Article summary start}}<br />
{{Article summary text|Basic setup of wifi access point.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary wiki|Ad-hoc networking}}<br />
{{Article summary wiki|Internet Sharing}}<br />
{{Article summary end}}<br />
A software access point is used when you want your computer to act as an wifi access point for the local wireless network. It saves you the trouble of getting a separate wireless router.<br />
<br />
== Requirements ==<br />
<br />
* A nl80211 compatible wireless device (e.g. ath9k)<br />
<br />
== Overview ==<br />
<br />
Setting up an access point comprises two main parts:<br />
* Setting up the '''wifi link layer''', so that wireless clients can associate to your computer's "software access point" and send/receive IP packets from/to your computer; this is what the hostapd package will do for you.<br />
* Setting up the '''network configuration''' on you computer, so that your computer will properly relay IP packets from/to its own Internet connection from/to wireless clients.<br />
<br />
== Wifi Link Layer ==<br />
<br />
The actual Wifi link is established via the {{Pkg|hostapd}} package. That package is compatible with WPA2.<br />
<br />
[[pacman|Install]] the {{Pkg|hostapd}} package from the [[Official Repositories|official repositories]].<br />
<br />
Create the config file of hostapd {{ic|/etc/hostapd/hostapd.conf}}. <br />
<br />
Adjust the options as necessary. Especially, change the {{ic|ssid}} and the {{ic|wpa_passphrase}}.<br />
{{hc|/etc/hostapd/hostapd.conf|<nowiki><br />
ssid=YourWifiName<br />
wpa_passphrase=Somepassphrase<br />
interface=wlan0<br />
bridge=br0<br />
auth_algs=3<br />
channel=7<br />
driver=nl80211<br />
hw_mode=g<br />
logger_stdout=-1<br />
logger_stdout_level=2<br />
max_num_sta=5<br />
rsn_pairwise=CCMP<br />
wpa=2<br />
wpa_key_mgmt=WPA-PSK<br />
wpa_pairwise=TKIP CCMP<br />
</nowiki>}}<br />
<br />
For automatically starting hostapd, [[Daemon|enable]] the {{ic|hostapd.service}}.<br />
<br />
== Network configuration ==<br />
<br />
There are two basic ways for implementing this:<br />
# '''bridge''': create a network ''bridge'' on your computer (wireless clients will appear to access the same network interface and the same subnet that's used by your computer)<br />
# '''NAT''': with IP forwarding/masquerading and DHCP service (wireless clients will use a dedicated subnet, data from/to that subnet is NAT-ted -- similar to a normal WiFi router that's connected to your DSL or cable modem)<br />
<br />
The bridge approach is simpler, but it requires that any service that's needed by your wireless clients (like, DHCP) is available on your computers external interface. That means it will not work if you have a dialup connection (e.g., via PPPoE or a 3G modem) or if you're using a cable modem that will supply exactly one IP address to you via DHCP.<br />
<br />
The NAT aproach is more versatile, as it clearly separates wifi clients from your computer and it's completely transparent to the outside world. It will work with any kind of network connection, and (if needed) you can introduce traffic policies using the usual iptables approach.<br />
<br />
Of course, it is possible to ''combine both things''. For that, studying both articles would be necessary. Example: Like having a bridge that contains both an ethernet device and the wireless device with an static ip, offering DHCP and setting NAT configured to relay the traffic to an additional network device - that can be ppp or eth.<br />
<br />
=== Bridge Setup ===<br />
<br />
You need to create a network ''bridge'' and add your network interface (e.g. {{ic|eth0}}) to it. You '''should not''' add the wireless device (e.g. {{ic|wlan0}}) to the bridge; hostapd will add it on its own. <br />
<br />
If you use [[netctl]], see [[Bridge with netctl]] for details (just do not add {{ic|tap0}} used in that example).<br />
<br />
=== NAT Setup ===<br />
<br />
See [[Internet Sharing]] for details.<br />
<br />
On that article, the device connected to the lan is {{ic|net0}}. That device would be in this case your wireless device (e.g. {{ic|wlan0}}).<br />
<br />
== Scripts ==<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?pid=1269258 create_ap] script combines {{Pkg|hostapd}}, [[dnsmasq]] and [[iptables]] to create a NATed Access Point.<br />
<br />
== Troubleshooting ==<br />
<br />
===WLAN is very slow===<br />
<br />
This could be caused by low entropy. Consider installing [[haveged]].<br />
<br />
===NetworkManager is interfering===<br />
<br />
hostapd may not work, if the device is managed by NetworkManager. You can mask the device:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[keyfile]<br />
unmanaged-devices=mac:<hwaddr><br />
</nowiki>}}<br />
<br />
== See also ==<br />
<br />
* [http://wireless.kernel.org/RTFM-AP hostapd Linux documentation page]<br />
* [[Router]]<br />
* [http://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/ Hostapd : The Linux Way to create Virtual Wifi Access Point]<br />
* [http://xyne.archlinux.ca/notes/network/dhcp_with_dns.html tutorial and script for configuring a subnet with DHCP and DNS]</div>Doctaweeks