Raspberry Pi 4: How to Set Up WiFi on All OS Versions

The Raspberry Pi Foundation's minicomputers have become the standard for electronics enthusiasts, and the fourth-generation model represents a breakthrough thanks to its built-in wireless module. Unlike its predecessors, Raspberry Pi 4 The device now supports dual-band networks, allowing it to operate in both the 2.4 GHz band and the faster 5 GHz band. However, despite its apparent simplicity, initial connection configuration often presents difficulties for beginners, especially when the device is operating in headless mode (without a monitor or keyboard).

In this guide, we'll cover all wireless network connection methods in detail, from the graphical interface to editing configuration files via the command line. You'll learn how to properly create a configuration file, which parameters are critical for stable operation, and how to avoid common password errors. Correct setting Networks are the foundation for further use of your device as a server, media center, or smart home.

It is worth noting that the methods may differ slightly depending on the operating system installed, whether it is classic Raspberry Pi OS (formerly Raspbian), Ubuntu, or specialized distributions. We'll cover universal methods that work in most scenarios. Whether you've just unpacked your device or are experiencing issues after a system update, this article will help you restore network access.

Equipment preparation and compatibility testing

Before you begin software configuration, you must ensure that the device is physically ready for operation. Raspberry Pi 4 Requires a high-quality power source, preferably at least 3 amps, as the WiFi module can draw significant current during active data transfer. Unstable voltage is a common cause of the wireless adapter not turning on or constantly disconnecting.

It's also important to check the antennas if you're using the version with external connectors, although the standard fourth-generation model already has antennas built into the board. Make sure there are no strong sources of interference nearby, such as microwave ovens or running motors, which could jam the 2.4 GHz signal.

⚠️ Important: If you're using a metal case for your Raspberry Pi 4, make sure it doesn't completely shield the signal. Some closed aluminum cases can significantly reduce the WiFi range, so in these cases, we recommend routing the antennas externally or using a USB WiFi adapter.

For initial setup, you may need a monitor with an HDMI interface, a USB keyboard, and a mouse unless you plan to configure the network blindly. However, the most flexible method remains using the console or preparing an SD card on your PC.

  • 📡 Check that your router distributes the network in the 802.11 b/g/n/ac standards.
  • 🔋 Make sure your power supply supplies a stable 5.1V.
  • 💾 Prepare an SD card with the operating system installed.
  • 📝 Write down the network name (SSID) and password of your WiFi.
📊 Which WiFi setup method do you prefer?
Through the graphical interface
Via the command line
Automatically when installing the OS
Via SSH file

Setting up WiFi via the Raspberry Pi OS GUI

If you've connected your Raspberry Pi 4 to a monitor and are working in a desktop environment, the connection process is extremely simple and resembles connecting in Windows or macOS. In the upper right corner of the screen, you'll see a network icon, which looks like two arrows or a WiFi indicator. Clicking it opens a menu of available wireless networks.

Select your home network from the list. SSID and enter the password. The system will automatically attempt to obtain an IP address via DHCP and establish a connection. If successful, the icon will change to a connection indicator, and you can open a browser to test internet access.

For more detailed configuration, for example, if the network is hidden or a static IP address is required, go to the application menu and select "Preferences" -> "Network Settings." Here you can manually enter DNS servers or change the address acquisition method.

sudo nmcli dev wifi connect "Network_Name" password "Your_Password"

This command is useful if the GUI is frozen but you're in a terminal within the GUI. It uses the default network manager. NetworkManagerIf you're using a minimalist OS without a heavy desktop, this method may not work, and you'll have to resort to configuration files.

  • 🖱️ Click on the network icon in the tray.
  • 🔑 Enter your WiFi network password.
  • 🌐 Wait until you receive an IP address.
  • ✅ Check the connection by opening a web page.

⚠️ Note: The graphical interface may not launch if you are using the "Lite" version of the operating system. In this case, proceed to the section on command line configuration.

Using raspi-config to configure networking

Utility raspi-config is the standard configuration tool for all Raspberry Pi distributions. It allows you to manage system parameters without having to remember complex commands or file paths. You can launch it from the terminal by entering the appropriate command with root privileges.

In the menu, navigate with the arrow keys and press Enter to select. Go to "System Options" and then select "Wireless LAN." Here, the system will ask you to enter the network name and password. This is one of the most reliable methods, as the utility will automatically check the syntax and write the data to the required files.

After entering the data, the system will prompt you to reboot or apply the settings immediately. This method is especially convenient during initial setup, when all you have is a keyboard connected directly to the device.

sudo raspi-config

The developers periodically update the utility's interface, so if you don't find the "Wireless LAN" option right away, carefully study the "System Options" or "Network Options" subsections.

⚠️ Note: The interface and layout of options in raspi-config may vary depending on the operating system version and distribution release date. Always consult the latest documentation if the standard path doesn't work.

☑️ Pre-run check with raspi-config

Completed: 0 / 4

Manual configuration via the wpa_supplicant.conf file

For advanced users and headless installations without a monitor or keyboard, the only option is to manually create a configuration file. This method allows you to prepare the SD card on a Windows or macOS computer before inserting it into the Raspberry Pi for the first time.

You need to open the boot partition on the SD card (it is visible in any OS) and create a file there with the name wpa_supplicant.conf (without the .txt extension). This file contains network parameters in a specific format. the only way Automatically connect your device to WiFi the first time you turn it on without using an Ethernet cable.

The file structure must be strictly adhered to, including indentation and quotation marks. Any typo in the syntax will cause the system to ignore the file and not attempt to connect.

country=RU

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

network={

ssid="Your_Network_Name"

psk="Network_Password"

key_mgmt=WPA-PSK

}

Parameter country=RU This is critically important because it determines the permitted frequency channels. If you enter an incorrect country code, the WiFi module may not turn on or may work erratically. For the US, use US, for Germany DE and so on.

  • 📝 Create a text file wpa_supplicant.conf.
  • 🌍 Please enter the correct country code (country=..).
  • 🔐 Enter the SSID and password in quotation marks.
  • 💾 Save the file to the root of the boot partition.
What to do if the file does not work?

Make sure the file is named wpa_supplicant.conf and not wpa_supplicant.conf.txt. Windows hides file extensions by default, so check your display settings in File Explorer. Also, make sure the file is located on the boot partition, which has a FAT32 file system.

Setting up a static IP address and DHCP

By default, the Raspberry Pi 4 obtains an IP address dynamically via DHCP. This is convenient for regular users, but servers, surveillance cameras, or smart home devices often require a static address to ensure the device's path remains consistent after a router reboot.

To set up a static IP in modern versions of Raspberry Pi OS (based on Debian Bullseye and Bookworm), use the manager dhcpcdYou need to edit the configuration file. /etc/dhcpcd.confAt the end of the file, a block for the wlan0 interface is added.

Parameter Meaning Description
interface wlan0 - Specifying the WiFi network interface
static ip_address 192.168.1.50/24 Desired IP and subnet mask
static routers 192.168.1.1 Gateway (router) IP address
static domain_name_servers 8.8.8.8 1.1.1.1 DNS servers

After making changes, you must reboot the networking service or the card itself. The static address must be outside the range of addresses assigned by the router's DHCP server to avoid IP address conflicts on the network.

sudo systemctl restart dhcpcd

If you're unsure of your router's network settings, it's best to leave the default settings (DHCP) and reserve the MAC address in the router's settings. This is a more reliable method that doesn't require editing files on each device.

Diagnosing problems and checking connections

Even with proper configuration, connection issues may still occur. The first step in troubleshooting is always checking the interface status. The command iwconfig will show whether the wireless adapter is turned on and connected to the access point.

To check the signal quality and noise level, use the utility iwlistIt will display a list of available networks and the signal quality for each. If the signal level is too low (less than -70 dBm), the connection may be unstable.

sudo iwlist wlan0 scan | grep -E"ESSID|Quality"

If there is a connection but no internet, check the routing table with the command ip route and try pinging an external resource, such as Google DNS. No response indicates a problem with the gateway or DNS.

  • 🔍 Use ifconfig to check the IP address.
  • 📡 Team iwconfig will show the signal level.
  • 🌐 ping 8.8.8.8 will check the availability of the Internet.
  • 📜 System logs can be viewed via dmesg | grep wifi.

⚠️ Warning: If you changed your WiFi password or network name, but your Raspberry Pi 4 still won't connect, it's possible that old profiles are still stored. Delete old entries in wpa_supplicant.conf or use the forget network command.

Frequently Asked Questions (FAQ)

Why can't Raspberry Pi 4 see 5 GHz networks?

The Raspberry Pi 4 WiFi module supports 5 GHz, but this is dependent on regional settings. Make sure that the file wpa_supplicant.conf or through raspi-config The correct country code is set. Some countries prohibit certain channels in the 5 GHz band.

How to find the MAC address of a WiFi adapter?

Enter the command in the terminal ip link show wlan0The MAC address will be listed after the word "link/ether" as six pairs of hexadecimal numbers (for example, b8:27:eb:xx:xx:xx).

Is it possible to use a USB WiFi adapter instead of the built-in one?

Yes, the Raspberry Pi 4 supports most USB WiFi adapters. However, the built-in module is generally more stable and doesn't take up a USB port, which is often needed for other peripherals on the Pi 4.

What to do if WiFi turns off on its own?

This may be related to power saving. Try disabling power saving mode for WiFi by adding the parameter power_save=off into the configuration, or check the power supply for insufficient power.

How to completely reset network settings?

To reset, delete the file /etc/wpa_supplicant/wpa_supplicant.conf (after making a backup) and reboot the system. This will reset the network settings to factory defaults.