How to set wifi driver settings to prefer 5 GHz channel above 2.4 GHz

Currently I'm in a new building of my university. In this building my wifi often breaks down and then restores connection again. This is really irritating since it happens a lot.

Now as a coincidence there were some tech guys running around here and where asking everyone if the wifi was doing fine. I told them that my wifi tears down all the time and then reconnects. They figured out that my wifi is switching all the time between the 2.4 GHz channel and 5 GHz channel. They asked me if I could acces the driver settings of my wireless card. Unfortunately I don't know how to do this is in either Linux or Windows. And unfortunately again they only knew the windows solution xD.

So I hope somebody can tell me how I tell my wifi that it should stay on the 5 GHz network and not disconnect and switch to the 2.4 GHz channel?

-edit-

@arhimed, firstly thank you for your help.

I just tried what you said. It is some what different for me. I can't seem to save the settings when I change the setting and choose to use only the 5 GHz band.

"Network connections"->"Select the appropriate wireless network and click edit"->"In the wireless tab"->"Change the mode from infrastructure to ad-hoc"->"Choose 5 GHz band"

Wireless connection settings panel

However when I want to change the mode from infrastructure to ad-hoc the "save" button tells me that I have to authenticate myself. However I get no pop-up asking me for a password. Using sudo gnome-control-center didn't help either. I could still not save it. Also a error occured then in the terminal:

** (nm-connection-editor:5577): WARNING **: Invalid setting Wireless Security: Security not compatible with Ad-Hoc mode

Hopefully this is some useful info for you to help me further.


Solution 1:

Run:

$ iwlist wlan0 scanning | grep -C3 <name of your network>

You should find 2 entries for the network, for example:

Cell XX - Address: 11:11:11:11:11:11 // This will be different in your machine
ESSID: "name of your network" // This will be different on your machine
Protocol: IEEE 802.11bgn
Mode: Master
Frequency: 2.437 Ghz

--

Cell XX - Address: 22:22:22:22:22:22 // This will be different on your machine
ESSID: "name of your network // This will be different on your machine
Protocol: IEEE 802.11AC
Mode: Master
Frequency: 5.18 Ghz
  • BSSID for the 5Ghz Network, in this example: 22:22:22:22:22:22
  • BSSID for the 2.4 Ghz Network, in this example: 11:11:11:11:11:11

Now what you do is:

  1. click on 'Network Connections'
  2. 'Edit Connections...'
  3. [Select your network connection] (there could be 2 entries, any will do)
  4. Click Edit
  5. Go to 'Wi-Fi' or 'Wireless' Tab
  6. Click the BSSID Dropdown
  7. Select the BSSID Matching the 5 Ghz Network (22:22:22:22:22:22 in this example)
  8. Switch to the 'General Tab'
  9. Make sure to check the checkbox that is labeled: 'Automatically connect to this network when it is available'
  10. Rename the Connection Name (not the SSID) to 'your network name'_AC
  11. Click Save
  12. If there were 2 entries for 'your network name' in your Network Connections list, proceed with next step, otherwise go to the last step.
  13. Click on the other 'your network name' entry
  14. Click Edit
  15. Go to 'Wi-Fi' or 'Wireless' Tab
  16. Click the BSSID Dropdown
  17. Select the BSSID Matching the 2.4 Ghz Network (11:11:11:11:11:11 in this example) OR leave the BSSID empty if there are multiple other secondary access points
  18. Switch to the 'General' Tab
  19. Uncheck the checkbox that is labeled: 'Automatically connect to this network when it is available'
  20. Set the 'Connection name' to [your network name]_N
  21. Click Save...
  22. Disconnect from your network and re-connect

You should now be connected to the 5Ghz network, and you would have to explicitly do the opposite process in order to connect to the 2.4 Ghz Network.

Solution 2:

Method 1 — for use at home with a single wireless router

First, connect to your basic wifi network under "Infrastructure". Next, click on BSSID. The BSSID you are connected to at that time should appear when you click on that arrow. This feature prevents your computer from switching networks. 2.4 Ghz and 5 Ghz.


Method 2 — roaming on a network with multiple access points like a college campus or public wifi

NOTE: If you used the method above, you will need to do the opposite before you begin. Make sure the BSSID is not set to anything (is blank) so that you can use multiple access-points and roam across the network.

First, you will need to edit the system-connections file that corresponds to your network. For this example, I will use a network named "coffee-shop".

sudo nano /etc/NetworkManager/system-connections/coffee-shop

Now, under the [wifi] section, edit the band field to the following (if band= is not listed, you can insert it on the line below [wifi]):

band=a

This will set the network to use 5 GHz only. If you want to use 2.4 GHz, use band=bg instead.

When you are done editing, press CTRL+o and then press ENTER to save the file and then press CTRL+x to exit nano.

Finally, restart network-manager to apply the changes:

sudo systemctl restart network-manager

Click here for more information.

NOTE: this setting does not exclude you from using wireless n or wireless c (so don't worry), this feature is only used to select 2.4 or 5 GHz

Solution 3:

Change that "Ad-hoc" option to something else, like "Infrastructure" (or a similar menu option). Infrastructure wireless is your typical "lots of devices connecting to a single router" approach, while ad-hoc wireless is intended for a "mesh" of wireless devices with no centralized router.

Being in ad-hoc mode is likely what's causing your problem (and this is further evidenced by the error message you provided).