Understanding Network Priorities
Ubuntu 22.04 LTS uses NetworkManager to manage network connections. By default, it may attempt to connect to available Wi-Fi networks even when an Ethernet cable is plugged in. If the Wi-Fi fails to authenticate or has no signal, this can cause brief connectivity drops as the system switches between interfaces. To ensure reliable internet access via Ethernet, you need to explicitly tell the operating system to prefer the wired connection.
Disabling Wi-Fi via GUI
The most straightforward method for desktop users is to use the graphical interface. Click the network icon in the top-right corner of the screen. If Wi-Fi is enabled, click the toggle switch to turn it off. Alternatively, open the Settings application, navigate to Network, and select the Wi-Fi section. Toggle the Wi-Fi switch to Off. This action immediately stops NetworkManager from scanning for wireless networks, eliminating potential conflicts with your Ethernet adapter.
Verifying the Connection
After disabling Wi-Fi, check the status of your Ethernet connection. Ensure that the Ethernet icon shows a solid bar or globe, indicating an active link. You can also open a terminal and run ping -c 4 google.com to verify that packets are being sent and received successfully through the wired interface.
Configuring via Command Line
For users who prefer the terminal or are managing headless systems, nmcli provides precise control over network interfaces. First, list all available connections using nmcli con show. Identify your Wi-Fi connection by its name, which often includes the SSID or "Wired" for Ethernet.
nmcli radio wifi off
This command disables the wireless radio entirely. To make this persistent across reboots, you can modify the connection profile. Use nmcli con mod <wifi-connection-name> autoconnect no to prevent it from reconnecting automatically. However, simply turning off the radio is usually sufficient for immediate needs.
Setting Ethernet to Automatic
Ensure your Ethernet connection is configured to obtain an IP address automatically. Run the following command, replacing Ethernet connection 1 with your actual connection name:
nmcli con mod "Ethernet connection 1" ipv4.method auto
This ensures that DHCP is used to acquire an IP address, subnet mask, gateway, and DNS servers from your router. If you are experiencing issues, you can restart the NetworkManager service with sudo systemctl restart NetworkManager.
Troubleshooting Common Issues
If you still experience intermittent connectivity, check if multiple network interfaces are competing for traffic. Linux routing tables prioritize interfaces based on metric values. Lower metrics indicate higher priority. You can view current routes with ip route. The default route should point to your Ethernet interface (eth0 or similar).
Another common issue is stale DHCP leases. If the Ethernet cable was unplugged and replugged, the system might hold onto an old IP configuration. Restarting the network manager or rebooting the laptop clears these states. For more complex networking scenarios, such as setting static IPs or routing specific traffic, refer to our guide on Route Traffic with Special Source/Destination on Ubuntu.
Hardware and Driver Checks
Ensure that the Ethernet driver is loaded and functioning. Use lspci | grep -i ethernet to identify the network card. Then, check kernel messages with dmesg | grep eth for any errors related to link detection. If the driver is missing or outdated, consider updating your kernel or installing proprietary drivers provided by your laptop manufacturer.
Physical layer issues are also frequent culprits. Try a different Ethernet cable or port on your router. A faulty cable can cause link negotiation failures, leading to slow speeds or disconnections. If you are connecting to a server or specialized network equipment, ensure that the speed and duplex settings match. Most modern adapters handle auto-negotiation correctly, but forcing a specific speed can sometimes resolve stability issues.
Power Management Considerations
Some laptops may put the Ethernet controller into a low-power state when idle, causing latency spikes or disconnects. Check the power management settings for your network interface. In some cases, disabling power management for the NIC can improve stability. This can be done via ethtool or through BIOS/UEFI settings if available.
Additionally, ensure that your system is not entering sleep mode while the Ethernet cable is plugged in if you require continuous connectivity. Configure the power settings in Settings > Power to prevent automatic suspension. For users running virtual machines, similar principles apply, though the configuration differs slightly. See Ubuntu 22.04 VM on KVM/virt-manager Not Connecting to Internet for virtualization-specific tips.
Frequently Asked Questions
Why does my Ubuntu laptop switch from Ethernet to Wi-Fi automatically?
NetworkManager prioritizes connections based on user preference and availability. If Wi-Fi is enabled and connected, it may take precedence depending on the configuration. Disabling Wi-Fi or lowering its priority in the connection settings resolves this behavior.
How do I permanently disable Wi-Fi on Ubuntu 22.04?
You can disable Wi-Fi permanently by turning off the radio via nmcli radio wifi off and ensuring the connection profile is set to not autoconnect. Additionally, you can remove the Wi-Fi driver from the kernel module blacklist if you never intend to use wireless networking.
Can I use both Ethernet and Wi-Fi simultaneously?
Yes, but it requires careful routing configuration to avoid asymmetric routing issues. Typically, one interface serves as the default gateway while the other handles specific traffic. Misconfiguration can lead to connectivity problems where responses return via the wrong interface.
What should I do if my Ethernet connection shows "Unmanaged"?
An "Unmanaged" status means NetworkManager is ignoring the interface. Check the /etc/NetworkManager/NetworkManager.conf file to ensure the device is not blacklisted. Restarting NetworkManager or unchecking the "Managed" flag in the GUI can also resolve this.
Does Ubuntu 22.04 support Thunderbolt Ethernet adapters?
Yes, Ubuntu 22.04 supports many Thunderbolt Ethernet adapters out of the box. However, you may need to install additional firmware or drivers for specific chipsets. Always check compatibility lists for your particular adapter model before purchasing.