# [solved]command line connect to wireless lan

## skorefish

Hello,

What are the steps to connect to a wireless lan from the command line. 

I want to use a fix ip adress for the wlan.Last edited by skorefish on Wed Jul 22, 2015 8:20 pm; edited 1 time in total

----------

## Tony0945

ssh? What do you mean by "connect to a wireless lan"? Control the lan? Log in to another computer?  Or do you have a wireless computer and wish to connect to the lan? I can't think of any other situation where it would matter if the lan was wired or wireless.   If that's it see https://wiki.gentoo.org/wiki/Wpa_supplicant

----------

## Roman_Gruber

something like, when you use the old naming sheme. (net-ifnames=0 or so on the kernel command line during booting)

ifconfig -a

ifconfig eth0 down

ifconfig wlan0 up

when you type wpa_supplicant

 *Quote:*   

> 
> 
> wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

 

And this is kinda the command line i use on my other box. You just need the config file as shown above: /etc/wpa_supplicant.conf

And thats tricky on the wireless stuff in question. 

and than i think also Dhcpcd wlan0 

I start the network as root on every login myself. I dislike those autoscripts because they hardly worked for myself.

I see instantly if i have a connection or not and leave the terminal open and thats it. Maybe I am too oldfashioned ...

also check if your wlan card is recognized and has the firmware needed ... wlan cards usually need some firmware and some kernel settings / modules

----------

## skorefish

 *Quote:*   

>  wlan cards usually need some firmware and some kernel settings / modules

 

Do you know a good link for the firmware ? I have a Qualcom Atheros AR9485 wireless card

----------

## skorefish

 *Quote:*   

> Or do you have a wireless computer and wish to connect to the lan?

 that's what i'm looking for   :Very Happy: 

----------

## Roman_Gruber

 *skorefish wrote:*   

>  *Quote:*    wlan cards usually need some firmware and some kernel settings / modules 
> 
> Do you know a good link for the firmware ? I have a Qualcom Atheros AR9485 wireless card

 

google is your friend

http://ubuntuforums.org/showthread.php?t=2201597

 *Quote:*   

> 
> 
> ubuntu:~$ lspci -nnk | grep -A2 0280
> 
> 03:00.0 Network controller [0280]: Qualcomm Atheros AR9485 Wireless Network Adapter [168c:0032] (rev 01)
> ...

 

=> Kernel driver in use: ath9k

----------

## skorefish

 *Quote:*   

> Kernel driver in use: ath9k

 

yes, I installed that one, so this is the firmware ?

but still can't connect...

----------

## Roman_Gruber

Did you followed the hints there?

Did you checked similar linux pages on "google" for that card? and applied the solutions?

the ubuntu page above covers quite everything.

maybe the firmware for your card is in that package:

qlist -Iv firmware

sys-kernel/linux-firmware-20150320

may i kindly ask you to research that topic?

```
but still can't connect...
```

could be anything... you need to be more specific

It is also advised to do some reading and apply those solutions and follow the guides. most of the time the issue is solved than.

--

well you may post anything relevant, starting with wpa_supplicant.conf / lsmod output, which protocol in question you are using for wifi and such... and the command line output of the "i can not connect issue"...

It also helps when you try first to connect without security to that wifi node, to check if the card works at all.

--

```
iwconfig wlan0 scan

```

So wahts there? that should give you a general idea if your wlan card works or not. if you see your node than you need to set up correct your config file or pass everything in the command line for wpa_supplicant.conf

----------

## Tony0945

Example of a working /etc/wpa_supplicant.conf. only the SSID and passphrase have been changed to protect the not so innocent:

 *Quote:*   

> # The below line not be changed otherwise we refuse to work
> 
> ctrl_interface=/var/run/wpa_supplicant
> 
> # Ensure that only root can read the WPA configuration
> ...

 

Have you symlinked /etc/net.wlan0 to /etc/net.lo?

Have you added net.wlan0 to rc-update boot level?

 *Quote:*   

> 
> 
> ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0
> 
> rc-update add net.wlan0 boot

 

Post some logs showing errors.

----------

## skorefish

i made it a little simpeler and threw out the security. After a few commands i can ssh the other computer in my network, so the card works.

```
 

ifconfig eth0 down

ifconfig wlan0 up

iwconfig wlan0 essid MirrOrNet

ifconfig wlan0 192.168.2.1

ping 192.168.2.1

```

but there is a problem with the naming server.

----------

## Tony0945

/etc/resolv.conf again with the domain name changed:

 *Quote:*   

> 
> 
> # Generated by dhcpcd from eth0.dhcp
> 
> # /etc/resolv.conf.head can replace this line
> ...

 

Supposedly you can have three nameserver lines, but I've never seen it use anything more than two.

Look again at the file I posted above. If you are using WPA2 (and if not why not?) all you need to do is add your SSID and passphrase.

PUT THE SECURITY BACK!!!

----------

## skorefish

I put the security back up, now trying to work with the wpa_supplicant

see my command + result here: 

https://bpaste.net/show/b4fcf44b778b

It complains about RFKILL, don't know what to do with it...

I tried the resolv.conf yesterday, but it only works for my eth0 connection, not for the wlan0

----------

## skorefish

 *Quote:*   

> rfkill: Cannot open RFKILL control device
> 
> WEXT: RFKILL status not available

 

solution: check RF_Switch subsystem in kernel .conf

----------

## skorefish

Ok, the rfkill problem is solved but now it is not clear why it still won't connect. Please help

https://bpaste.net/show/f251aa6398f6

my router uses TKIP/AES WPA/PSK WPA2/PSK

So i want to use the WPA2/PSK

TKIP versu AES i don't know yet

----------

## Tony0945

 *skorefish wrote:*   

> Ok, the rfkill problem is solved but now it is not clear why it still won't connect. Please help
> 
> https://bpaste.net/show/f251aa6398f6
> 
> my router uses TKIP/AES WPA/PSK WPA2/PSK
> ...

 

My router is set for WPA2 & AES. Use my wpa_supplicant.conf and you shouldn't have any trouble.

Is your router perhaps set to only accept a certain list of MAC addresses? Check your router log for error messages.

----------

## mir3x

```
wlan0: Failed to initialize driver interface

Failed to add interface wlan0
```

and 

```
l2_packet_init: socket(PF_PACKET): Address family not supported by protocol
```

 ( when  connecting with wext )

Thats problem not some MAC address.

Thats in both cases ( first with wext and second with nl80211), so

u miss some network option in kernel.

Maybe Networking support -> Nwetwroking options -> packet socket (CONFIG_PACKET)

If it doesnt work check all networking options and where u see "If unsure, say Y." then mark so  :Very Happy: 

----------

## skorefish

hi thx a lot, 

the wifi works !!!  :Laughing: 

----------

