Fixing Wi-Fi on Ubuntu from the command line

A flaky wireless connection on Ubuntu is rarely mysterious. In most cases the kernel can see the card, the firmware is loaded and the network is technically reachable, yet something subtle — a misbehaving driver, a regulatory mismatch, a forgotten DNS resolver — turns a stable link into a source of frustration. Working from the terminal gives you direct access to the tools that decide whether your wireless interface comes up, which band it joins and how it talks to your router. For Australian readers, the picture is even more layered: many homes connect through the National Broadband Network, where the technology behind the wall socket (fibre-to-the-premises, fibre-to-the-node, HFC, fixed wireless or Sky Muster satellite) shapes the router you own and, indirectly, the Wi-Fi behaviour you see from your laptop.

Ubuntu ships with a complete toolkit for this kind of work. ip, iw, nmcli, systemd-resolve, journalctl and a handful of small utilities can pinpoint problems that a graphical applet simply reports as "no internet". The following walkthrough goes from the most basic checks to deeper diagnostics and finishes with a few tips specific to networks found across Australia.

Confirming the hardware is visible to the system

Before blaming software, it is worth verifying that Ubuntu can actually see the wireless adapter. The two commands that answer this question are lspci for internal cards and lsusb for USB dongles. Running lspci | grep -i net should list a line containing a wireless controller (for example, an Intel AX211 or a Realtek RTL8852BE). If nothing appears, the adapter may be switched off in firmware, disabled by a physical switch on the laptop or blocked through a BIOS setting.

A quick way to confirm that the driver is loaded is lshw -C network, which prints a tree of network devices along with the driver= and configuration lines. The configuration block shows the current state of the interface (broadcast=yes, multicast=yes is a healthy sign), while the driver= line tells you which kernel module is in charge. If the field is empty or says unclaimed, the kernel has not bound a driver to the device, which usually points to missing firmware or a kernel too old to support the hardware. Many newer laptops sold in Brisbane and Melbourne over the last two years ship with Wi-Fi 6E cards that only became fully supported in the 6.x kernel series, so a recent Ubuntu point release is often enough to fix things.

ip link is the modern replacement for the older ifconfig and shows whether the interface is up. A wireless device typically appears as wlan0 or wlp3s0; if it shows as state DOWN, you can bring it up with sudo ip link set wlan0 up and watch the journal for any error message that follows.

Using NetworkManager's nmcli to inspect connections

NetworkManager is the daemon behind Ubuntu's Wi-Fi menu, and its command line companion, nmcli, exposes everything the applet can do and more. Start with nmcli device status to see which interface is connected, which is disconnected and which is unavailable. The output includes a STATE column that uses values such as connected, disconnected, connecting and unmanaged. A device in the unmanaged state is not being handled by NetworkManager at all, which is the expected behaviour for interfaces configured in /etc/network/interfaces but a red flag for a wireless card that should be managed.

To list the networks in range, run nmcli device wifi list. The table shows the SSID, the signal strength in percent, the channel, the band (2.4 GHz or 5 GHz) and the security type. This is often where Australian users notice a long list of neighbour networks crowding the 2.4 GHz band. In a dense suburb in inner Sydney or north Melbourne, it is not unusual to see thirty or more access points competing for the same channels, and selecting channel 1, 6 or 11 manually through your router's admin page can dramatically improve stability.

nmcli connection show lists the saved profiles, and nmcli connection up "SSID" reconnects to a known network. If a connection keeps dropping, nmcli -f GENERAL,IP4,WIRELESS-PROPERTIES connection show "SSID" reveals the assigned IP, the router, the DNS servers and the current Wi-Fi parameters. Comparing these against a working device such as a phone on the same network quickly reveals whether the laptop is being given an unusual IP range or no DNS at all.

Resolving driver problems from the terminal

Driver issues are the single most common cause of wireless trouble on Ubuntu, particularly with Realtek and MediaTek chipsets that are popular in budget laptops sold through Australian retailers. The first place to look is dmesg | grep -i firmware; lines that mention "firmware failed to load" or "Direct firmware load for ... failed with error -2" tell you that the kernel is asking for a binary blob that is not present. The linux-firmware package contains most of these, and sudo apt install linux-firmware often clears the error.

If the device works intermittently, the iw tool can help. iw dev wlan0 link prints the current connection, the SSID, the negotiated PHY mode, the transmit and receive bit rates and the signal level in dBm. A reading of −30 dBm is excellent, −60 dBm is workable and anything worse than −75 dBm will struggle to maintain a stable link. In a typical brick-veneer home in suburban Adelaide, the back bedroom can easily sit fifteen metres and two walls away from the router, which is enough to push the signal past that threshold.

When the in-tree driver is unreliable, a DKMS package from the manufacturer's repository or from a community project such as aircrack-ng/rtl8812au can be compiled against your current kernel. Installing the build tools (build-essential, dkms, linux-headers-$(uname -r)) and then make inside the cloned source tree is usually enough; the resulting module loads on every kernel update without further intervention.

Measuring signal quality and scanning for interference

Signal strength is only half the story. A strong connection on a crowded channel can be just as painful as a weak one. iw dev wlan0 scan dumps every nearby access point with detailed information, including operating class, supported bit rates and any 802.11k/v/r capabilities. The signal: field is reported in dBm, while the utilization: field shows how busy the channel is.

For a quick survey, iwlist wlan0 scan (from the older wireless-tools package) is a friendlier alternative. The Frequency and Quality lines are useful when you are deciding whether to move the laptop or log into the router to change the channel. In Australia, the 2.4 GHz band allows channels 1 to 13 indoors and 1 to 11 outdoors; many consumer routers default to channel 1 or 6, which is why a five-minute scan in a Perth apartment block often reveals overlapping networks on the same frequency.

If the connection stalls while the signal looks fine, iw dev wlan0 station dump shows retry and failure counters for the associated access point. Rising tx retries combined with stable rx bytes often points to a one-way interference problem, which can be caused by a microwave, a neighbouring baby monitor or a poorly shielded USB 3 dock.

Diagnosing DNS and upstream connectivity

When the Wi-Fi link itself is healthy but the web still refuses to load, the problem is almost always DNS or routing. ping 1.1.1.1 bypasses name resolution entirely; a successful reply confirms that packets can reach the public internet, while a failure suggests the issue lies with the local router or the upstream provider. Australian users on the National Broadband Network may notice short outages during the FTTN "battery test" window that NBN Co schedules every few months, and the same ping test makes those events easy to identify.

For DNS, resolvectl status (from systemd-resolve) shows which resolver each interface is using. The Global section, configured in /etc/systemd/resolved.conf, and the per-link DNS Servers lines tell you where lookups are going. dig ubuntu.com @1.1.1.1 performs a single lookup against a known resolver, which is a clean way to check whether the problem is the chosen resolver rather than the network. Many Australian ISPs, including Telstra and Optus, run their own resolvers that occasionally return slow or stale results; switching to 1.1.1.1 or 8.8.8.8 through NetworkManager often resolves odd "the internet is broken" moments.

ip route displays the routing table. The default route should point to the gateway address handed out by your router, and ip route get 8.8.8.8 confirms which interface and next hop are used for a specific destination. If the output contains proto static or a metric that does not match the active link, the table has been edited and may need to be restored.

Adjusting regulatory and region settings for Australia

Linux honours the wireless regulatory domain set by crda, and Ubuntu ships with a default that often needs an explicit country code. The iw reg get command prints the current domain, while sudo iw reg set AU switches to Australia. Setting the wrong region can lock out channels that are legal locally and may even reduce the transmit power of the card. The Australian Communications and Media Authority permits channels 1 to 13 in the 2.4 GHz band for indoor use and the full UNII-1, UNII-2 and UNII-3 ranges in the 5 GHz band, with 6 GHz access following the global Wi-Fi 6E rules.

If the regulatory domain keeps reverting after a reboot, the kernel may be reading a wrong code from the BIOS. cat /sys/module/cfg80211/parameters/ieee80211_regdom shows the source of the value, and setting COUNTRY=AU in /etc/default/crda makes the change persistent. On some laptops, the BIOS passes a domain that does not include Australia, and the kernel falls back to the "world" domain, which restricts 5 GHz channels to the lowest four, a small but noticeable performance hit in a household that owns a Wi-Fi 6 mesh kit.

Reading logs and capturing useful diagnostics

When nothing has revealed the cause, the journal is the final stop. journalctl -u NetworkManager --since "1 hour ago" prints the daemon's recent activity, including scan results, association attempts and DHCP negotiations. For the kernel, dmesg --follow streams new messages, which is the easiest way to catch a driver crash as it happens.

If a bug needs to be reported, capturing sudo lshw -C network -sanitize and sudo nmcli -f all device show wlan0 produces two text files that contain everything a developer needs to reproduce the problem, without leaking personal identifiers. Saving them with a timestamp, then attaching the matching journalctl -b output, gives a complete picture.

For intermittent drops, tcpdump -i wlan0 -w capture.pcap can record raw frames for offline analysis in Wireshark. Filtering for wlan.fc.type == 0 keeps only management frames, which is the most useful view when the issue is around roaming between access points in a large Australian home, where the signal from the back deck might be served by a different mesh node than the one in the home office. Disabling MAC randomisation with wifi.scan-rand-mac-address=no in the NetworkManager profile also helps on routers that use MAC filtering, and setting ipv6.method=disabled clears up odd hangs reported on some TPG-supplied HFC services in Hobart and Launceston.

Locking in a working profile

Once the link is stable, the next step is to make sure the laptop reconnects the same way every time. Run sudo nmcli connection modify "SSID" connection.autoconnect yes connection.autoconnect-priority 10 to set the profile to attach automatically on boot and to win against older saved networks of equal signal strength, the small command that turns an afternoon of debugging into a permanent fix.