Ubuntu is one of the most popular Linux distributions. When working with Ubuntu, you might encounter the “network unreachable” error, which completely cuts off internet access while all physical network indicators appear normal.
This issue commonly stems from incorrect network configuration in modern Ubuntu versions (18.04 and later) that use Netplan for network management.
Estimated reading time: 3 minutes
Table of Contents
Tracing the Network Unreachable Issue
The problem is typically identified by running the ping google.com
command in the terminal and observing the “network unreachable” error. In Ubuntu 18.04+, Netplan configuration files (.yaml) in /etc/netplan/
have replaced the legacy /etc/network/interfaces
file.
Solving Network Unreachable
Follow these steps to resolve the issue:
Identify Network Interface Name
First, find your network interface name with this command:
ip -brief link show
Typical output:
enp3s0 UP aa:bb:cc:dd:ee:ff <BROADCAST,MULTICAST,UP,LOWER_UP>
(Interface names usually start with en
[Ethernet] or wl
[Wireless])
Configure Netplan
Open the Netplan configuration file using a safe text editor like nano:
sudo nano /etc/netplan/*.yaml
Apply one of these configurations based on your needs:
Option 1: DHCP (Recommended)
network:
version: 2
renderer: NetworkManager
ethernets:
enp3s0: # REPLACE WITH YOUR INTERFACE NAME
dhcp4: true
nameservers:
addresses: [8.8.8.8, 8.8.4.4, 1.1.1.1]
Option 2: Static Configuration
network:
version: 2
renderer: NetworkManager
ethernets:
enp3s0: # REPLACE WITH YOUR INTERFACE NAME
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1 # ROUTER/GATEWAY ADDRESS
nameservers:
addresses: [8.8.8.8, 8.8.4.4, 1.1.1.1]
Critical Notes:
1. YAML indentation is crucial – use SPACES ONLY (tabs are invalid)
2. IP addresses, subnet mask, and gateway must match your local network
3. The renderer: NetworkManager
line is essential for desktop editions
Apply Changes
After saving the file, apply the configuration:
sudo netplan apply
If errors occur, debug with:
sudo netplan --debug apply
Test your connection:
ping 8.8.8.8
Read More
تابع Concat اکسل | جمع کردن کلمات و رشته ها در اکسل
توابع توکار VBA | لیست کامل توابع داخلی در ویژوال بیسیک
عملگرهای VBA | انجام عملیات روی داده ها و ایجاد عبارت ها
دستور پرینت در اکسل با استفاده از VBA
مرجع VBA | فهرست دستورات و مفاهیم زبان برنامه نویسی ویژوال بیسیک