- How to change wifi channel?
- 2 Answers 2
- How do I set 5GHz as preferred band?
- 1 Answer 1
- How can I get the band (2.4 / 5 GHz) selection back in wifi settings? (ubuntu 20.04)
- References
- 2 Answers 2
- You must log in to answer this question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- WiFi frequency channel change
How to change wifi channel?
I want to change my wireless card to use a specified channel instead of auto. I’ve looked around and the way to do it seems to be by running sudo iwconfig wlan0 channel , however I’m getting SET failed on device wlan0 ; Device or resource busy. I’ve tried disabling the card through the status bar menu or with sudo ifconfig wlan0 down , but the same thing still happens. What am I doing wrong and how could I fix it?
2 Answers 2
If you check the mode used by your wireless card, it is probably ‘managed:’
wlan0 IEEE 802.11abgn ESSID:"my_router" Mode:Managed Frequency:2.462 GHz Access Point: XX:D7:19:41:54:XX Bit Rate=58.5 Mb/s Tx-Power=15 dBm Retry short limit:7 RTS thr:off Fragment thr:off Power Management:off Link Quality=46/70 Signal level=-64 dBm
In this context, ‘managed’ means that the channel, bitrate, etc. are managed by the router. If you wish to change the channel, change it in the administration pages of the router.
@manikanta Log in to the router pages and change the channel. howtogeek.com/wp-content/uploads/2010/07/image14.png If this is not your router, then you are stuck.
The channel is determined by the router, not the computer. Can you telnet into the router and change it there? Possibly, but this is not about Ubuntu.
You can put your Wi-Fi adapter into monitor mode, this will disconnect the adapter from your router.
Then change the channel with
Here, wlp3s0 is the wireless interface name, get yours with ip a . Similarly, phy0 is the name of the wireless device, consult iw phy for the names on your machine.
To keep an eye on the current channel, use watch iw wlp3s0 info which will produce output like this:
Interface wlp3s0 ifindex 4 wdev 0x1 addr 28:21:96:ad:d5:d5 type monitor wiphy 0 channel 1 (2412 MHz), width: 20 MHz (no HT), center1: 2412 MHz txpower 15.00 dBm
See iw help for the documentation.
How do I set 5GHz as preferred band?
In the building where I am living is having a WiFi with two channels and same SSID. Whenever I connect to the WiFi, it always connects to the 2.4GHz band but I want to connect to 5GHz band. I have already tried this but all in vain. Also, I have tried linSSID app but it isn’t even launching. I am using Ubuntu 18.04 LTS and output of lshw -C network :
*-network description: Wireless interface product: Wireless 3160 vendor: Intel Corporation physical id: 0 bus info: pci@0000:01:00.0 logical name: wlp1s0 version: 83 serial: e4:02:9b:d2:65:c7 width: 64 bits clock: 33MHz capabilities: bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-34-generic firmware=17.948900127.0 ip=172.21.126.136 latency=0 link=yes multicast=yes wireless=IEEE 802.11 resources: irq:128 memory:df100000-df101fff
wlp1s0 26 channels in total; available frequencies : Channel 01 : 2.412 GHz Channel 02 : 2.417 GHz Channel 03 : 2.422 GHz Channel 04 : 2.427 GHz Channel 05 : 2.432 GHz Channel 06 : 2.437 GHz Channel 07 : 2.442 GHz Channel 08 : 2.447 GHz Channel 09 : 2.452 GHz Channel 10 : 2.457 GHz Channel 11 : 2.462 GHz Channel 12 : 2.467 GHz Channel 13 : 2.472 GHz Channel 36 : 5.18 GHz Channel 40 : 5.2 GHz Channel 44 : 5.22 GHz Channel 48 : 5.24 GHz Channel 52 : 5.26 GHz Channel 56 : 5.28 GHz Channel 60 : 5.3 GHz Channel 64 : 5.32 GHz Channel 149 : 5.745 GHz Channel 153 : 5.765 GHz Channel 157 : 5.785 GHz Channel 161 : 5.805 GHz Channel 165 : 5.825 GHz
I know that it is possible in an UniFi WiFi setup, to set the AP to prefer 5Ghz. Or that in most systems you can set up one SSID for normal and one SSID for 5Ghz. You may check if your WiFi setup has such feature, so it counts for all devices in your network and doesn’t rely on device-specific configuration.
@ThomasWard Yup it has. Actually I’ve dual booted system and I can set preference for 5GHz in windows easily. To avoid further confusion I’ve added output of iwlist chan .
1 Answer 1
To confirm that your wireless card is capable of connecting to 5ghz do iw list and look for the portion that looks like below
. Frequencies: * 5180 MHz [36] (22.0 dBm) (no IR) * 5200 MHz [40] (22.0 dBm) (no IR) * 5220 MHz [44] (22.0 dBm) (no IR) * 5240 MHz [48] (22.0 dBm) (no IR) * 5260 MHz [52] (20.0 dBm) (no IR, radar detection) * 5280 MHz [56] (20.0 dBm) (no IR, radar detection) * 5300 MHz [60] (20.0 dBm) (no IR, radar detection) * 5320 MHz [64] (20.0 dBm) (no IR, radar detection) * 5500 MHz [100] (22.0 dBm) (no IR, radar detection) * 5520 MHz [104] (22.0 dBm) (no IR, radar detection) * 5540 MHz [108] (22.0 dBm) (no IR, radar detection) * 5560 MHz [112] (22.0 dBm) (no IR, radar detection) * 5580 MHz [116] (22.0 dBm) (no IR, radar detection) * 5600 MHz [120] (22.0 dBm) (no IR, radar detection) * 5620 MHz [124] (22.0 dBm) (no IR, radar detection) * 5640 MHz [128] (22.0 dBm) (no IR, radar detection) * 5660 MHz [132] (22.0 dBm) (no IR, radar detection) * 5680 MHz [136] (22.0 dBm) (no IR, radar detection) * 5700 MHz [140] (22.0 dBm) (no IR, radar detection) .
To answer your question, I am assuming the network card is capable of connecting to the 5ghz network. Using the command line interface is flexible compared to using the network manager gui. The important thing is to get the ssid and bssid of the 5ghz network you want to connect to.
sudo systemctl restart wpa_supplicant sudo wpa_cli -iwlp2s0 scan_results
This would list some values such as
bssid / frequency / signal level / flags / ssid 54:a2:74:03:c3:a2 2437 -79 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] \x00 54:a2:74:03:c3:a0 2437 -79 [WPA2-EAP-CCMP][ESS] SOME WIFI 00:42:68:15:f0:92 2437 -90 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] \x00 d8:b1:90:3e:e4:62 2412 -79 [WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] \x00 d8:b1:90:3e:e4:6e 5700 -84 [WPA2-EAP-CCMP][ESS] DESIRED SSID 54:a2:74:03:c6:a1 2462 -90 [WPA2-EAP-CCMP][ESS] eduroam 2a:a3:c4:8d:32:85 2437 -71 [WPA2-PSK-CCMP][WPS][ESS][P2P] Another SSid 54:a2:74:03:c6:ae 5500 -89 [WPA2-EAP-CCMP][ESS] eduroam 54:a2:74:03:c3:a1 2437 -73 [WPA2-EAP-CCMP][ESS] eduroam 00:42:68:15:f0:91 2437 -88 [WPA2-EAP-CCMP][ESS] eduroam d8:b1:90:3e:e4:61 2412 -74 [WPA2-EAP-CCMP][ESS] eduroam
Look for your desired ssid and the corresponding frequency. Now look for the BSSID that matches the desired frequency and SSID.
Next, kill network-manager and wpa_supplicant:
sudo service network-manager stop && sudo killall wpa_supplicant
This may not be desirable for most people but for the purposes of your question.
Create a wpa_supplicant.conf :
sudo nano /etc/wpa_supplicant.conf
and paste the network specs of the network you are connecting to:
ctrl_interface=/var/run/wpa_supplicant #settings for an AP using preshared keys, PSK network= < ssid="DESIRED SSID" scan_ssid=1 key_mgmt=WPA-PSK psk="PassworD" bssid=d8:b1:90:3e:e4:6e #the important part >#settings for an open AP. if you use this then don't use the above settings network=
Replace bssid with the one of the network you are connecting to
Now start wpa_supplicant via that conf file:
sudo wpa_supplicant -iwlp2s0 -c/etc/wpa_supplicant.conf
After authentication flush any held ip addresses:
Request a dynamic ip (dhcp):
At this point you should be connected to the 5ghz network.
To check whether you are really connected to the 5ghz but not the 2ghz do iw dev and you should have a results like
Interface wlp2s0 ifindex 2 wdev 0x1 addr b4:6d:83:15:9c:5d ssid DESIRED SSID type managed channel 140 (5700 MHz), width: 20 MHz (no HT), center1: 5700 MHz txpower 22.00 dBm
The whole procedure above works well but may not survive a reboot and is not useful if you would want to be switching between different kinds of networks.
To start initialize network manage:
sudo service network-manager restart
Then from the network tray icon connect to your DESIRED SSID. Never mind whether it is 2.4 or 5ghz. we would do that later.
sudo wpa_cli -iwlp2s0 scan_results
To get the BSSID that matches the desired frequency and ssid
Next click the network manager tray icon > edit connections > double click on the DESIRED SSID to edit it as following
On wifi tab: SSID (DESIRED SSID), mode (Client), band (5), channel (enter the value you got from the scan results), bssid (enter desired bssid) device (wlp1s0), cloned mac (permanent), mtu (automatic)
Then disconnect and connect again and it should work.
How can I get the band (2.4 / 5 GHz) selection back in wifi settings? (ubuntu 20.04)
I upgraded Ubuntu to 20.04 and the setting for preferred WiFi frequency has disappeared. You can see a screenshot of the drop-down menu here: How can I get this drop down menu back?
References
2 Answers 2
The dropdown menu was removed from the UI (I could not find the reason).
But there is a work-around, by checking the manual of nm-settings :
- Locate the targeted WiFi connection profile in /etc/NetworkManager/system-connections/nameofconnection.nmconnection
- edit with sudo nano /etc/NetworkManager/system-connections/nameofconnection.nmconnection
- Under section [wifi] add following entry
- for 2.4 GHz only band=bg
- for 5 GHz only band=a
Or run the command that is posted as a comment on the question ( nm-connection-editor in the terminal)
To access the settings in a GUI execute nm-connection-editor in a terminal. Then choose your desired connection and click on edit.
Thanks. This did the trick for me!
You must log in to answer this question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.12.43529
Ubuntu and the circle of friends logo are trade marks of Canonical Limited and are used under licence.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
WiFi frequency channel change
iwconfig lo no wireless extensions. wlo1 IEEE 802.11abg ESSID:off/any Mode:Managed Frequency:5.2 GHz Access Point: Not-Associated Retry short limit:7 RTS thr:off Fragment thr:off Power Management:on eno1 no wireless extensions.
lo no wireless extensions. wlo1 IEEE 802.11abg ESSID:"PiotryStephy" Mode:Managed Frequency:2.412 GHz Access Point: C0:05:C2:BF:6F:79 Retry short limit:7 RTS thr:off Fragment thr:off Power Management:on eno1 no wireless extensions.
In my router settings there are both 2 and 5GHz frequencies allowed. There is no option to change «Mode:Managed». These are my available channels:
iwlist channel lo no frequency information. wlo1 29 channels in total; available frequencies : Channel 01 : 2.412 GHz Channel 02 : 2.417 GHz Channel 03 : 2.422 GHz Channel 04 : 2.427 GHz Channel 05 : 2.432 GHz Channel 06 : 2.437 GHz Channel 07 : 2.442 GHz Channel 08 : 2.447 GHz Channel 09 : 2.452 GHz Channel 10 : 2.457 GHz Channel 11 : 2.462 GHz Channel 12 : 2.467 GHz Channel 13 : 2.472 GHz Channel 36 : 5.18 GHz Channel 38 : 5.19 GHz Channel 40 : 5.2 GHz Channel 42 : 5.21 GHz Channel 44 : 5.22 GHz Channel 46 : 5.23 GHz Channel 48 : 5.24 GHz Channel 52 : 5.26 GHz Channel 56 : 5.28 GHz Channel 60 : 5.3 GHz Channel 64 : 5.32 GHz Channel 149 : 5.745 GHz Channel 153 : 5.765 GHz Channel 157 : 5.785 GHz Channel 161 : 5.805 GHz Channel 165 : 5.825 GHz Current Frequency:2.412 GHz (Channel 1) eno1 no frequency information.
sudo iwconfig wlo1 channel 40 Error for wireless request "Set Frequency" (8B04) : SET failed on device wlo1 ; Operation not supported.