# [Solved] Changing the wifi regulatory domain

## Bullet Dodger

I have a home built router to which I have just added a 2nd wifi card so that I can use the 5GHz spectrum of 802.11n, although hostapd is refusing to do this. The root cause appears to be the regulatory domain:

```

# iw reg get

country 00:

        (2402 - 2472 @ 40), (6, 20)

        (2457 - 2482 @ 20), (6, 20), PASSIVE-SCAN, NO-IBSS

        (2474 - 2494 @ 20), (6, 20), NO-OFDM, PASSIVE-SCAN, NO-IBSS

        (5170 - 5250 @ 40), (6, 20), PASSIVE-SCAN, NO-IBSS

        (5735 - 5835 @ 40), (6, 20), PASSIVE-SCAN, NO-IBSS

```

In /etc/hostapd/hostapd.conf, I have the line:

```

# grep country /etc/hostapd/hostapd.conf

country_code=GB

```

But the regulatory domain is still "world"

```

# grep -i crda /var/log/messages

Feb  2 21:22:23 tux kernel: [   16.479558] cfg80211: Calling CRDA to update world regulatory domain

```

How do I go about changing this?Last edited by Bullet Dodger on Tue Feb 14, 2012 9:01 pm; edited 1 time in total

----------

## Bullet Dodger

I found cdra wasn't installed. After emerging it I now have:

```

# iw reg get

country GB:

        (2402 - 2482 @ 40), (N/A, 20)

        (5170 - 5250 @ 40), (N/A, 20)

        (5250 - 5330 @ 40), (N/A, 20), DFS

        (5490 - 5710 @ 40), (N/A, 27), DFS

```

But I think there is still a problem, as I still have:

```

# iw info

                Frequencies:

                        * 5180 MHz [36] (12.0 dBm) (passive scanning, no IBSS)

                        * 5200 MHz [40] (16.0 dBm) (passive scanning, no IBSS)

                        * 5220 MHz [44] (16.0 dBm) (passive scanning, no IBSS)

                        * 5240 MHz [48] (16.0 dBm) (passive scanning, no IBSS)

                        * 5260 MHz [52] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5280 MHz [56] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5300 MHz [60] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5320 MHz [64] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5500 MHz [100] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5520 MHz [104] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5540 MHz [108] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5560 MHz [112] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5580 MHz [116] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5600 MHz [120] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5620 MHz [124] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5640 MHz [128] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5660 MHz [132] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5680 MHz [136] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5700 MHz [140] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5745 MHz [149] (20.0 dBm) (passive scanning, no IBSS)

                        * 5765 MHz [153] (20.0 dBm) (passive scanning, no IBSS)

                        * 5785 MHz [157] (20.0 dBm) (passive scanning, no IBSS)

                        * 5805 MHz [161] (20.0 dBm) (passive scanning, no IBSS)

                        * 5825 MHz [165] (20.0 dBm) (passive scanning, no IBSS)

```

The card is:

```

02:00.0 Network controller: Atheros Communications Inc. AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn] (PCI-Express) (rev 01)

```

Using the ath9k driver

----------

## Bullet Dodger

It looks like the card is still using the world regulatory domain:

```

Feb  2 23:45:38 tux kernel: [   18.252652] ath9k 0000:02:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17

Feb  2 23:45:38 tux kernel: [   18.252678] ath9k 0000:02:00.0: setting latency timer to 64

Feb  2 23:45:38 tux kernel: [   18.383197] ath: EEPROM regdomain: 0x60

Feb  2 23:45:38 tux kernel: [   18.383204] ath: EEPROM indicates we should expect a direct regpair map

Feb  2 23:45:38 tux kernel: [   18.383213] ath: Country alpha2 being used: 00

Feb  2 23:45:38 tux kernel: [   18.383217] ath: Regpair used: 0x60

Feb  2 23:45:38 tux kernel: [   18.466320] ieee80211 phy0: Selected rate control algorithm 'ath9k_rate_control'

Feb  2 23:45:38 tux kernel: [   18.470980] Registered led device: ath9k-phy0

Feb  2 23:45:38 tux kernel: [   18.471048] ieee80211 phy0: Atheros AR5418 MAC/BB Rev:2 AR5133 RF Rev:81 mem=0xffffc90011560000, irq=17

```

How do I change this?

----------

## cwr

I had to load the ath9k wireless driver as a module;  it wouldn't change regulatory

domain when built into the kernel.

Will

----------

## ulenrich

Also to mention wireless drivers that don't even try to use other than all-world-00 domains like the 

proprietary broadcom-sta

As it is stated in their Readme!

And my chip 

BCM4321 802.11a/b/g/n [14e4:4328] (mac-mini)

isnt supported at all by mainline linux ...

----------

## Gusar

 *ulenrich wrote:*   

> And my chip 
> 
> BCM4321 802.11a/b/g/n [14e4:4328] (mac-mini)
> 
> isnt supported at all by mainline linux ...

 

Sure it is. Since 2.3.39. There's some caveats (no 5GHz operation, no HT40 channels), but otherwise it works. b43 driver.

----------

## Logicien

The module cfg80211 have the parameter ieee80211_regdom that can be use to set the IEEE 802.11 regulatory domain code:

```
modinfo -p cfg80211

cfg80211_disable_40mhz_24ghz:Disable 40MHz support in the 2.4GHz band

ieee80211_regdom:IEEE 802.11 regulatory domain code
```

So using that parameter when module load might help:

```
modprobe cfg80211 ieee80211_regdom=GB
```

or

```
echo 'options cfg80211 ieee80211_regdom=GB' > /etc/modprobe.d/cfg80211.conf
```

----------

## Bullet Dodger

That one didn't work  :Sad: 

```

# modprobe cfg80211 ieee80211_regdom=GB

# iw phy phy0 info

                Frequencies:

                        * 5180 MHz [36] (12.0 dBm) (passive scanning, no IBSS)

                        * 5200 MHz [40] (16.0 dBm) (passive scanning, no IBSS)

                        * 5220 MHz [44] (16.0 dBm) (passive scanning, no IBSS)

                        * 5240 MHz [48] (16.0 dBm) (passive scanning, no IBSS)

                        * 5260 MHz [52] (disabled)

                        * 5280 MHz [56] (disabled)

                        * 5300 MHz [60] (disabled)

                        * 5320 MHz [64] (disabled)

                        * 5500 MHz [100] (disabled)

                        * 5520 MHz [104] (disabled)

                        * 5540 MHz [108] (disabled)

                        * 5560 MHz [112] (disabled)

                        * 5580 MHz [116] (disabled)

                        * 5600 MHz [120] (disabled)

                        * 5620 MHz [124] (disabled)

                        * 5640 MHz [128] (disabled)

                        * 5660 MHz [132] (disabled)

                        * 5680 MHz [136] (disabled)

                        * 5700 MHz [140] (disabled)

                        * 5745 MHz [149] (20.0 dBm) (passive scanning, no IBSS)

                        * 5765 MHz [153] (20.0 dBm) (passive scanning, no IBSS)

                        * 5785 MHz [157] (20.0 dBm) (passive scanning, no IBSS)

                        * 5805 MHz [161] (20.0 dBm) (passive scanning, no IBSS)

                        * 5825 MHz [165] (20.0 dBm) (passive scanning, no IBSS)

```

I'll try a kernel recompile with the ath9k build as a module. 

Currently I have:

```

# zcat /proc/config.gz | grep -i ath9k

CONFIG_ATH9K_HW=m

CONFIG_ATH9K_COMMON=m

CONFIG_ATH9K=m

CONFIG_ATH9K_PCI=y

# CONFIG_ATH9K_AHB is not set

CONFIG_ATH9K_DEBUGFS=y

CONFIG_ATH9K_RATE_CONTROL=y

CONFIG_ATH9K_HTC=m

# CONFIG_ATH9K_HTC_DEBUGFS is not set

```

Last edited by Bullet Dodger on Wed Feb 08, 2012 12:25 am; edited 1 time in total

----------

## turtles

 *Bullet Dodger wrote:*   

> I found cdra wasn't installed. After emerging it I now have:
> 
> ```
> 
> # iw reg get
> ...

 

By emerging it you mean 

```
net-wireless/wireless-regdb
```

 ?

I have had this problem since last July on any US network with ath9k and a AR5008

Which is everywhere but my home network which uses country '00'

I have a stale post here somewhere about it.

```

iw reg set US

iw reg get

country 00:

        (2402 - 2472 @ 40), (6, 20)

        (2457 - 2482 @ 20), (6, 20), PASSIVE-SCAN, NO-IBSS

        (2474 - 2494 @ 20), (6, 20), NO-OFDM, PASSIVE-SCAN, NO-IBSS

        (5170 - 5250 @ 40), (6, 20), PASSIVE-SCAN, NO-IBSS

        (5735 - 5835 @ 40), (6, 20), PASSIVE-SCAN, NO-IBSS

```

It would be nice to get ath9k working in Gentoo again.

----------

## Bullet Dodger

 *turtles wrote:*   

>  *Bullet Dodger wrote:*   I found cdra wasn't installed. After emerging it I now have: 
> 
> ```
> 
> # iw reg get
> ...

 

No

```

# emerge -a crda

```

Just about to recompile the kernel with CONFIG_ATH9K_PCI and CONFIG_ATH9K_RATE_CONTROL, build as modules. I'll let you know how that goes.

----------

## Bullet Dodger

It appears that genkernel will not allow CONFIG_ATH9K_PCI and CONFIG_ATH9K_RATE_CONTROL to be built as modules

----------

## Gusar

 *Bullet Dodger wrote:*   

> It appears that genkernel will not allow CONFIG_ATH9K_PCI and CONFIG_ATH9K_RATE_CONTROL to be built as modules

 

That's perfectly normal, and has nothing to do with genkernel. Those merely set driver options, they're not drivers themselves. If you activate these options, they will be built into the atk9k driver.

----------

## Bullet Dodger

Ok, 

So I have ath9k built as a module

```

# zcat /proc/config.gz | grep -i ath9k

CONFIG_ATH9K_HW=m

CONFIG_ATH9K_COMMON=m

CONFIG_ATH9K=m

CONFIG_ATH9K_PCI=y

CONFIG_ATH9K_AHB=y

# CONFIG_ATH9K_DEBUGFS is not set

CONFIG_ATH9K_RATE_CONTROL=y

CONFIG_ATH9K_HTC=m

# CONFIG_ATH9K_HTC_DEBUGFS is not set

```

I have cdra installed and

```

# iw reg get

country GB:

        (2402 - 2482 @ 40), (N/A, 20)

        (5170 - 5250 @ 40), (N/A, 20)

        (5250 - 5330 @ 40), (N/A, 20), DFS

        (5490 - 5710 @ 40), (N/A, 27), DFS

```

But still 

```

# iw phy phy0 info

                Frequencies:

                        * 5180 MHz [36] (12.0 dBm) (passive scanning, no IBSS)

                        * 5200 MHz [40] (16.0 dBm) (passive scanning, no IBSS)

                        * 5220 MHz [44] (16.0 dBm) (passive scanning, no IBSS)

                        * 5240 MHz [48] (16.0 dBm) (passive scanning, no IBSS)

                        * 5260 MHz [52] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5280 MHz [56] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5300 MHz [60] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5320 MHz [64] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5500 MHz [100] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5520 MHz [104] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5540 MHz [108] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5560 MHz [112] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5580 MHz [116] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5600 MHz [120] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5620 MHz [124] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5640 MHz [128] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5660 MHz [132] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5680 MHz [136] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5700 MHz [140] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5745 MHz [149] (20.0 dBm) (passive scanning, no IBSS)

                        * 5765 MHz [153] (20.0 dBm) (passive scanning, no IBSS)

                        * 5785 MHz [157] (20.0 dBm) (passive scanning, no IBSS)

                        * 5805 MHz [161] (20.0 dBm) (passive scanning, no IBSS)

                        * 5825 MHz [165] (20.0 dBm) (passive scanning, no IBSS)

```

And if I try to change the reg domain of the card

```

# modprobe cfg80211 ieee80211_regdom=GB 

```

And this time no change

```

                Frequencies:

                        * 5180 MHz [36] (12.0 dBm) (passive scanning, no IBSS)

                        * 5200 MHz [40] (16.0 dBm) (passive scanning, no IBSS)

                        * 5220 MHz [44] (16.0 dBm) (passive scanning, no IBSS)

                        * 5240 MHz [48] (16.0 dBm) (passive scanning, no IBSS)

                        * 5260 MHz [52] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5280 MHz [56] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5300 MHz [60] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5320 MHz [64] (16.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5500 MHz [100] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5520 MHz [104] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5540 MHz [108] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5560 MHz [112] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5580 MHz [116] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5600 MHz [120] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5620 MHz [124] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5640 MHz [128] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5660 MHz [132] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5680 MHz [136] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5700 MHz [140] (18.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5745 MHz [149] (20.0 dBm) (passive scanning, no IBSS)

                        * 5765 MHz [153] (20.0 dBm) (passive scanning, no IBSS)

                        * 5785 MHz [157] (20.0 dBm) (passive scanning, no IBSS)

                        * 5805 MHz [161] (20.0 dBm) (passive scanning, no IBSS)

                        * 5825 MHz [165] (20.0 dBm) (passive scanning, no IBSS)

```

Last edited by Bullet Dodger on Wed Feb 08, 2012 12:26 am; edited 1 time in total

----------

## Bullet Dodger

Could this be related?

```

# zcat /proc/config.gz | grep CONFIG_CFG80211_INTERNAL_REGDB

# CONFIG_CFG80211_INTERNAL_REGDB is not set

```

----------

## Gusar

 *Bullet Dodger wrote:*   

> Could this be related?
> 
> ```
> 
> # zcat /proc/config.gz | grep CONFIG_CFG80211_INTERNAL_REGDB
> ...

 

Nope. This kernel option is an alternative to the wireless-regdb package, so if you have that package, the kernel option isn't needed. But it doesn't hurt to try a kernel with it activated.

----------

## Bullet Dodger

I think the problem is that the card has the world regulatory domain programmed into the EEPROM, and hostapd will not override it.

```

# dmesg | grep EEPROM -2

[   18.170278] ath: EEPROM regdomain: 0x60

[   18.170283] ath: EEPROM indicates we should expect a direct regpair map

[   18.170292] ath: Country alpha2 being used: 00

[   18.170296] ath: Regpair used: 0x60

```

http://linuxwireless.org/en/users/Drivers/ath#EEPROM_regulatory_pairs

WOR0_WORLD = 0x60

Do I need to look at pre-programming the EEPROM / damaging the EEPROM / buying a new card?

----------

## turtles

???

What is the point of having a regulatory database if it cant override the eprom setting?

If that is not a bug I dont know what one is.

My card used to be able to roam on US networks and now it cant since I think the .38 kernel series.

They have done exactly what they wanted to avoid with this the bug riddled regulatory code.

Now I am going to compile my own kernel and with all the regulatory stuff stripped out.

----------

## Bullet Dodger

I have just tried using the madwifi's ath_info to change the regdomain in eeprom, but that failed. 

I read somewhere that my card (168c:0024 AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn]) isn't supported by ath_info, because the eeprom layout has changed from previous atheros cards.

I'm not really sure where to go from here.

I obviously need to be more careful the next time I buy a wifi card.

----------

## chithanh

Basically you can forget about operating a 5 GHz access point with a consumer card. Only cards intended for AP use will talk on 5 GHz channels before having received packets in that band.

----------

## Bullet Dodger

 *chithanh wrote:*   

> Basically you can forget about operating a 5 GHz access point with a consumer card. Only cards intended for AP use will talk on 5 GHz channels before having received packets in that band.

 

Unless I can find an atheros card that ath_info can change the eepromed regdomain to GB?

(I'm assuming it will be difficult to find a wifi card with a regdomain set to anything other than the world domain).

Or where can I find a mini-pcie wifi card intended for AP use?

----------

## s4e8

 *Bullet Dodger wrote:*   

> 
> 
> Unless I can find an atheros card that ath_info can change the eepromed regdomain to GB?
> 
> (I'm assuming it will be difficult to find a wifi card with a regdomain set to anything other than the world domain).
> ...

 

Atheros linux drivers don't use kernel regdomain, it hard code it in the drivers.

For the 5G bands, there's only 2 profile (drivers/net/wireless/ath/regd.c):

```

#define ATH9K_5GHZ_ALL          ATH9K_5GHZ_5150_5350, \

                                ATH9K_5GHZ_5470_5850

/* This one skips what we call "mid band" */

#define ATH9K_5GHZ_NO_MIDBAND   ATH9K_5GHZ_5150_5350, \

                                ATH9K_5GHZ_5725_5850

```

----------

## turtles

 *chithanh wrote:*   

> Basically you can forget about operating a 5 GHz access point with a consumer card. Only cards intended for AP use will talk on 5 GHz channels before having received packets in that band.

 

This is not about an access point. The problem here is the ath9k driver nolonger works for any ath9k cards since they decided to implement a new "feature" called hyper regulatory domain enforcement / compliance. 

Older  cards not manufactured for the country you are in will associate with an access point then at some point disassociate due to not being manufactured for the country according to this new feature. 

I ran into this problem just trying to use a card the normal way on my laptop  on newer than 2.6.37 kernels I believe.

My card works perfectly with older kernels or newer patched kernels only when the new regulatory feature is disabled. My card also has no issues with the newer kernels associating with an access point that is in the same country code as the card (CO or 00).

The solution to the problem is to remove the regulatory domain stuff from the kernel or use an older kernel.

----------

## Bullet Dodger

 *turtles wrote:*   

>  *chithanh wrote:*   Basically you can forget about operating a 5 GHz access point with a consumer card. Only cards intended for AP use will talk on 5 GHz channels before having received packets in that band. 
> 
> This is not about an access point. 

 

This is entirely about an access point. The actual problem might be bigger than just setting up an access point, but the whole point of this thread is that I bought a wifi card in the UK with the intention of setting up an access point in the 5GHz band, with a card that is capable of transmitting on the 5GHz band in the unlicensed 5GHz band in the UK.

By changing the EEPROM setting I am not doing anything illegal, but I shouldn't have had to in the 1st place.Last edited by Bullet Dodger on Sun Feb 12, 2012 4:05 am; edited 1 time in total

----------

## Bullet Dodger

Ok, 

I think I've gotten 1 step closer.

If you have a spare windows laptop download the EEPROM tool from here: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=491145

Don't forget to press F8 during boot and select disable driver singing enforcement.

I couldn't find the regdomain code for GB, so I went for debug (FF).

This makes hostapd go for Japan (JP) - Probably because it is the most unrestictive.

But I do have country_code=GB in /etc/hostapd/hostapd.conf

I wouldn't recommend any other regdomain than the 1 you are in unless you are prepared for a big fine.

Now I get:

```

# cat /var/log/messages |grep ath

Feb 12 03:39:53 chronos kernel: [   17.809136] ath9k 0000:02:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17

Feb 12 03:39:53 chronos kernel: [   17.809154] ath9k 0000:02:00.0: setting latency timer to 64

Feb 12 03:39:53 chronos kernel: [   17.939585] ath: EEPROM regdomain: 0xff

Feb 12 03:39:53 chronos kernel: [   17.939591] ath: EEPROM indicates we should expect a direct regpair map

Feb 12 03:39:53 chronos kernel: [   17.939599] ath: Country alpha2 being used: JP

Feb 12 03:39:53 chronos kernel: [   17.939602] ath: Regpair used: 0xff

Feb 12 03:39:53 chronos kernel: [   17.979292] ieee80211 phy0: Selected rate control algorithm 'ath9k_rate_control'

Feb 12 03:39:53 chronos kernel: [   17.980915] Registered led device: ath9k-phy0

Feb 12 03:39:53 chronos kernel: [   17.980984] ath9k 0000:03:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19

Feb 12 03:39:53 chronos kernel: [   17.981000] ath9k 0000:03:00.0: setting latency timer to 64

Feb 12 03:39:53 chronos kernel: [   18.031441] ath: EEPROM regdomain: 0x60

Feb 12 03:39:53 chronos kernel: [   18.031448] ath: EEPROM indicates we should expect a direct regpair map

Feb 12 03:39:53 chronos kernel: [   18.031456] ath: Country alpha2 being used: 00

Feb 12 03:39:53 chronos kernel: [   18.031461] ath: Regpair used: 0x60

Feb 12 03:39:53 chronos kernel: [   18.034858] ieee80211 phy1: Selected rate control algorithm 'ath9k_rate_control'

Feb 12 03:39:53 chronos kernel: [   18.040338] Registered led device: ath9k-phy1

# iw phy phy0 info

                Frequencies:

                        * 5180 MHz [36] (20.0 dBm)

                        * 5200 MHz [40] (20.0 dBm)

                        * 5220 MHz [44] (20.0 dBm)

                        * 5240 MHz [48] (20.0 dBm)

                        * 5260 MHz [52] (20.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5280 MHz [56] (20.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5300 MHz [60] (20.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5320 MHz [64] (20.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5500 MHz [100] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5520 MHz [104] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5540 MHz [108] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5560 MHz [112] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5580 MHz [116] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5600 MHz [120] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5620 MHz [124] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5640 MHz [128] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5660 MHz [132] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5680 MHz [136] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5700 MHz [140] (23.0 dBm) (passive scanning, no IBSS, radar detection)

                        * 5745 MHz [149] (disabled)

                        * 5765 MHz [153] (disabled)

                        * 5785 MHz [157] (disabled)

                        * 5805 MHz [161] (disabled)

                        * 5825 MHz [165] (disabled)

```

But when I set channel=36 in /etc/hostapd/hostapd.conf I get:

```

# /etc/init.d/hostapd restart

 * Starting hostapd ...

Configuration file: /etc/hostapd/hostapd.conf

wlan1: IEEE 802.11 Configured channel (36) not found from the channel list of current mode (1) IEEE 802.11g

wlan1: IEEE 802.11 Hardware does not support configured channel

Could not select hw_mode and channel. (-1)

wlan1: Unable to setup interface.

rmdir[ctrl_interface]: No such file or directory

 * start-stop-daemon: failed to start `/usr/sbin/hostapd'                                                                                                                                                  [ !! ]

 * ERROR: hostapd failed to start

```

I have tried changing the line:

hw_mode=g

to 

hw_mode=n

hw_mode=gn

and even commenting the line out

but neither work.

Could it be because the other wifi card is still a world (0x60) regdomain?

Why can't I get a 5GHz channel working?

----------

## Bullet Dodger

Ok, I have taken the other wifi card out and changed it's regdomain to FF.

While the card was out I tried to run hostapd with just the 1 card.

I found I needed the following line in /etc/hostapd/hostapd.conf:

```

hw_mode=a

```

I was then able to start hostapd and connect from a laptop.

I'm now having trouble setting up 2 interfaces in hostapd.

The following will set up 1 ap.

```

logger_syslog=-1

country_code=GB

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=1

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

interface=wlan0

ssid=test

channel=4

hw_mode=g

bridge=br0

driver=nl80211

## Enable wpa/wpa2

macaddr_acl=0

auth_algs=1

ignore_broadcast_ssid=0

wpa=2

wpa_passphrase=password

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

## IEEE 802.11n

ieee80211n=1

wmm_enabled=1

ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]

```

And the following will set up an ap.

```

logger_syslog=-1

country_code=GB

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=1

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

interface=wlan1

ssid=test

channel=44

hw_mode=a

bridge=br0

driver=nl80211

wpa=2

wpa_passphrase=password

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

## IEEE 802.11n

ieee80211n=1

wmm_enabled=1

ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]

ctrl_interface=/var/run/hostapd1

```

But when trying to setup 2 interfaces only 1 appears to work.

Using this config I can connect to test2, but there is no test1 to connect to.

```

# sed -ne '/^[^#]/p' /etc/hostapd/hostapd.conf

logger_syslog=-1

country_code=GB

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=1

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

interface=wlan0

ssid=test1

channel=4

hw_mode=g

bridge=br0

driver=nl80211

macaddr_acl=0

auth_algs=1

ignore_broadcast_ssid=0

wpa=2

wpa_passphrase=password

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

ieee80211n=1

wmm_enabled=1

ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]

interface=wlan1

ssid=test2

channel=44

hw_mode=a

bridge=br0

driver=nl80211

wpa=2

wpa_passphrase=password2

wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP

rsn_pairwise=CCMP

ieee80211n=1

wmm_enabled=1

ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]

ctrl_interface=/var/run/hostapd1

```

----------

## turtles

I am glad you fixed the regulatory part of it.

Sorry I cant be of much help with the hostapd configuration.

 *Bullet Dodger wrote:*   

>  *turtles wrote:*    *chithanh wrote:*   Basically you can forget about operating a 5 GHz access point with a consumer card. Only cards intended for AP use will talk on 5 GHz channels before having received packets in that band. 
> 
> This is not about an access point.  
> 
> This is entirely about an access point. The actual problem might be bigger than just setting up an access point 

 

Thats what I was trying to add to this discussion.

 *Bullet Dodger wrote:*   

> but the whole point of this thread is that I bought a wifi card in the UK with the intention of setting up an access point in the 5GHz band .... .... I am not doing anything illegal, but I shouldn't have had to in the 1st place.

 

I think another solution for this problem would be to add this patch to the regd.c in the 3.2.5 kernel.

The file is in (kernel source dir)drivers/net/wireless/ath

You need to add 

```
#define ATH_USER_REGD 1
```

to the header of that same file.

That made my ath9k driver workable.

----------

## Bullet Dodger

 *turtles wrote:*   

> 
> 
> I think another solution for this problem would be to add this patch to the regd.c in the 3.2.5 kernel.
> 
> The file is in (kernel source dir)drivers/net/wireless/ath
> ...

 

I think I saw that somewhere, but though it only applied to the 2.6 kernels, and I didn't really want to apply a patch every time I updated it.

Thanks to everyone that contributed to this solution. I'll mark it as solved now and kick off a new thread if I still can't get a working hostapd config with 2 interfaces.

----------

