How to Fix Network Connection Issues on Ubuntu: Causes, Diagnosis, and Step-by-Step Solutions

1. Introduction

When using Ubuntu, you may encounter situations where the network suddenly stops working. This issue can disrupt your workflow, and because the causes vary widely, resolving it can be particularly challenging for beginners.

This article explains the primary causes of network connection failures on Ubuntu and provides clear solutions for each scenario. The content is designed to help users ranging from beginners to intermediate-level Linux users.

2. Main Causes of Network Connection Issues

Hardware-Related Causes

Some Ubuntu network problems originate from physical hardware issues. Check the following items:

  1. Faulty LAN Cables or Routers
  • Your LAN cable may be loose or damaged. Try replacing it or restarting your router.
  1. Network Interface Card (NIC) Failure
  • If the NIC is not detected, the hardware itself may be malfunctioning. Use the lshw -C network command to check the NIC status.

Software-Related Causes

Many network issues result from incorrect or missing software configurations.

  1. Missing Driver Installation
  • After installing Ubuntu, NIC drivers may not be properly installed. Install the latest drivers from the official repository.
  1. Network Configuration Errors
  • Incorrect IP address settings or disabled interfaces can prevent successful connections. Check the configuration files.
  1. Firewall and Security Restrictions
  • If the firewall is overly restrictive, internet access may be blocked. Check firewall settings using the ufw command.

3. Basic Troubleshooting Steps

Hardware Checks

  1. Physical Cable Inspection
  • Ensure the LAN cable is securely connected.
  • Try another port or router to confirm proper operation.
  1. Check NIC Status
  • Execute lshw -C network to verify NIC recognition.
  • If the NIC is not recognized, hardware repair may be required.

Software Checks

  1. Verify Network Status
  • Run the nmcli command to check the current network status.
  • If needed, restart the network service using sudo systemctl restart NetworkManager.
  1. Virtual Environment Considerations
  • If using a virtual machine, incorrect host network settings (such as NAT or bridged mode) may cause connection issues. Check the virtual machine’s network configuration.

4. Specific Solutions

Check and Modify Network Interface Settings

To verify that your Ubuntu network interfaces are configured correctly, follow the steps below.

  1. Check Active Network Interfaces
  • Open the terminal and run ip a.
  • Interfaces labeled with “state UP” are active.
  • If the interface is missing, proceed to the next step.
  1. Check Configuration Files
  • Ubuntu stores network configuration files in /etc/netplan/.
  • Edit the file using sudo nano /etc/netplan/01-netcfg.yaml.
  1. Sample Configuration
  • To enable DHCP, configure as follows:
    network: version: 2 ethernets: enp0s3: dhcp4: true
  1. Apply Settings
  • Save the file and apply the changes with:
    sudo netplan apply

Check and Install Drivers

If the network interface is not detected, driver-related issues may be the cause.

  1. Check Driver Status
  • Run:
    lshw -C network
  • If “UNCLAIMED” appears, the driver is missing.
  1. Install Drivers
  • Install required drivers using:
    sudo apt update sudo apt install linux-modules-extra-$(uname -r)
  1. Reboot
  • Restart the system to activate the drivers.

Check and Modify DNS Settings

DNS misconfigurations may also cause network failures. Follow these steps:

  1. Check Current DNS Settings
  • Run cat /etc/resolv.conf to verify DNS server settings.
  1. Modify DNS Servers
  • Edit the file and specify DNS servers:
    sudo nano /etc/resolv.conf
    nameserver 8.8.8.8 nameserver 8.8.4.4
  1. Clear DNS Cache
  • Clear the cache using:
    sudo systemd-resolve --flush-caches

Restart Network Services

Even with correct settings, service interruptions can cause failures.

  1. Restart NetworkManager
  • Restart the service using:
    sudo systemctl restart NetworkManager
  1. Verify Operation
  • Check connection status with:
    nmcli device status

5. Sample Troubleshooting Cases

Case 1: Wired LAN Is Not Recognized

  • Possible Cause: NIC driver not installed.
  • Solution:
  1. Verify NIC status using lshw -C network.
  2. Install required drivers.
  3. Reboot and recheck network settings.

Case 2: Wi-Fi Cannot Connect

  • Possible Cause: SSID not detected.
  • Solution:
  1. List available Wi-Fi networks:
    nmcli dev wifi list
  2. Connect manually if necessary:
    nmcli dev wifi connect "SSID" password "password"

Case 3: IP Address Conflict

  • Possible Cause: Multiple devices using the same IP address.
  • Solution:
  1. Edit the configuration file in /etc/netplan/ to assign a static IP.
  2. Apply settings and restart the network.

6. Conclusion

This article introduced the main causes of network connection issues in Ubuntu and provided practical solutions. From hardware inspections and software configuration tips to DNS and service restarts, a wide range of troubleshooting methods have been covered.

While network issues may seem complicated, most problems can be solved by following these steps in order. If issues persist, refer to Ubuntu’s official documentation or seek help in Linux community forums.

侍エンジニア塾