Difference between revisions of "Software access point"

From ArchWiki
Jump to: navigation, search
m (Steps to implement)
Line 97: Line 97:
 
== See also ==
 
== See also ==
  
* http://wireless.kernel.org/RTFM-AP
+
* [http://wireless.kernel.org/RTFM-AP hostapd Linux documentation page]
 
* [[Router]]
 
* [[Router]]
 +
* [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]

Revision as of 01:00, 1 August 2012


A software access point is used when you want your computer to act as an access point for the local wireless network. It saves you the trouble of getting a separate wireless router.

Things you need

You will need:

  • prism2/2.5/3 pure pci wireless card or nl80211 compatible cards (e.g. ath9k)
  • wireless_tools, hostapd and bridge-utils from pacman

Steps to implement

The config file of hostapd /etc/hostapd/hostapd.conf will help you to put your wireless device into master mode and willing to accept connection from other computers with encrypted password.

Here is an example from http://www.su-root.co.uk/computing/turn-your-linux-computer-in-a-wireless-access-point-using-hostapd:

interface=wlan0
bridge=br0
driver=nl80211
logger_stdout=-1
logger_stdout_level=2
ssid=test
hw_mode=g
channel=6
auth_algs=3
max_num_sta=5
wpa=2
wpa_passphrase=tryyourbest
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

Set up bridge with kernel >= 2.6.33

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Software access point#)

Due to changes in the kernel since version 2.6.33 bridges cannot contain an uninitialized interface. Because of this we need hostapd to add the wlan interface to the bridge instead.

Requirements:

  • kernel >= 2.6.33
  • hostapd >= 0.7.1
  • bridge-utils

One way to set this up since the changes in rc.conf because of the deprecation of net-tools is to use Netcfg:

Setup a profile in /etc/network.d/ (for example called "bridge").

/etc/network.d/bridge
INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="Bridge wired and wireless connection"

# Only add wired interface here, hostapd will add wireless
BRIDGE_INTERFACES="eth0"
IP="dhcp"

In rc.conf make sure you do the following:

  • Add the bridge profile to the NETWORKS list.
  • Make sure you are starting the profiles by adding net-profiles to the DAEMONS list.
  • Start hostapd after net-profiles by adding it to the DAEMONS list.
/etc/rc.conf
NETWORKS=( bridge )

...

DAEMONS=( ... net-profiles hostapd ... )

Reboot the machine and use another computer to see if you can find the "test" wireless connection.

If you do not want to reboot these commands should work:

 netcfg up bridge
 rc.d start hostapd

Old way to set up bridge

before hostapd does its job, eth0, wlan0 and br0 must be up and do not have any address. we can put the following lines in /etc/rc.conf

eth0="eth0 up"
wlan0="wlan0 up"
br0="br0 192.168.0.2 netmask 255.255.255.0 up"
INTERFACES=(lo eth0 wlan0 br0)

in the /etc/conf.d/bridges file, uncomment the lines (change eth1 to wlan0)

bridge_br0="eth0 wlan0"
BRIDGE_INTERFACES=(br0)

we are ready to go, just reboot the machine and use another computer to see if you can find the "test" wireless connection.

Note: *untested* if your computer stops at the sign of "waiting for IP address" etc, that may be it can not find a dhcp server. so you need to set up one.

See also