For the past month, I was using cable connection in my office. The reason being – I couldn’t connect to wi-fi!

I never really bothered solving that problem, because I hardly ever had to work without an ethernet cable nearby. This unfortunately has changed today and I had to finally do some NetworkManager troubleshooting.

1. The Scenario

After trying to connect to the office Wi-Fi on my Linux laptop (Arch 4.15), I kept getting the same, annoying error – couldn’t connect to the network.

I figured, the easiest way to get some info about what exactly is going on would be through systemctl, so I ran the following after getting the above mentioned error again:

[root@swz]# systemctl status NetworkManager

Which, obviously, showed me the current status of the NetworkManager.service along with its recent activities:

Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0054] dhcp4 (wlp2s0): state changed unknown -> timeout
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0153] dhcp4 (wlp2s0): canceled DHCP transaction
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0154] dhcp4 (wlp2s0): state changed timeout -> done
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0164] device (wlp2s0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0172] manager: NetworkManager state is now DISCONNECTED
Apr 10 07:03:36 swz NetworkManager[7036]: <warn> [1523351016.0195] device (wlp2s0): Activation: failed for connection 'FBI_Surveillance_Van'
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0209] device (wlp2s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0413] device (wlp2s0): set-hw-addr: set MAC address to 12:BD:1E:E2:02:E9 (scanning)
Apr 10 07:03:36 swz NetworkManager[7036]: <warn> [1523351016.0469] sup-iface[0x562d7723f170,wlp2s0]: connection disconnected (reason -3)
Apr 10 07:03:36 swz NetworkManager[7036]: <info> [1523351016.0469] device (wlp2s0): supplicant interface state: completed -> disconnected

The highlighted line quickly grabbed my attention. I searched the Arch Wiki for answers and eventually found out that this error basically means that there was an error during DHCP auto-configuration – my laptop couldn’t get an IP address from the server.

2. The Solution

The resolution to this issue turned out to be pretty simple. As I couldn’t play around with the settings of the DHCP server itself, I forced it from my NetworkManager level to use dhclient instead of internal DHCP. To do so, all I had to do was:

  1. Install dhclient

[root@swz]# pacman -Syu dhclient

  1. Edit the NetworkManager configuration file…

[root@swz]# nano /etc/NetworkManager/NetworkManager.conf

  1. …and add the following settings to it:

[main]
plugins=ifupdown,keyfile
dhcp=dhclient

[ifupdown]
managed=false

  1. Finally, restart the NetworkManager service:

[root@swz]# systemctl stop NetworkManager
[root@swz]# systemctl start NetworkManager

3. The Conclusion

Pretty simple, isn’t it? Yeah, I wasted far too much time on using Ethernet in the office.

As a side note, this configuration change shouldn’t affect your connectivity to other wi-fi networks, however if you’d run into any issues after applying this, you can always revert by #’ing all the lines in NetworkManager.conf (disabling them, while still keeping them in place for potential future use).