# [solved] iwlwifi: connected to router, but no connection

## bheinze

Hi all,

I succeeded in installing Gentoo on a Thinkpad T430, but I'm having a hard time connecting it to wifi. Actually connecting it to the router is easy, but I can't get any connection or ping to go through. Once I restart the router internet is available immediately.

I run 

```
wpa_supplicant -B -i wlp3s0 -c /etc/wpa_supplicant/wpa_supplicant.conf

dhcpcd
```

Syslog shows:

```
kernel: [  190.961825] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx

kernel: [  190.964190] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)

kernel: [  190.966708] wlp3s0: authenticated

kernel: [  190.966851] wlp3s0: waiting for beacon from 00:26:4d:5c:54:3e

kernel: [  190.979057] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)

kernel: [  190.982921] wlp3s0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0 aid=1)

kernel: [  191.000025] wlp3s0: associated

dhcpcd[1608]: wlp3s0: carrier acquired

dhcpcd[1608]: wlp3s0: IAID yy:yy:yy:yy

dhcpcd[1608]: wlp3s0: rebinding lease of 192.168.2.105

dhcpcd[1608]: wlp3s0: probing address 192.168.2.105/24

dhcpcd[1608]: wlp3s0: leased 192.168.2.105 for infinity

dhcpcd[1608]: wlp3s0: adding route to 192.168.2.0/24

dhcpcd[1608]: wlp3s0: adding default route via 192.168.2.1

dhcpcd[2095]: sending commands to master dhcpcd process

dhcpcd[1608]: control command: dhcpcd
```

ifconfig -a

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

        inet 192.168.2.105  netmask 255.255.255.0  broadcast 192.168.2.255

        ether zz:zz:zz:zz:zz:zz  txqueuelen 1000  (Ethernet)

        RX packets 299  bytes 98234 (95.9 KiB)

        RX errors 0  dropped 1  overruns 0  frame 0

        TX packets 10  bytes 1201 (1.1 KiB)

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

route -n

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.2.1     0.0.0.0         UG    303    0        0 wlp3s0

192.168.2.0     0.0.0.0         255.255.255.0   U     303    0        0 wlp3s0
```

When I ping 192.168.2.1 I get 

```
ping: sendmsg: Network is unreachable
```

I restart the router, wpa_supplicant automatically reconnects, and internet is working fine!

```
dhcpcd[1608]: wlp3s0: carrier lost

kernel: [  458.034666] wlp3s0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 2=PREV_AUTH_NOT_VALID)

dhcpcd[1608]: wlp3s0: deleting route to 192.168.2.0/24

dhcpcd[1608]: wlp3s0: deleting default route via 192.168.2.1

kernel: [  502.355775] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx

kernel: [  502.373667] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)

kernel: [  502.376243] wlp3s0: authenticated

kernel: [  502.376435] wlp3s0: waiting for beacon from xx:xx:xx:xx:xx:xx

kernel: [  502.425036] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)

kernel: [  502.535103] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 2/3)

kernel: [  502.671080] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 3/3)

kernel: [  502.783082] wlp3s0: association with xx:xx:xx:xx:xx:xx timed out

kernel: [  506.451871] wlp3s0: authenticate with xx:xx:xx:xx:xx:xx

kernel: [  506.455163] wlp3s0: send auth to xx:xx:xx:xx:xx:xx (try 1/3)

kernel: [  506.458604] wlp3s0: authenticated

kernel: [  506.458852] wlp3s0: waiting for beacon from xx:xx:xx:xx:xx:xx

kernel: [  506.521038] wlp3s0: associate with xx:xx:xx:xx:xx:xx (try 1/3)

kernel: [  506.524979] wlp3s0: RX AssocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0 aid=1)

kernel: [  506.535726] wlp3s0: associated

dhcpcd[1608]: wlp3s0: carrier acquired

dhcpcd[1608]: wlp3s0: IAID yy:yy:yy:yy

dhcpcd[1608]: wlp3s0: rebinding lease of 192.168.2.105

dhcpcd[1608]: wlp3s0: probing address 192.168.2.105/24

dhcpcd[1608]: wlp3s0: leased 192.168.2.105 for infinity

dhcpcd[1608]: wlp3s0: adding route to 192.168.2.0/24

dhcpcd[1608]: wlp3s0: adding default route via 192.168.2.1
```

Can anyone give me some pointers why wifi only works after a router reset? I don't have any problems connecting to the router using Windows 7 on the same Thinkpad.

Thanks for your help!

BerndLast edited by bheinze on Sun Sep 23, 2018 12:06 pm; edited 1 time in total

----------

## Dalinar

You tried using nmcli instead of the wpa_supplicant? no idea why its not working

Could also maybe try:

```
rc-service wpa_supplicant restart
```

when it fails and specifying the interface for dhcpcd,

whats your net config?

----------

## Logicien

Dhcpcd can start wpa_supplicant by itself if the file /usr/share/dhcpcd/hooks/10-wpa_supplicant is copied, move or linked in the /lib/dhcpcd/dhcpcd-hooks directory:

```
ln -s /usr/share/dhcpcd/hooks/10-wpa_supplicant  /lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant
```

Than you do not need to start the wpa_supplicant service but only the dhcpcd service if the wpa_supplicant configuration file is /etc/wpa_supplicant/wpa_supplicant.conf. Using both wpa_supplicant and dhcpcd services can start twice wpa_supplicant what is to advoid.

You can set /etc/dhdpcd.conf to your needs and to only start wpa_supplicant for the wlp3s0 interfaces instead for all the network interfaces. Here is an example:

```
allowinterfaces wlan0

denyinterfaces br0 eth0 lo tap0

interface wlan0

env wpa_supplicant_driver=nl80211

dhcp
```

If you do not want dhcpcd start wpa_supplicant you can set instead in dhcpcd.conf

```
nohook wpa_supplicant
```

Is you router filter connexions by MAC addresses?

----------

## bheinze

 *Dalinar wrote:*   

> You tried using nmcli instead of the wpa_supplicant? no idea why its not working

 

No didn't try it yet. I thought wpa_supplicant would be the easiest to use.   :Laughing: 

 *Dalinar wrote:*   

> whats your net config?

 

```
#

# The network configuration file. This file is currently only used in

# conjunction with the TI-RPC code in the libtirpc library.

#

# Entries consist of:

#

#       <network_id> <semantics> <flags> <protofamily> <protoname> \

#               <device> <nametoaddr_libs>

#

# The <device> and <nametoaddr_libs> fields are always empty in this

# implementation.

#

udp        tpi_clts      v     inet     udp     -       -

tcp        tpi_cots_ord  v     inet     tcp     -       -

udp6       tpi_clts      v     inet6    udp     -       -

tcp6       tpi_cots_ord  v     inet6    tcp     -       -

rawip      tpi_raw       -     inet      -      -       -

local      tpi_cots_ord  -     loopback  -      -       -

unix       tpi_cots_ord  -     loopback  -      -       -
```

 *Logicien wrote:*   

> Using both wpa_supplicant and dhcpcd services can start twice wpa_supplicant what is to advoid.

 

Good point. I stopped dhcpcd service and started wpa_supplicant and dhcpcd manually. But no success...

 *Logicien wrote:*   

> Is you router filter connexions by MAC addresses?

 

No, no filter of any kind on the router.

One thing I noticed on https://wiki.gentoo.org/wiki/Iwlwifi is I should set the following kernel options.

```
[*] Networking support  --->

    [*] Wireless  --->

        <*>   cfg80211 - wireless configuration API

        <*>   Generic IEEE 802.11 Networking Stack (mac80211)

        [*]   Minstrel

        [*]     Minstrel 802.11n support

        [ ]       Minstrel 802.11ac support
```

However the "Minstrel 802.11n support" doesn't show up in my kernel configuration (make menuconfig). Was it removed in newer Kernel settings or do I have some kind of buggy kernel config?

----------

## NeddySeagoon

bheinze,

Its still there.

```
 CONFIG_MAC80211_RC_MINSTREL_HT:                                                                            │  

  │                                                                                                            │  

  │ This option enables the 'minstrel_ht' TX rate control algorithm                                            │  

  │                                                                                                            │  

  │ Symbol: MAC80211_RC_MINSTREL_HT [=y]                                                                       │  

  │ Type  : bool                                                                                               │  

  │ Prompt: Minstrel 802.11n support                                                                           │  

  │   Location:                                                                                                │  

  │     -> Networking support (NET [=y])                                                                       │  

  │       -> Wireless (WIRELESS [=y])                                                                          │  

  │         -> Minstrel (MAC80211_RC_MINSTREL [=y])                                                            │  

  │   Defined at net/mac80211/Kconfig:30                                                                       │  

  │   Depends on: NET [=y] && WIRELESS [=y] && MAC80211 [=y] && MAC80211_RC_MINSTREL [=y]                      │  

  │         
```

                                                                                                   │  

Notice the Depends on:.  The option will be hidden until that boolean expression evaluates to true.

-- edit --

In menuconfig, press 'z' to toggle the display of hidden options. Even though you can now see, search and navigate to the option, it will stay unelectable until you (recursively) fix the Depends on:

----------

## Dalinar

 *bheinze wrote:*   

>  *Dalinar wrote:*   You tried using nmcli instead of the wpa_supplicant? no idea why its not working 
> 
> No didn't try it yet. I thought wpa_supplicant would be the easiest to use.  
> 
>  *Dalinar wrote:*   whats your net config? 
> ...

 

Sorry, by your net config I meant your /etc/conf.d/net   :Laughing: 

Also try using nm, neither is easier tbh but nm does have a tui option which can sometimes be nice

If you cant connect to the internet you can always goto https://packages.gentoo.org/packages/net-misc/networkmanager , download ver 1.10.10 on another device then copy it across to your /usr/portage/distfiles then just merge as normal c:

try running nmtui after you've merged and connect through that

----------

## bheinze

 *NeddySeagoon wrote:*   

> bheinze,
> 
> Notice the Depends on:.  The option will be hidden until that boolean expression evaluates to true.
> 
> -- edit --
> ...

 

If I press 'z' it does indeed show up:

```
  │ │         <*>   Generic IEEE 802.11 Networking Stack (mac80211)                           │ │  

  │ │               *** CFG80211 needs to be enabled for MAC80211 ***                         │ │  

  │ │         -*-   Minstrel                                                                  │ │  

  │ │         -*-     Minstrel 802.11n support                                                │ │  

  │ │         - -       Minstrel 802.11ac support                                             │ │  

  │ │               Default rate control algorithm (Minstrel)  --->                           │ │  

  │ │               *** Some wireless drivers require a rate control algorithm ***            │ │  
```

But when I look into the option all requirements are met, why doesn't it show up by default?

```
  │ Symbol: MAC80211_RC_MINSTREL_HT [=y]                                                        │  

  │ Type  : boolean                                                                             │  

  │ Prompt: Minstrel 802.11n support                                                            │  

  │   Location:                                                                                 │  

  │     -> Networking support (NET [=y])                                                        │  

  │       -> Wireless (WIRELESS [=y])                                                           │  

  │         -> Minstrel (MAC80211_RC_MINSTREL [=y])                                             │  

  │   Defined at net/mac80211/Kconfig:30                                                        │  

  │   Depends on: NET [=y] && WIRELESS [=y] && MAC80211 [=y] && MAC80211_RC_MINSTREL [=y]       │  
```

On a different note, I finally solved the problem:

I compiled the iwlwifi as a module and passed the option '11n_disable=1' to the iwlwifi module. Works like a charm now.

----------

## NeddySeagoon

bheinze,

```
 -*-     Minstrel 802.11n support
```

That  -*- means forced on by another selection. You may not deselect it.

----------

## bheinze

 *bheinze wrote:*   

> 
> 
> On a different note, I finally solved the problem:
> 
> I compiled the iwlwifi as a module and passed the option '11n_disable=1' to the iwlwifi module. Works like a charm now.

 

For the record: I received a new router and at regular intervals I had no network access after connecting to the access point. As before I was connected to the AP, but couldn't even ping the router.

Further research showed this happens (only?) when being connected at 5GHz (even though I disabled 11n???), connection at 2.4GHz was fine.

This time the solution was setting the parameter 11n_disable=8.

----------

## deagol

You have multiply key symptoms of a nasty but assumed to be rare "bug":

It could be your new AP is rekeying the PTK key frequently while the old one is not. And rekeying the PTK is known to freeze wifi connections till you reconnect or wait for the next rekey. (Windows clients may seem fine and the AP can still be broken...) 

With iwlwifi and a linux kernel >= 4.20 this should be no longer an issue. But only if your AP is also handling that correctly, which is questionable...

Which kernel are you using? And can you check with a kernel >=4.20 if you either get the following warning message in the log around the time it normally freezes or when it freezes?

```
Rekeying PTK for STA XX:XX:XX:XX:XX:XX but driver can't safely do that.
```

If so try to disable PTK rekey (or when in question everything related to rekey) on the AP.

----------

## bheinze

Thanks for the input, this sounds like my problem.

I'm still running on the latest stable gentoo kernel, which is is 4.19, but I'll keep it in mind once the new LTS kernel is released.

Unfortunately the router is electronic junk, so no low-level settings available.

----------

