# [Solved] Broadcom BCM4312 configuring via wpa_supplicant

## ShanaXXII

Not sure how to configure wpa_supplicant..   :Embarassed: 

read this: https://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&chap=4#doc_chap2

got stuck after realizing I dont know what to put as the driver. I have a Broadcom BCM4312 but im not sure what to write in the wpa_supplicant_eth0=" "

Also, I see a lot of other stuff on the web where theirs are wpa_supplicant_wlan0 instead of eth0. why is that?

and how do i make a ASCII passphrase? http://en.wikipedia.org/wiki/ASCII#ASCII_control_characters

do i type it in binary or something?

Thank you in advancedLast edited by ShanaXXII on Wed Oct 01, 2014 12:23 pm; edited 2 times in total

----------

## Telemin

hi there,

Don't worry about being confused, we all started off in the same boat as you are now  :Smile: 

The manual is a bit unhelpful there as there a very few wifi drivers which are not in-kernel these days. Basically all the in kernel drivers use the nl80211 wireless stack, and so you want -Dnl80211.  If that doesn't work, then the older "wireless extensions" stack should do the trick.  You most likely simply want a setup with:

```

# /etc/conf.d/wpa_supplicant

wpa_supplicant_args="-Dnl80211"

#if that fails try

#wpa_supplicant_args="-Dwext"

```

and 

```

# /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel  # this line specifies a "control socket", it is not necessary, but it allows any member of wheel to use wpa_cli to control wpa_supplicant behaviour.

network={

  ssid="my_ssid"

  psk="myp4$$phr4$3"

}

```

-Telemin-

----------

## khayyam

 *Telemin wrote:*   

> 
> 
> ```
> # /etc/conf.d/wpa_supplicant
> 
> ...

 

Telemin ... /etc/conf.d/wpa_supplicant is only used if the /etc/init.d/wpa_supplicant service is used, which generally isn't the case as most often wpa_supplicant is started via 'net.wlan0'. To provide the same parameter one would do the following:

/etc/conf.d/net

```
wpa_supplicant_wlan0="-Dnl80211"
```

@ShanaXXII ... "eth0" (or whatever your interface is called) is "wired interface", whereas "wlan0" is "wireless interface".

 *ShanaXXII wrote:*   

> [...] how do i make a ASCII passphrase?

 

Not sure what you're asking exactly, if the passphrase from the AP is 'psk' then use 'psk=A1B2C3D4E5etc' in wpa_supplicant.conf, if you need to generate a psk *from* an ASCII passphrase then you can do the following ...

```
# wpa_passphrase <ESSID> passphrase
```

HTH & best ... khay

----------

## ShanaXXII

so this is what my /etc/conf.d/net looks like so far

```
 # /etc/conf.d/net

modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dn180211"

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

network={

SSID="TP-LINK_62ECB4"

psk="The password to my wifi"

priority=5

}
```

and 

```
 # /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

network={

ssid="TP-LINK_62ECB4"

proto=WPA

key_mgmt=WPA-PSK

pairwise=CCMP TKIP

group=CCMP TKIP WEP104 WEP40

psk="my wifi password"

priority=2

}
```

is there anything wrong?

----------

## khayyam

 *ShanaXXII wrote:*   

> is there anything wrong?

 

ShanaXXII ... yes :) ... you have stuff (from wpa_supplicant.conf) in /etc/conf.d/net ... something like the following should be sufficent ...

/etc/conf.d/net

```
modules_wlan0="!plug wpa_supplicant dhcpcd"

wpa_supplicant_wlan0="-Dnl80211 -qq"

config_wlan0="dhcp"

enable_ipv6_wlan0="false"
```

Also you had "n180211" (digit, one) and not "nl80211" (lower case "el").

For the wpa_supplicant.conf most of the parameters can be left out as wpa_supplicant will generally be able to auto detect them and select the best available.

/etc/wpa_supplicant/wpa_supplicant.conf

```
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel

network={

   ssid="TP-LINK_62ECB4"

   proto=WPA2 # I don't imagine the TP-Link won't support wpa2

   psk="my wifi password"

   priority=2

}
```

best ... khay

----------

## ShanaXXII

 *khayyam wrote:*   

> 
> 
> /etc/conf.d/net
> 
> ```
> ...

 

okay. So I changed my /etc/conf.d/net and etc/wpa_supplicant/wpa_supplicant.conf

How do i know if i have wireless connection or if wireless connection has started? and how do i start it?

----------

## khayyam

 *ShanaXXII wrote:*   

> okay. So I changed my /etc/conf.d/net and etc/wpa_supplicant/wpa_supplicant.conf
> 
> How do i know if i have wireless connection or if wireless connection has started? and how do i start it?

 

ShanaXXII ... you should now be able to start the service ... if you created the symlink to net.lo

```
# ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0

# /etc/init.d/net.wlan0 start
```

If you want the the wireless connection to start when booting you can add it to the 'default' runlevel

```
rc-update add net.wlan0 default
```

Assuming there are no errors you should then be able to either test, or use, the network

```
# wpa_cli status

# iwconfig wlan0

# ping -c 1 204.187.15.12

# ping -c 1 forums.gentoo.org
```

best ... khay

----------

## ShanaXXII

 *khayyam wrote:*   

> 
> 
> ```
> # ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0
> 
> ...

 

it gave me:

```
# ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0

# /etc/init.d/net.wlan start

* Caching service dependencies ... [ok]

* Bringing up interface wlan0

*  ERROR: interface wla0 does not exist

* Ensure that you have loaded the correct kernel module for your hardware

* ERROR: net.wlan0 failed to start
```

I have a Broadcom BCM4312 802.11b/g LP-PHY

and in my genkernel, i put 

```
Device Drivers->

Network Device support->

Wireless LAN->

<*> Broadcom 43xx wireless support (mac80211 stack)

[*] Support for low-power (LP-PHY) devices

<*> Broadcom IEEE802.11n embedded FULLMAC WLAN Driver
```

is there something im missing>?

----------

## khayyam

ShanaXXII ...

there is some odd output in the above ('net.wlan", "wla0") I'll assume you typed this by hand and that these are typos. So, lets see what the name of your wireless interface actualy is, this way we know if the device is recognised and the drivers are available ... can you post the output of 'ifconfig -a' (as it looks like your typing this by hand just provide the names of the interfaces on the left column).

here I have ...

```
# ifconfig -a | awk '/^[[:alpha:]]/{print $1}'

lo

wlan0
```

That is the 'loopback' (lo) interface, and the wireless interface (wlan0) ... the ethernet (wired network) driver currently isn't loaded. I suspect that you're using udev and the wireless device has been renamed 'wlp2s0' (or similar).

best ... khay

----------

## ShanaXXII

 *khayyam wrote:*   

> can you post the output of 'ifconfig -a' (as it looks like your typing this by hand just provide the names of the interfaces on the left column).
> 
> here I have ...
> 
> ```
> ...

 

okay. Idk how to copy text in terminal sorry.   :Embarassed: 

but here: 

```
# ifconfig -a

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

             inet ***.***.**.*** netmask 255.255.255.0 broadcast ***.***.**.***

             inet6 fe80::baac:6fff:fe6d:c625 prefixlen 64 scopeid 0x20<link>

             ether b8:ac:6f:6d:c6:25 txqueuelen 1000 (Ethernet)

             RX packets 15090 bytes 18392099 (17.5MiB)

             RX errors 0 dropped 0 overruns 0 frame 0

             TX packets 11274 bytes 1435579 (1.3 MiB)

             TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

            inet 127.0.0.1 netmask 255.0.0.0

            inet6 ::1 prefixlen 128 scopeid 0x10<host>

            loop txqueuelen 0 (Local Loopback)

            RX packets 48 bytes 3456 (3.3 Kib)

            RX errors 0 dropped 0 overruns 0 frame 0

            TX packets 48 bytes 3456 (3.3 KiB)

            TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```

----------

## khayyam

ShanaXXII ... ok, so there is no wireless interface, this means that either the driver isn't loaded or the kernel/driver is missing something (possibly firmware).

I've not had any experience with this particular card, so I'm not sure what exactly needs to be done here (or even if the in kernel driver is the best option ... as there is also net-wireless/broadcom-sta). I'll assume that the in kernel driver will work so assuming you haven't installed net-wireless/b43-fwcutter and got the required firmware please try the following (you will need to have network for this so if you have no ethernet then you will need to use a boot disk that supports your wireless card):

```
# cd /usr/src

# wget -O broadcom-wl-4.178.10.4.tar.bz2 http://downloads.openwrt.org/sources/broadcom-wl-4.178.10.4.tar.bz2

# tar -xjvf broadcom-wl-4.178.10.4.tar.bz2

# cd broadcom-wl-4.178.10.4/linux

# emerge net-wireless/b43-fwcutter

# b43-fwcutter -w /lib/firmware wl_apsta.o

# modprobe -r b43

# modprobe b43

# ifconfig -a
```

Hopefully this will be enough to get the card working, if not then post the relevant sections from 'dmesg'.

best ... khay

----------

## ShanaXXII

 *khayyam wrote:*   

> 
> 
> ```
> # cd /usr/src
> 
> ...

 

I did everything in the above. when I did 

# modprobe -r b43 it gave me an error saying:

modprobe: FATAL: Module b43 is builtin.

I continued and did the rest and my # ifconfig -a:

```
# ifconfig -a

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

             inet ***.***.**.*** netmask 255.255.255.0 broadcast ***.***.**.***

             inet6 fe80::baac:6fff:fe6d:c6:25 prefixlen 64 scopeid 0x20<link>

             ether b8:ac:6f:6d:c6:25 txqueuelen 1000 (Ethernet)

             RX packets 74277 bytes 91611121 (87.3MiB)

             RX errors 0 dropped 0 overruns 0 frame 0

             TX packets 47955 bytes 5296953 (5 MiB)

             TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

            inet 127.0.0.1 netmask 255.0.0.0

            inet6 ::1 prefixlen 128 scopeid 0x10<host>

            loop txqueuelen 0 (Local Loopback)

            RX packets 48 bytes 3456 (3.3 Kib)

            RX errors 0 dropped 0 overruns 0 frame 0

            TX packets 48 bytes 3456 (3.3 KiB)

            TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```

:/

----------

## ShanaXXII

khayyam, I did a # iwconfig and it gave me this:

```
# iwconfig

lo no wireless extensions.

enp4s0 no wireless extensions.

wlan0 IEEE 802.11bg ESSID:"TP-LINK_62ECB4"

          Mode:Managed Frequency:2.442 GHz Access Point: 64:70:02:62:EC:B4

          Bit Rate=5.5 Mb/s   Tx-Power=20 dBm

          Retry  long limit:7   RTS thr:off      Fragment thr:off

          Encryption key:off

          Power Management: off

          Link Quality=70/70 Signal Level=22 dBm

          Rx invalid nwid:0  Rx invalid crypt:0 Rx invalid frag:0

          Tx excessive retries:0   Invalid misc:17     Missed beacon:0
```

I also got errors when booting. stuff like

```
* net.wlan0 has started but is inactive

* failed to start start-stop daemon /usr/sbin/wpa_supplicant

* failed to start wpa_supplicant

* ERROR: wpa_supplicant failed to start
```

not sure if this is helpful or not :/

----------

## khayyam

 *ShanaXXII wrote:*   

> 
> 
> ```
> wlan0 IEEE 802.11bg ESSID:"TP-LINK_62ECB4"
> 
> ...

 

ShanaXXII ... that shows you connected.

 *ShanaXXII wrote:*   

> I also got errors when booting. stuff like
> 
> ```
> * net.wlan0 has started but is inactive
> 
> ...

 

Ummm .... I'm confused, because the above shows the connection established. This could just be a typo somewhere in your configuration but I don't know why it fails but you still get connected ... is that the exact error, you don't also have wpa_supplicant in the runlevel?

best ... khay

----------

## ShanaXXII

 *khayyam wrote:*   

> 
> 
>  *ShanaXXII wrote:*   I also got errors when booting. stuff like
> 
> ```
> ...

 

U are right, I do have wireless connection  :Smile: . Thank you. 

but i still have the errors when booting up. It hangs there for about 10 secs or so. and I said something about deleting var/run/wpa_suppllcant/wlan0 if its not needed

:/

----------

## khayyam

 *ShanaXXII wrote:*   

> U are right, I do have wireless connection :). Thank you.

 

ShanaXXII ... good and you're welocme :)

 *ShanaXXII wrote:*   

> but i still have the errors when booting up. It hangs there for about 10 secs or so. and I said something about deleting var/run/wpa_suppllcant/wlan0 if its not needed

 

can you provide the output of 'rc-status'

best ... khay

----------

## ShanaXXII

 *khayyam wrote:*   

> can you provide the output of 'rc-status'
> 
> best ... khay

 

okay:

```
 # rc-status

Runlevel: default

 wpa_supplicant [stopped]

 dhcpcd              [started]

 net.eth0             [stopped]

 netmount           [stopped]

 local                   [started]

Dynamic Runlevel: hotplugged

 net.wlan0           [started]

Dynamic Runlevel: needed

Dynamic Runlevel: manual
```

----------

## khayyam

 *ShanaXXII wrote:*   

> 
> 
> ```
>  # rc-status
> 
> ...

 

ShanaXXII ... wpa_supplicant is in the default runlevel and should be removed ... net.wlan0 will start wpa_supplicant so by having both wpa_supplicant and net.wlan0 start there would be a conflict, that was probably the cause of the above error.

```
# rc-update del wpa_supplicant default
```

Everything should now be error free ... if not let me know.

best ... khay

----------

## ShanaXXII

Yes, everything is working fine now khay. Thank you very much  :Smile: 

----------

## ShanaXXII

One last question: if i wanted to connect to another wireless connection. Do I have to erase the setup i had with this wireless connection -> /etc/wpa_supplicant/wpa_supplicant.conf.

or can i just start another bracket and write it there?  

e.g.

```
network={

              ssid="TP-LINK_62ECB4"

              proto=.....

              ...........

              ......

}

network={

               ssid="rogers...."

                  ......

}
```

----------

## khayyam

ShanaXXII ... yes, you can have as many 'network' blocks as needed, you can also provide names for these networks with 'id_str='. If one or other network isn't available wpa_supplicant well select one that is (based on 'priority=').

There are many ways to go about switching networks, I use wpa_cli but you might want to add the 'qt4' useflag and use wpa_gui (your user will need to be in the wheel group).

best ... khay

----------

## ShanaXXII

Solution:

```
# cd /usr/src 

# wget -O broadcom-wl-4.178.10.4.tar.bz2 http://downloads.openwrt.org/sources/broadcom-wl-4.178.10.4.tar.bz2

# tar -xjvf broadcom-wl-4.178.10.4.tar.bz2 

# cd broadcom-wl-4.178.10.4/linux 

# emerge net-wireless/b43-fwcutter 

# b43-fwcutter -w /lib/firmware wl_apsta.o 

# modprobe -r b43 

# modprobe b43 

# ifconfig -a
```

```
# nano -w /etc/conf.d/net

wpa_supplicant_wlan0="-Dnl80211 -qq"

config_wlan0="dhcp"

enable_ipv6_wlan0="false"
```

```
# nano -w /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel

ap_scan=1

network={

   ssid="wifi_name"

   proto=WPA2

   psk="wifi_password"

   priority=2

}
```

----------

