Single-board computer Raspberry Pi 4 Model B is a powerful device often used as a smart home server, media center, or workstation. However, unlike previous versions, the fourth model features improved wireless modules supporting 802.11ac standards. This enables higher data transfer rates, which is critical for video streaming or transferring large amounts of data over a local network.
The process of setting up a wireless connection may vary depending on the operating system used. Most often, users choose Raspberry Pi OS (formerly Raspbian), but the setup principles are also relevant for other Linux distributions, such as Ubuntu or Debian. Proper configuration Wi-Fi module ensures stable operation of all services running on the board.
In this guide, we'll cover several connection methods, from the graphical interface for beginners to advanced command-line settings for headless server versions. We'll also cover the nuances of working with different frequency ranges and troubleshooting common driver issues.
Checking hardware compatibility and preparation
Before starting software configuration, you must ensure that your equipment is physically capable of supporting the required communication standards. Raspberry Pi 4 Equipped with a dual-band Broadcom Wi-Fi module operating in both 2.4 GHz and 5 GHz frequencies, this is a significant advantage over the Pi 3, helping to avoid airwave congestion in apartment buildings.
However, signal reception quality directly depends on the antenna and surrounding conditions. Built-in antennas on the board have a specific radiation pattern. If you plan to place the device in a metal case or far from the router, you should consider external antennas or USB adapters with support. external connection.
⚠️ Caution: Using powerful external USB Wi-Fi adapters may require additional power. The standard Raspberry Pi 4 power supply may not be able to handle peak loads when power-hungry peripherals are running simultaneously.
It's also worth keeping in mind that your router must be configured to operate at the 5 GHz frequency. Not all older routers support this range, and in some cases, it may be disabled by default. Check your router's specifications before beginning.
Setting up Wi-Fi via the Raspberry Pi OS GUI
If you're using a Raspberry Pi with a monitor and mouse connected, the easiest way is to use the built-in graphical interface. This method is ideal for beginners who don't want to deal with the command line. The system automatically scans available networks and offers a list of connections.
To get started, find the network icon (two arrows or a fan) in the upper right corner of the screen. Left-click on it to see a list of available access points. Select your network from the list and enter the password in the window that appears.
After successfully entering the security key, the system will attempt to obtain an IP address via DHCP. The connection status will change to "Connected," and you will be able to use the internet. If you are using static IP, it can be configured in the advanced network settings.
- 📶 Click on the Wi-Fi icon in the tray (upper right corner).
- 🔍 Select your network from the drop-down list of available SSIDs.
- 🔑 Enter your wireless network password and click OK.
- ✅ Wait until the "Connected" status appears and the internet access is checked.
In some cases, especially when using newer versions Raspberry Pi OSThe interface may be slightly modified, but the logic remains the same. If the network icon is missing, the Wi-Fi module may be disabled by software or the drivers are missing.
Connection via command line (nmcli and iwconfig)
For users working with server versions of the OS or preferring the terminal, there is a utility nmcli (Network Manager Command Line Interface). It provides a powerful tool for managing network connections without the need for a graphical shell. It is the de facto standard for many modern Linux distributions.
First, you need to check the status of the interfaces. Enter the command nmcli device status in the terminal. You'll see a list of devices; your Wi-Fi adapter is usually labeled as wlan0If the device status is "disconnected", it needs to be activated and scanned for networks.
nmcli device wifi list
After scanning, a list of available networks will appear, indicating their signal strength (SIGNAL column). To connect, use the command, specifying the network name (SSID) and password. The syntax requires careful attention to case.
nmcli device wifi connect "Network_Name" password "Your_Password"
If the connection is successful, the system will display a device activation message. If an error occurs, check that the password is entered correctly and that the network isn't hidden. For hidden networks, you need to add a parameter. hidden yes to the connection command.
☑️ Checking the connection via the terminal
Manual configuration via the wpa_supplicant.conf file
The most reliable method, especially for headless setups, is manually editing the configuration file. This ensures that the settings will persist even after a reboot and will be applied early in the system boot process. wpa_supplicant.conf is a key element of network configuration in Linux.
Use a text editor to edit the file. nano or viYou will need superuser rights. Open the file at the path /etc/wpa_supplicant/wpa_supplicant.confAt the end of the file, you need to add a block with your network parameters.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdevupdate_config=1
country=RU
network={
ssid="Your_Network"
psk="Your_Password"
key_mgmt=WPA-PSK
}
Pay attention to the parameter countryFor proper Wi-Fi operation at 5 GHz and regulatory compliance, you must specify your country code (e.g., RU for Russia, US for the United States, GB for the United Kingdom). Without this parameter, the module may operate unstable or only at 2.4 GHz.
⚠️ Warning: When manually editing configuration files, always make backup copies. One syntax error in the file
wpa_supplicant.confmay cause the network interface to stop coming up during boot.
After making changes, save the file (in nano this is Ctrl+O, then Enter) and exit (Ctrl+X). To apply the settings, you can reboot the Raspberry Pi or restart the networking service with the command sudo systemctl restart networking.
Setting up a static IP address for the server
When using a Raspberry Pi as a smart home server or file storage, it's critical that the device's network address doesn't change. A dynamic IP (DHCP) may change after a router reboot, causing the connection to the server to be lost. static IP solves this problem.
In modern versions Raspberry Pi OS connection manager is used dhcpcdTo set up a static address, you need to edit the configuration file. /etc/dhcpcd.confOpen it with root privileges and find the section for the wlan0 interface.
| Parameter | Description | Example of meaning |
|---|---|---|
| interface | Network interface name | wlan0 |
| static ip_address | Desired IP address of the device | 192.168.1.50/24 |
| static routers | Gateway (router) IP address | 192.168.1.1 |
| static domain_name_servers | DNS servers | 8.8.8.8 1.1.1.1 |
Add the following lines to the end of the file dhcpcd.conf:
interface wlan0static ip_address=192.168.1.50/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
It's important to select an IP address that's within your subnet range but not in the router's DHCP pool. For example, if your router assigns addresses between 100 and 200, select address 50. This will prevent IP address conflicts on your network.
How to find out the IP address of a router?
If you don't know the gateway address, enter the command `ip route | grep default` in the terminal. The first IP address in the output (usually after the word "via") is your router's address, which you should enter in the static routers field.
Troubleshooting and working with 2.4 and 5 GHz frequencies
Despite supporting two bands, Raspberry Pi 4 may experience connection issues, especially in noisy environments. The Broadcom module sometimes prefers the congested 2.4 GHz channel over the faster but longer-range 5 GHz, or vice versa. Frequency priorities are managed via a configuration file.
To force switching to 5 GHz, you can use the parameter freq_list in the file wpa_supplicant.conf. Adding a line freq_list=5180 5200 5220 (specify your router's channels) will force the board to ignore the 2.4 GHz band. This is useful if you want to reduce airtime congestion for IoT devices.
A weak signal is a common problem. To diagnose signal strength and connection quality, use the utility iwconfig or more modern iw dev wlan0 link. Parameter Link Quality will show the actual connection status. If the signal level is below -70 dBm, connection interruptions are possible.
- 📉 Use the command
iwconfigto view the current signal level. - 📡 The "Link Quality" parameter shows the signal-to-noise ratio.
- 🔧 To change the Wi-Fi channel, use the router settings, not just the client settings.
- 🛡️ Check if your firewall (iptables/ufw) is blocking the connection.
If you experience constant disconnections, try disabling power saving for the Wi-Fi module. This can be done by adding the option wifi.powersave = false into the configuration or by creating a corresponding file in /etc/NetworkManager/conf.d/.
Why can't Raspberry Pi 4 see the 5 GHz network?
This may be due to an incorrect country code in the wpa_supplicant.conf file. Some countries restrict certain channels in the 5 GHz band. Make sure the country= parameter is set to the value corresponding to your region (e.g., RU, US, DE).
How do I reset my network settings to factory defaults?
To reset the settings, delete or rename the /etc/wpa_supplicant/wpa_supplicant.conf file and clear the settings in /etc/network/interfaces. After rebooting, the system will rescan for networks or require a new configuration.
Is it possible to use two Wi-Fi adapters at the same time?
Yes, the Raspberry Pi 4 supports connecting external USB Wi-Fi adapters in parallel with the built-in one. However, this will require manual routing configuration so the system knows which interface to send traffic through.
Does the case affect the Wi-Fi signal?
Metal enclosures can significantly shield the signal, especially if the antennas are located close to walls. 3D-printed plastic enclosures have virtually no effect on radio wave transmission.