# [Solved] Configuring wireless network

## Blind_Sniper

Hi!

Need help with configuring wireless network.

lspci:

```
02:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter
```

lspci -nkk:

```
02:00.0 0280: 168c:0032 (rev 01)

        Subsystem: 168c:3118

        Kernel driver in use: ath9k
```

/etc/conf.d/net:

```
config_eth0="192.168.1.7 netmask 255.255.255.0 brd 192.168.1.255"

routes_eth0="default via 192.168.1.1"

config_wlan0="192.168.1.77 netmask 255.255.255.0 brd 192.168.1.255"

routes_wlan0="default via 192.168.1.1"

modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dnl80211"
```

/etc/init.d/wpa_supplicant/wpa_supplicant.conf:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

network={

  ssid="access_point_name"

  psk="password"

  priority=1

}
```

Kernel module seems loaded, adapter itself is good (works fine in Windows).

When I trying to start it I getting this:

```
# wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf 

Successfully initialized wpa_supplicant

rfkill: Cannot open RFKILL control device
```

nothing more.

I tried to stop wired ethernet before running wpa_supplicant but it doesn't help much

```
# ifconfig -a

eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500

        ether d0:27:88:7d:e8:c6  txqueuelen 1000  (Ethernet)

        RX packets 1301  bytes 1029241 (1005.1 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1142  bytes 193672 (189.1 KiB)

        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

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 131  bytes 12172 (11.8 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 131  bytes 12172 (11.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 64:70:02:ec:ac:86  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

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

Am I missed something?Last edited by Blind_Sniper on Sun Mar 17, 2019 4:57 pm; edited 1 time in total

----------

## NeddySeagoon

Blind_Sniper,

RFKILL support in your kernel?

```
$ grep KILL /usr/src/linux/.config

# CONFIG_RFKILL is not set
```

That's the wrong answer for you.

----------

## Blind_Sniper

Thanks for the reply.

I added rfkill option and rebuilt kernel, but still no luck.

The only change is that the message from wpa_supplicant

```
rfkill: Cannot open RFKILL control device
```

disappeared.

ifconfig doesn't show that wlan0 interface is running, only is "UP"

May be something wrong with /etc/conf.d/net ?

Physically eth0 and wlan0 they are from different devices (routers). Wired router is mine, wireless - my neighbor's router.

I asked my neighbor for using his connection when my connection fails (it occurs for an hour or so every couple of months),  and he gave me his wifi password.

But both routers has the same address 192.168.1.1. 

I think it shouldn't be a problem because in the windows wifi card works fine with both router (wifi card getting 192.168.1.3 address, ethernet card has 192.168.1.2 address)

Assuming it shouldn't be a problem, because I cannot connect even to my own wifi. So it seems not an ip addresses problem

----------

## NeddySeagoon

Blind_Sniper,

Maybe the WiFi transmitter is off?

What does the rfkill command say?

Some systems have a hardware switch that controls the TX power, like a light switch.

Some have a hardware switch that signals the kernel.

Others expect you to use the rfkill command to control the WiFi transmitter. 

Both routers being in the same subnet will case your networking to fail if both eth0 and wlan0 are active at the same time.

You can have at most, one default route.  

Does the wifi have an IP address?

A link local address, starting 169. doesn't count.

----------

## Jaglover

I'd look at dmesg for clues.

----------

## Blind_Sniper

Transmitter (router) is up and running, I can connect to it from phone, signal strength +39 dB. WiFi card  has a led which is green.

rfkill output:

```
# rfkill

ID TYPE DEVICE      SOFT      HARD

 0 wlan phy0   unblocked unblocked
```

I do not try to connect to both routers simultaneously. I stopping eth0 before running 

```
ifconfig -v wlan0 up
```

it's an ifconfig output with stopped eth0:

```
# ifconfig -a

eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500

        ether d0:27:88:7d:e8:c6  txqueuelen 1000  (Ethernet)

        RX packets 121322  bytes 156183051 (148.9 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 47451  bytes 6162648 (5.8 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

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 1  bytes 80 (80.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1  bytes 80 (80.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 64:70:02:ec:ac:86  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

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

wlan0 has no ip address assigned. Running wpa_supplicant doesn't assign ip address to wlan0 too.

dmesg only reflects eth0 (r8169) related messages (Link is down / Link is up) when I stoppong and starting /etc/init.d/net.eth0. Nothing related to wlan0 interface or ath9k module.

----------

## krinn

Do note that "ifconfig interface up" just bring up the interface, it doesn't assign any IP to it, nor it would sent a dhcp query.

you can set this within ifconfig (wlan0 start should bring it up, but also setup properly ip and route to use), but as-is, using ifconfig to bring the interface up is not enough for the interface to work.

you could "ifconfig wlan0 192.168.1.77" or dhcpcd wlan0

----------

## Blind_Sniper

OK, got it working.

Apart from assigning ip address, interface should be tied to gateway. It strange that settings in /etc/conf.d/net getting ignored, so I have to do it manually.

Finally my wifi script looks like this:

```
#!/bin/bash

/etc/init.d/net.eth0  stop

ifconfig -v wlan0 up

ifconfig wlan0 192.168.1.77

ip route add default via 192.168.1.1 dev wlan0

wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -dd
```

Now it works.

Thanks you all for your help.

----------

