# hostapd iwlagn

## eleanor

Hi, I have a problem setting up access point with hostapd. I have the intel wireless card:

```

sys-firmware/iwl5000-ucode (8.24.2.12(1)@10/26/12): Intel (R) Wireless WiFi Link 5100/5300 ucode

```

The module used:

```

# lsmod | grep iw

iwlwifi               175842  0

mac80211              340414  1 iwlwifi

cfg80211              149485  2 iwlwifi,mac80211

```

The hostapd.conf looks like this:

 *Quote:*   

> 
> 
> interface=wlan0
> 
> driver=nl80211
> ...

 

The problem is that when running the hostapd command, the AP is not visible by other wireless devices I have at home. The output of hostapd command is as follows:

 *Quote:*   

> 
> 
> # hostapd -dd /etc/hostapd/hostapd.conf
> 
> random: Trying to read entropy from /dev/random
> ...

 

Any ideas what's going on? Why is the AP not visible, there are some errors when running hostapd, but I'm not sure they are related to the problem of AP not being visible.

THanks

----------

## cach0rr0

disclaimer - ive never attempted doing what you're doing, but ive fought enough with wireless in the kernel hopefully i can make an educated guess

The one thing in particular that jumps out at me

```

Could not connect to kernel driver.

```

do you have CONFIG_HOSTAP set in your kernel? It may require some of the lib80211 crap as well, not certain, but that'd be the first place I'd look

----------

## eleanor

Hi,

I have enabled the HOSTAP in the kernel and restarted:

```

# cat /usr/src/linux/.config | grep HOSTAP

CONFIG_HOSTAP=y

# CONFIG_HOSTAP_FIRMWARE is not set

CONFIG_HOSTAP_PLX=y

CONFIG_HOSTAP_PCI=y

CONFIG_HOSTAP_CS=y

```

Now  the hostapd is printing the following:

 *Quote:*   

> 
> 
> # hostapd -dd  /etc/hostapd/hostapd.conf
> 
> random: Trying to read entropy from /dev/random
> ...

 

It still cannot connect to kernel. Any more ideas about this?

----------

## cach0rr0

asking a possibly silly question - what were your exact steps after enabling hostap in the kernel? 

did you reissue a "make && make modules_install", re-copy the new bzImage to /boot, and boot from it? 

if HOSTAP and its requisite dependencies are enabled in a running kernel, i cant imagine why you'd still see that error

----------

## eleanor

Hi,

Of course I rebuilt the kernel and booted off of it  :Smile:  I can prove it (noticed the date?):

```

# uname -a

Linux localhost 3.4.9-gentoo #4 SMP PREEMPT Sun Nov 11 11:18:26 CET 2012 x86_64 Intel(R) Core(TM)2 Duo CPU P8800 @ 2.66GHz GenuineIntel GNU/Linux

```

----------

## khayyam

eleanor, cach0rr0, et al ...

The hostap driver is not whats at issue, this driver is for prism2 cards, hostapd uses the mac80211 subsystem (via hostapd's netlink, nl80211, driver).

So, firstly you should check mac80211 and cfg80211 are enabled:

```
# awk '/(MAC|CFG)80211/' /usr/src/linux/.config
```

Secondly, does the card show 'AP' (infrastructure mode) as a capability (requires net-wireless/iw):

```
# iw list
```

You should see something like the following:

```
    Supported interface modes:

         * IBSS

         * managed

         * AP

         * AP/VLAN

         * monitor

    software interface modes (can always be added):

         * AP/VLAN

         * monitor
```

Then test if the card can be put into AP mode:

```
# iw phy phy0 interface add wlan0 type ap

# iw dev wlan0 del
```

This being successfull you should then test with the hostapd-minimal.conf.

I see in  the above "Failed to set interface 4 to mode 3" (which is AP mode) and then subequently "Interface already in requested mode - ignore error" ... which seems odd, and the reason I'd suggest the above tests/checks.

Then there are some other errors setting rates, and TX parameters, and then it reports the interface is down. Not sure whats happening here but I imagine its unable to bring wlan0 up correctly due to not being able to set the TX. You might test and see if TX can be set manually:

```
# iw dev wlan0 set txpower fixed 3000
```

This value is in mBm (100 mBm = 1 dBm) ... so 'iw phy0 info' can provide some info as to the current dBm.

I can't see easily what the issue is, but the above tests may show some issue/problem with iwlagn.

best ... khay

----------

## eleanor

Hi,

I guess the interface cards don't have AP support. The "iw list" displays this output about my two interface cards:

 *Quote:*   

> 
> 
> Wiphy phy1
> 
>         Band 1:
> ...

 

But it's rather strange that Wireless Alpha Card doesn't have support for that: https://lh4.googleusercontent.com/-mL04G8acKAk/TYziOI5X47I/AAAAAAAAAs0/vIgUeHRoyAE/Alpha+wireless.jpg

Can you confirm that the two interface cards really don't support the AP mode? 

Thank you

----------

## khayyam

 *eleanor wrote:*   

> I guess the interface cards don't have AP support. The "iw list" displays this output about my two interface cards:
> 
> ```
>     Supported interface modes:
> 
> ...

 

Yes, it would seem so, but this may be the kernel version (which you haven't mentioned so far) and firmware revision.

 *eleanor wrote:*   

> But it's rather strange that Wireless Alpha Card doesn't have support for that

 

I'm pretty sure the Alpha's have Ralink cards and not intel, so this again be a question of kernel/firmware. I assume you are using the kernel driver and not that provided with the card? 

 *eleanor wrote:*   

> Can you confirm that the two interface cards really don't support the AP mode?

 

Did you perhaps try to set ap mode manually (using the above command)? Note that with two interfaces you need to be sure that you are targeting the correct interface, so, phy0 and phy1 ... you should see "registered as phy[N]" in dmesg when the driver is loaded.

best ... khay

----------

## eleanor

Hi,

I managed to start the AP successfully. But I cannot connect to it, neither statically nor dynamically. I've tried setting the IP in /etc/conf.d/net:

 *Quote:*   

> 
> 
> modules_wlan1=( "!iwconfig !wpa_supplicant" )
> 
> config_wlan1=( "10.1.2.1 broadcast 10.1.2.255 netmask 255.255.255.0" )
> ...

 

The ifconfig:

```

wlan1     Link encap:Ethernet  HWaddr 00:c0:ca:3e:67:c6

          inet addr:10.1.2.1  Bcast:10.1.2.255  Mask:255.255.255.0

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

```

We can see that the IP of the wlan1 interface is OK. The hostapd is OK as we can see here:

 *Quote:*   

> 
> 
> # hostapd -dd  /etc/hostapd/hostapd.conf
> 
> random: Trying to read entropy from /dev/random
> ...

 

When I connect to the AP with an IP that was set statically by the phone itself (not DHCP), I get this (the output is taken from the phone);

 *Quote:*   

> 
> 
> $ ifconfig wlan0
> 
> wlan0: ip 10.1.2.2 mask 255.255.255.0 flags [up broadcast running multicast]
> ...

 

Here's the first problem. I've got the correct IP set on the phone, but the problem is that it can't see the 10.1.2.1 (the AP - the wlan1 interface card on laptop). And the wifi manager on the phone says it's connected. Any ideas about this one?

Another problem is that the dnsmasq doesn't work, it doesn't allocate the IP to the mobile phone. The conf contains only this line:

 *Quote:*   

> 
> 
> # cat /etc/dnsmasq.conf | grep -v ^# | grep -v ^$
> 
> dhcp-range=10.1.2.100,10.1.2.150,12
> ...

 

And when I start it, the following is outputed:

 *Quote:*   

> 
> 
> # dnsmasq -d
> 
> dnsmasq: started, version 2.63rc6 cachesize 150
> ...

 

The port 53 is open.

 *Quote:*   

> 
> 
> tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      27564/dnsmasq
> 
> tcp6       0      0 :::53                   :::*                    LISTEN      27564/dnsmasq
> ...

 

So there are two open questions:

1. Why doesn't the phone see the AP even though it's connected and has the right IP?

2. Why doesn't the dnsmasq work and give the phone an IP?

----------

## eleanor

Just moving the message up the stack.

----------

