Sunteți pe pagina 1din 5

7/24/2015

Software access point - ArchWiki

Softwareaccesspoint
FromArchWiki
AsoftwareaccesspointisusedwhenyouwantyourcomputertoactasaWiFi
Relatedarticles
accesspointforthelocalnetwork.Itsavesyouthetroubleofgettingaseparate
wirelessrouter.
Networkconfiguration

Contents
1Requirements
1.1WiFidevicemustsupportAPmode
1.2WirelessclientandsoftwareAPwithasingleWiFidevice
2Overview
3WiFiLinkLayer
4Networkconfiguration
4.1BridgeSetup
4.2NATSetup
5Tools
5.1create_ap
5.2RADIUS
6Troubleshooting
6.1WLANisveryslow
6.2NetworkManagerisinterfering
7Seealso

Wirelessnetwork
configuration
Adhocnetworking
Internetsharing

Requirements
WiFidevicemustsupportAPmode
Youneedanl80211(http://wireless.kernel.org/en/developers/Documentation/nl80211)compatiblewireless
device,whichsupportstheAPoperatingmode(http://wireless.kernel.org/en/users/Documentation/modes).
Thiscanbeverifiedbyrunning iw listcommand,underthe Supported interface modesblockthere
shouldbe APlisted:
$ iw list
Wiphy phy1
...
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
https://wiki.archlinux.org/index.php/Software_access_point

1/5

7/24/2015

Software access point - ArchWiki

* mesh point

...

WirelessclientandsoftwareAPwithasingleWiFidevice
CreatingasoftwareAPisindependentfromyourownnetworkconnection(Ethernet,wireless,...).Many
wirelessdevicesevensupportsimultaneousoperationbothasAPandaswireless"client"atthesametime.
UsingthatcapabilityyoucancreateasoftwareAPactingasa"wirelessrepeater"foranexistingnetwork,
usingasinglewirelessdevice.Thecapabilityislistedinthefollowingsectionintheoutputof iw list:
$ iw list
Wiphy phy1
...
valid interface combinations:
* #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1,
total <= 2048, #channels <= 1, STA/AP BI must match
...

Theconstraint #channels <= 1meansthatyoursoftwareAPmustoperateonthesamechannelasyour


WiFiclientconnectionseethe channelsettingin hostapd.confbelow.
Ifyouwanttousethecapability/feature,perhapsbecauseanEthernetconnectionisnotavailable,youneed
tocreatetwoseparatevirtualinterfacesforusingit.Virtualinterfacesforaphysicaldevice wlan0canbe
createdasfollows:First,thevirtualinterfacesarecreatedforthenetworkconnection( wlan0_sta)itself
andforthesoftwareAP/hostapd"wirelessrepeater":
# iw dev wlan0 interface add wlan0_sta type station
# iw dev wlan0 interface add wlan0_ap type __ap

Second,theinterfacesareassignedseparateMACaddresses(usecustomuniqueaddresses):
# ip link set dev wlan0_sta address 12:34:56:78:ab:cd
# ip link set dev wlan0_ap address 12:34:56:78:ab:ce

Overview
Settingupanaccesspointcomprisestwomainparts:
SettinguptheWiFilinklayer,sothatwirelessclientscanassociatetoyourcomputer's"software
accesspoint"andsend/receiveIPpacketsfrom/toyourcomputerthisiswhatthehostapdpackage
willdoforyou.
Settingupthenetworkconfigurationonyoucomputer,sothatyourcomputerwillproperlyrelayIP
packetsfrom/toitsownInternetconnectionfrom/towirelessclients.

WiFiLinkLayer
https://wiki.archlinux.org/index.php/Software_access_point

2/5

7/24/2015

Software access point - ArchWiki

TheactualWiFilinkisestablishedviathehostapd (https://www.archlinux.org/packages/?
name=hostapd)package(availableintheofficialrepositories).ThepackagehasWPA2support.
Adjusttheoptionsinhostapdconfigurationfileifnecessary.Especially,changethe ssidandthe
wpa_passphrase.SeehostapdLinuxdocumentationpage
(http://wireless.kernel.org/en/users/Documentation/hostapd)formoreinformation.
/etc/hostapd/hostapd.conf
ssid=YourWiFiName
wpa_passphrase=Somepassphrase
interface=wlan0_ap
bridge=br0
auth_algs=3
channel=7
driver=nl80211
hw_mode=g
logger_stdout=-1
logger_stdout_level=2
max_num_sta=5
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP

Forautomaticallystartinghostapd,enablethe hostapd.service.
Warning:Thewirelesschannelsallowedforaccesspointoperationdifferaccordingtogeography.
Dependingonthewirelessfirmware,youmayhavetosettheregioncorrectlytouselegalchannels.Do
notchooseanotherregion,asyoumaybeillegallydisturbingnetworktraffic,affectingwireless
functionalityofyourowndeviceandotherswithinitsreach!TosettheregionseeWirelessnetwork
configuration#Respectingtheregulatorydomain.
Note:IfyouhaveacardbasedonRTL8192CUchipset,installhostapd-8192cu
(https://aur.archlinux.org/packages/hostapd-8192cu/)AURintheAURandreplace
driver=nl80211with driver=rtl871xdrvinthe hostapd.conffile.

Networkconfiguration
Therearetwobasicwaysforimplementingthis:
1. bridge:createanetworkbridgeonyourcomputer(wirelessclientswillappeartoaccessthesame
networkinterfaceandthesamesubnetthat'susedbyyourcomputer)
2. NAT:withIPforwarding/masqueradingandDHCPservice(wirelessclientswilluseadedicated
subnet,datafrom/tothatsubnetisNATtedsimilartoanormalWiFirouterthat'sconnectedto
yourDSLorcablemodem)
Thebridgeapproachissimpler,butitrequiresthatanyservicethat'sneededbyyourwirelessclients(like,
DHCP)isavailableonyourcomputersexternalinterface.Thatmeansitwillnotworkifyouhaveadialup
connection(e.g.,viaPPPoEora3Gmodem)orifyou'reusingacablemodemthatwillsupplyexactlyone
IPaddresstoyouviaDHCP.
https://wiki.archlinux.org/index.php/Software_access_point

3/5

7/24/2015

Software access point - ArchWiki

TheNATapproachismoreversatile,asitclearlyseparatesWiFiclientsfromyourcomputerandit's
completelytransparenttotheoutsideworld.Itwillworkwithanykindofnetworkconnection,and(if
needed)youcanintroducetrafficpoliciesusingtheusualiptablesapproach.
Ofcourse,itispossibletocombineboththings.Forthat,studyingbotharticleswouldbenecessary.
Example:Likehavingabridgethatcontainsbothanethernetdeviceandthewirelessdevicewithanstatic
ip,offeringDHCPandsettingNATconfiguredtorelaythetraffictoanadditionalnetworkdevicethatcan
beppporeth.

BridgeSetup
Youneedtocreateanetworkbridgeandaddyournetworkinterface(e.g. eth0)toit.Youshouldnotadd
thewirelessdevice(e.g. wlan0)tothebridgehostapdwilladditonitsown.
SeeNetworkbridge.
Tip:Youmaywishtoreuseanexistingbridge,ifyouhaveone(e.g.usedbyavirtualmachine).

NATSetup
SeeInternetsharingfordetails.
Onthatarticle,thedeviceconnectedtotheLANis net0.Thatdevicewouldbeinthiscaseyourwireless
device(e.g. wlan0).

Tools
create_ap
Thecreate_ap(https://bbs.archlinux.org/viewtopic.php?pid=1269258)scriptcombineshostapd
(https://www.archlinux.org/packages/?name=hostapd),dnsmasqandiptablestocreatea
Bridged/NATedAccessPoint(availableintheAURcreate_ap
(https://aur.archlinux.org/packages/create_ap/)AUR).

RADIUS
See[1](https://me.m01.eu/blog/2012/05/wpa2enterprisefromscratchonaraspberrypi/)forinstructions
torunaFreeRADIUS(http://freeradius.org/)serverforWPA2Enterprise.

Troubleshooting
WLANisveryslow
Thiscouldbecausedbylowentropy.Considerinstallinghaveged.

https://wiki.archlinux.org/index.php/Software_access_point

4/5

7/24/2015

Software access point - ArchWiki

NetworkManagerisinterfering
hostapdmaynotwork,ifthedeviceismanagedbyNetworkManager.Youcanmaskthedevice:
/etc/NetworkManager/NetworkManager.conf
[keyfile]
unmanaged-devices=mac:<hwaddr>

Seealso
Router
Hostapd:TheLinuxWaytocreateVirtualWiFiAccessPoint
(http://nims11.wordpress.com/2012/04/27/hostapdthelinuxwaytocreatevirtualwifiaccesspoint/)
tutorialandscriptforconfiguringasubnetwithDHCPandDNS
(http://xyne.archlinux.ca/notes/network/dhcp_with_dns.html)
Retrievedfrom"https://wiki.archlinux.org/index.php?title=Software_access_point&oldid=382821"
Category: WirelessNetworking
Thispagewaslastmodifiedon18July2015,at18:14.
ContentisavailableunderGNUFreeDocumentationLicense1.3orlaterunlessotherwisenoted.

https://wiki.archlinux.org/index.php/Software_access_point

5/5

S-ar putea să vă placă și