# SOLVED:easiest way to turn linux pc into a wlan access point

## gw

Hi,

I'm looking for an easy way to share my wired desktop network link via wlan, no user management or whatever is necessary, there will be just one single client. So a minimalist solution would fit me best. How can I set up my linux pc to act as a wlan access point, which software and what kind of hardware do I need? Is there something like a wlan stick that works over usb?

Thanks

gwLast edited by gw on Sat Apr 23, 2011 3:51 pm; edited 1 time in total

----------

## Veldrin

A friend of mine recently turned his server into an access point - so yes it is doable.

but this only works with certain types of wlan chips (e.g the atheros family).

dlink dwa140 or 160 seems a good starting point, but they ain't cheap.

V.

----------

## gw

 *Veldrin wrote:*   

> A friend of mine recently turned his server into an access point - so yes it is doable.
> 
> but this only works with certain types of wlan chips (e.g the atheros family).
> 
> dlink dwa140 or 160 seems a good starting point, but they ain't cheap.
> ...

 

Thanks! Is this the device you meant:http://www.amazon.de/D-Link-DWA-160-Wireless-N-Dualband-USB-Stick/dp/B001HN3H2M

Does it really have the access point functionality, because from description it would seem it serves only to link a computer to an already existing wireless network, -- whereas I was looking for something to quickly set up a wireless network.

Thanks

gw

----------

## chithanh

http://linuxwireless.org/en/users/Drivers

has a list of drivers which support AP mode

----------

## Veldrin

@chithanh: thanks for the link...

This confirm my initial suggestion. DLink DWA 160 does support hostapd which is the second piece needed to build your own AP.

And I runs with the madwifi drivers, which is another good thing.

V.

----------

## gw

 *chithanh wrote:*   

> http://linuxwireless.org/en/users/Drivers
> 
> has a list of drivers which support AP mode

 

Thanks for the link and thanks also to Veldrin!

Looking at these tables gives a rather bleak image for my purpose though: if you select AP mode in the table and then look at those drivers that operate on the USB bus, not many remain! The most ominous absence unfortunately is Ralink rt2800usb, which seems to be the chipset built into most of the newer wlan usb sticks, but especially is unclear with regard to its feature set under linux:http://linuxwireless.org/en/users/Drivers/rt2800usb

This chipset is also in the B revision of DLink DWA 160; its A revision on the other hand seems to have another chipset, but, according to amazon feedback, has abysmal net performance.

Other drivers in the matrix that do support AP mode AND work on the USB bus mostly point to really old and crappy devices, that don't even have WAP2 encryption. An exception seems to be http://linuxwireless.org/en/users/Drivers/carl9170 but I don't know exactly what to make out of it, as for example FRITZ!WLAN USB sticks are said to be and not to be supported at the same time!

Anyway, supposed I can get a working device like eg the DLink DWA 160, -- is there any documentation on how to set it up in AP mode? what would be the principal steps to do so?

Thanks again

gw

----------

## ppurka

 *gw wrote:*   

> 
> 
> Anyway, supposed I can get a working device like eg the DLink DWA 160, -- is there any documentation on how to set it up in AP mode? what would be the principal steps to do so?
> 
> Thanks again
> ...

 It should be easy if you use networkmanager. I think the "Create new wireless network" option in nm-applet should allow you to use your card in AP mode.  For this you also need the USE flag connection-sharing enabled.

If you want to do it the hard way, it has to be some variant of the gentoo home router guide that takes in broadcasting over wireless (and WEP, WPA, etc) into account.

----------

## gw

 *ppurka wrote:*   

> It should be easy if you use networkmanager. I think the "Create new wireless network" option in nm-applet should allow you to use your card in AP mode.  For this you also need the USE flag connection-sharing enabled.
> 
> If you want to do it the hard way, it has to be some variant of the gentoo home router guide that takes in broadcasting over wireless (and WEP, WPA, etc) into account.

 

Thanks! I tried first with networkmanager, but that did so massively tinker with config files in /etc that  I unmerged immediately.

What did work though was the following:

 my device is a d-link dwa-160 hardware rev A2. That means that it has an atheros chipset, not the newer ralink ones; windows people normally complain that it has bad 802.11n performance, but I don't care for my purpose

 the kernel driver for this is carl9170  (not the legacy ar9170usb!), enable in kernel and recompile

 best general info is http://www.linuxwireless.org/en/users/Documentation/hostapd and http://www.linuxwireless.org/en/users/Drivers/carl9170

 I then basically followed http://exain.wordpress.com/2011/03/31/making-a-wifi-hotspot-access-point-using-linux-wifi-lan-cardusb-adapter (1); there is also gentoo specific documentation: http://www.gentoo-wiki.info/Wireless/libnl_Access_Point (2) but unfortunately much older and sloppily written

 I used documentation (1) for nearly everything (especially their dhcp setup), the gentoo wiki (2) only for the startup parts at the end of the wiki (iptables and ip-forwarding); I also used the /etc/conf.d/net related instructions in (2)

 in /etc/conf.d/dhcpd I also added: DHCPD_IFACE="wlan0"

 So here's the process: 1) recompile kernel with appropriate driver support (carl9170 in my case). --- 2) reboot. --- 3) insert wlan stick. --- 4) interface wlan0 is created. --- 5) net.wlan0 is started with the settings in /etc/conf.d/net (which basically gives wlan0 an ip address). --- 6) start /etc/init.d/dhcpd (I configured a subnet in /etc/dhcp/dhcpd.conf following (1)). 7) activate ip-forwarding and define iptables rule according to (2). ---  :Cool:  start hostapd: hostapd -dd /etc/hostapd/hostapd.conf, again configured after (1). wlan clients can connect to the stick, and their traffic is forwarded to my eth0 interface

So that's it. Feel free to ask, if you need to know further details of my setup. 

Briefly: with the d-link dwa160 rev A2 and the driver carl9170 it is relatively straightforward to set up your machine as an access point!

gw

----------

## javeree

A few days ago, I had a question about almost exactly the same setup (which worked with baselayout, but not with baselayout2). As my setup fails at your step 5. Would you care for sharing your conf.d/net setup ?

Edit: you can ignore my request, sonce I just solved my issue: https://forums.gentoo.org/viewtopic-t-874739-highlight-.html

----------

## gw

 *javeree wrote:*   

> A few days ago, I had a question about almost exactly the same setup (which worked with baselayout, but not with baselayout2). As my setup fails at your step 5. Would you care for sharing your conf.d/net setup ?
> 
> Edit: you can ignore my request, sonce I just solved my issue: https://forums.gentoo.org/viewtopic-t-874739-highlight-.html

 

Just for the record: what solved the problem for you, is exactly what I have:

```
modules_wlan="!iwconfig !wpa_supplicant"
```

gw

----------

## solamour

gw:

Is your hostapd configured with WPA? If so, would it be possible for you to share "/etc/hostapd/hostapd.conf" file (with sensitive info blocked, of course)?

I have pretty much the same setup, except that it works only if I don't enable WPA. It does look like the devices are talking to each other, but the client is not getting an IP. Once I disable WPA, everything works.

__

sol

----------

## solamour

Just to keep everyone informed, I think my case has more to do with the WiFi adapter's driver than the configuration, because when I used the exactly same "/etc/hostapd/hostapd.conf" and "/etc/dnsmasq.conf" on a different machine that has an Atheros chipset adapter, it worked flawlessly. In fact, I verified it on two different interfaces.

```
06:00.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)

02:00.0 Ethernet controller: Atheros Communications Inc. AR5001 Wireless Network Adapter (rev 01)

```

Anyhow, if anyone knows how to make WPA work with the following device, please share. Thank you.

```
Bus 001 Device 003: ID 18e8:6238 Qcom

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            0 (Defined at Interface level)

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0        64

  idVendor           0x18e8 Qcom

  idProduct          0x6238

  bcdDevice            0.01

  iManufacturer           1 Ralink

  iProduct                2 802.11 bg WLAN

  iSerial                 0

  bNumConfigurations      1

```

__

solLast edited by solamour on Sat Aug 20, 2011 11:12 am; edited 1 time in total

----------

## jippy

Nice. Will try this

----------

## solamour

As for the "non-working WPA" case (i.e. hostapd and dnsmasq work perfectly as long as WPA is not enabled), I think the firmware update did the trick. As soon as I updated the firmware, WPA started working.

```
# emerge -ptv linux-firmware

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!

[ebuild   R   ] sys-kernel/linux-firmware-20110604  USE="-savedconfig" 0 kB

```

Kernel configuration:

```
Device Drivers

   Network device support (NETDEVICES)

      Wireless LAN (WLAN)

         Ralink driver support (RT2X00)

            Ralink rt2501/rt73 (USB) support (RT73USB)

```

USB WiFi interface:

```
# lsusb | grep 18e8

Bus 001 Device 003: ID 18e8:6238 Qcom
```

__

sol

----------

