Home Linux troubleshootingHow to Troubleshoot Internet Connectivity Issues on Linux

How to Troubleshoot Internet Connectivity Issues on Linux

Internet Not Working on Linux? A Step-by-Step Guide to Diagnosing Connection Problems.

By sk
0 views 15 mins read

Today, I encountered a strange internet connectivity issue on my Debian 13 Linux system. I use JioFiber for my internet connection. Some websites worked, while others did not.

Interestingly, the same websites worked without any problem when I connected to a Vodafone network. So I thought that something was wrong with my JioFiber connection.

I decided to investigate the issue step by step. I started by checking my network interface, IP address, gateway, and DNS configuration. Then, I tested IPv4 and IPv6 connectivity separately to identify where the connection was failing.

In this guide, I'll walk you through the troubleshooting steps I followed, the commands I used, and the results I observed. I'll also explain how you can use the same approach to diagnose other internet connectivity problems on Debian Linux.

Step 1: Check whether your network interface is active

First, check whether Linux has detected your network interface and whether it is connected.

Open a terminal and run:

ip -br addr

On my system, the output was:

lo               UNKNOWN        127.0.0.1/8 ::1/128 
enp89s0 DOWN
wlo1 UP 192.168.29.39/24 2405:201:e018:8157:7393:edcb:fdd6:bd33/64 fe80::b54f:7e2f:96a1:9c4e/64
vmbr1 UNKNOWN 192.168.0.1/24 fe80::602f:a6ff:fe56:957f/64
vmbr0 UNKNOWN 192.168.1.101/24 fe80::7845:acff:fe51:fedd/64

Look for your active network interface.

  • If you use Wi-Fi, look for an interface such as wlan0 or wlo1.
  • If you use Ethernet, look for an interface such as eth0 or enp3s0.
  • The interface should show UP.
  • Check whether it has received an IP address.

On my Debian system, the wireless interface wlo1 was active and had the IPv4 address 192.168.29.39. The Ethernet interface enp89s0 was down, which was expected because I was using Wi-Fi.

If your interface is down: Check your Wi-Fi connection or Ethernet cable. If you use NetworkManager, run:

nmcli device status

Reconnect the affected device before moving to the next step.

Step 2: Check whether your system has a default gateway

Your default gateway is usually your home router. Linux sends internet-bound traffic through this gateway.

Run:

ip route

Sample output from my system:

default via 192.168.29.1 dev wlo1 proto dhcp src 192.168.29.39 metric 600
192.168.0.0/24 dev vmbr1 proto kernel scope link src 192.168.0.1
192.168.1.0/24 dev vmbr0 proto kernel scope link src 192.168.1.101
192.168.29.0/24 dev wlo1 proto kernel scope link src 192.168.29.39 metric 600

Look for the line beginning with default via.

On my system, the gateway was 192.168.29.1, and Linux was using wlo1 to reach it.

If you do not see a default route: Your system may not have received the correct network configuration. Check your DHCP and NetworkManager settings before continuing.

You can also check your IPv6 routes:

ip -6 route

My system had an IPv6 default route through the Wi-Fi interface.

Step 3: Check whether you can reach your router

Now test the connection between your computer and the router using command:

ping -c 4 192.168.29.1

Replace the IP address below with your own gateway address if it is different.

My router replied to all four packets. The average response time was low.

I also checked the router's neighbour entry:

ip neigh show 192.168.29.1

Sample output from my system:

192.168.29.1 dev wlo1 lladdr b4:a7:c6:56:a2:48 REACHABLE

This confirmed that my computer could communicate with the router.

If the router does not respond:

  1. Check whether your Wi-Fi is connected to the correct network.
  2. Check whether your computer has an IP address in the router's subnet.
  3. Restart your Wi-Fi connection.
  4. Restart the router if other devices are also unable to reach it.

Do not investigate public DNS or external websites until you can communicate with your local router.

Step 4: Check your DNS configuration

DNS converts website names, such as google.com, into IP addresses.

On Debian systems using systemd-resolved, run:

resolvectl status

My Wi-Fi interface showed:

Link 3 (wlo1)
Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.8.8
DNS Servers: 8.8.8.8 8.8.4.4 2405:201:e018:8157::c0a8:1d01
Default Route: yes

As you can see in the output above, I am using Google's public DNS servers:

  • 8.8.8.8
  • 8.8.4.4

If you do not see a DNS server: Check your network connection's DNS settings and DHCP configuration.

If DNS servers are configured, continue to test whether domain names resolve correctly.

Step 5: Test DNS resolution

Run:

ping -c 4 google.com

Check whether Linux resolves google.com into an IP address.

On my system, the command resolved the domain to an IPv6 address:

2404:6800:4000:101d::71

All four packets received replies.

This showed that DNS resolution worked and that my Debian system could communicate with Google's server over IPv6.

However, this test did not tell me whether IPv4 was working. I needed to test both protocols separately.

If the domain name does not resolve: Check your DNS configuration and try:

resolvectl query google.com

If DNS resolution succeeds, continue with the IPv4 and IPv6 tests.

Step 6: Test IPv4 connectivity

Force Linux to use IPv4 when pinging Google:

ping -4 -c 4 google.com

My system resolved Google's IPv4 address to:

142.251.220.110

But, all four packets were lost.

This showed that DNS returned an IPv4 address, but my system could not receive replies over IPv4.

If IPv4 ping fails: Do not immediately assume DNS is the problem. Continue by testing IPv6 and a public IPv4 address.

Step 7: Test IPv6 connectivity

Now force Linux to use IPv6 and see what happens:

ping -6 -c 4 google.com

On my system, all four packets received replies. The average response time was approximately 42.7 ms.

The results were:

TestResult
DNS resolutionWorking
IPv4 pingFailing
IPv6 pingWorking

This was the first strong indication that the problem affected IPv4 connectivity rather than the entire internet connection.

If IPv6 works but IPv4 fails: Continue with the next steps. Do not disable IPv6 just to work around the problem. First identify why IPv4 traffic is failing.

Step 8: Test a public IPv4 address directly

Now test a public IP address without using a website name.

Run:

ping -c 4 1.1.1.1

My result was:

4 packets transmitted, 0 received, 100% packet loss

This confirmed that the IPv4 problem was not limited to DNS resolution.

Remember that some networks block ping requests. You should confirm the result using an HTTPS test as well.

Step 9: Test website access using curl

Use curl to check whether your system can establish HTTPS connections.

First, force IPv4:

curl -4 -I --max-time 10 https://google.com

On my system, this request timed out.

Now force IPv6:

curl -6 -I --max-time 10 https://google.com

This request succeeded and returned an HTTP redirect response.

Test another public IPv4 address:

curl -4 -I --max-time 10 https://1.1.1.1

This also timed out.

Finally, test another website:

curl -4 -I --max-time 10 https:/ostechnix.com

This request timed out too.

These results showed that IPv4 HTTPS connections were failing across multiple destinations, while IPv6 HTTPS connections worked.

If both IPv4 and IPv6 fail: Investigate your router, firewall, DNS, and internet connection.

If only one website fails: Check whether the website itself is unavailable or whether a DNS, filtering, or routing issue affects that particular destination.

Step 10: Inspect the failed IPv4 connection

We can use curl's verbose mode to see exactly where the connection fails.

Run:

curl -4 -v --connect-timeout 8 https://google.com -o /dev/null

My output showed that DNS resolution succeeded, but the TCP connection timed out:

* Host google.com:443 was resolved.
* IPv6: (none)
* IPv4: 192.178.177.113, 192.178.177.102, 192.178.177.139, 192.178.177.100, 192.178.177.138, 192.178.177.101
* Trying 192.178.177.113:443...
* ipv4 connect timeout after 3999ms, move on!
* Trying 192.178.177.102:443...
* ipv4 connect timeout after 1999ms, move on!
* Trying 192.178.177.139:443...
* ipv4 connect timeout after 998ms, move on!
* Trying 192.178.177.100:443...
* ipv4 connect timeout after 498ms, move on!
* Trying 192.178.177.138:443...
* ipv4 connect timeout after 497ms, move on!
* Connection timeout after 8002 ms
curl: (28) Connection timeout after 8002 ms

The important point is that DNS worked, but the connection to port 443 did not complete.

Now compare this with an IPv6 test:

curl -6 -v --connect-timeout 8 https://google.com -o /dev/null

My IPv6 request completed the TCP connection, TLS handshake, certificate validation, and HTTP request successfully.

This confirmed that the two protocols behaved differently.

Step 11: Verify the IPv4 route

Before blaming the ISP, check whether Linux is sending IPv4 traffic through the correct gateway.

Run:

ip -4 route get 1.1.1.1

Sample output from my system:

1.1.1.1 via 192.168.29.1 dev wlo1 src 192.168.29.39 uid 1000

Linux was sending traffic through the expected router and Wi-Fi interface.

If the route points to the wrong interface or gateway: Investigate your routing table, VPN configuration, virtual network interfaces, and connection settings.

If the route looks correct but connections still fail, continue to trace the network path.

Step 12: Trace the IPv4 network path

Run traceroute to see how far packets travel towards the destination.

If traceroute is not installed, install it:

sudo apt update
sudo apt install traceroute

Then run:

traceroute -4 -n -m 12 -w 2 1.1.1.1

My output was:

traceroute to 1.1.1.1 (1.1.1.1), 12 hops max, 60 byte packets
1 192.168.29.1 1.229 ms 1.487 ms 1.702 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *

The first hop was my router. The remaining hops did not respond.

How to interpret this result: Some routers and firewalls block or ignore traceroute probes. Missing responses do not prove that the next router is faulty. Compare traceroute with your ping and curl results before drawing a conclusion.

Step 13: Flush the DNS cache

If you suspect that your system is using stale DNS information, clear the local DNS cache.

Run:

sudo resolvectl flush-caches

Restart the DNS resolver:

sudo systemctl restart systemd-resolved

Check its statistics:

resolvectl statistics

Now test a website again:

curl -I --max-time 10 https://google.com

Then test IPv4 separately:

curl -4 -I --max-time 10 https://google.com

On my system, the default curl request succeeded after clearing the cache, but the IPv4-specific request still timed out.

This showed that the successful default request was using the working IPv6 connection. Clearing the DNS cache had not repaired IPv4 connectivity.

Note: Flush DNS when you suspect stale DNS records. Do not expect it to fix a routing problem or an ISP-side connectivity failure.

Step 14: Test the same connection from another device

Now check whether the problem affects only your Linux system or the entire broadband connection.

  1. Connect your phone or other spare device to the same Wi-Fi network.
  2. Open https://google.com.
  3. Open https://1.1.1.1.
  4. Open https://ipv4.icanhazip.com.

On my phone:

WebsiteResult
https://google.comWorked
https://1.1.1.1Failed
https://ipv4.icanhazip.comFailed

The phone showed the same general IPv4 connectivity problem.

If other devices show the same problem: Investigate the router and ISP connection.

If other devices work normally: Focus on the Linux system's network configuration, firewall, VPN, proxy, and routing.

Step 15: Restart your router

If multiple devices have the same problem, restart your router.

  1. Switch off the router.
  2. Disconnect its power supply.
  3. Wait for approximately five minutes.
  4. Reconnect the power supply.
  5. Wait until the router reconnects to the internet.
  6. Test the websites again from your computer and phone.

I followed these steps, but the IPv4 problem initially remained.

If the problem continues: Check the router's internet or WAN status and look for its assigned IPv4 address. If the router does not have a usable WAN IPv4 address, contact your ISP.

Step 16: Contact your internet service provider

By this stage, I had confirmed the following:

  • My Wi-Fi connection was active.
  • My computer had a valid local IP address.
  • I could reach the router.
  • DNS resolution worked.
  • IPv6 connectivity worked.
  • IPv4 connections to public destinations timed out.
  • Another device on the same Wi-Fi network showed the same problem.
  • Restarting the router did not immediately fix it.

These results strongly suggested an upstream IPv4 connectivity problem.

When contacting your ISP, share these findings. Ask them to check the broadband connection, WAN IPv4 assignment, routing, and any network-side faults.

The issue was later resolved. The test results pointed to the ISP side, although the exact repair was not recorded.

In my case, a customer support from my ISP helped me to solve the issue.

Additional checks for other Linux connectivity problems

The following checks are useful when the initial tests do not identify the cause.

1. Check NetworkManager

If you use NetworkManager, check the status of your devices:

nmcli device status

Inspect your Wi-Fi interface:

nmcli device show wlo1

List active connections:

nmcli connection show --active

Look for disconnected devices, missing IP addresses, or incorrect connection settings.

If your Wi-Fi connection is stuck, reconnect it:

nmcli connection down "YOUR_WIFI_CONNECTION"
nmcli connection up "YOUR_WIFI_CONNECTION"

Replace YOUR_WIFI_CONNECTION with the actual connection name.

Do not disconnect your active connection if you are accessing the machine remotely and have no alternative way to reconnect.

2. Check DHCP

Your router normally assigns an IP address automatically using DHCP.

Check your interface:

ip addr show wlo1

If the interface does not have a valid IP address, inspect NetworkManager logs:

sudo journalctl -u NetworkManager -b -n 100

Look for DHCP timeouts, failed address assignments, and connection errors.

If DHCP is failing, check the router's DHCP settings and the NetworkManager connection configuration.

3. Check firewall rules

A firewall can block outgoing traffic or specific ports.

Check UFW:

sudo ufw status verbose

Inspect nftables:

sudo nft list ruleset

If your system uses iptables, check:

sudo iptables -L -n -v

Look for rules that block outgoing connections, DNS requests, or HTTPS traffic.

Do not disable your firewall without first identifying the rule that may be causing the problem.

4. Check proxy settings

An incorrect proxy configuration can prevent applications from accessing websites.

Run:

env | grep -i proxy

If the command displays proxy variables, verify the proxy address and port.

Also check your browser's proxy settings if the problem occurs only in the browser.

5. Check MTU settings

An incorrect MTU can cause some network connections to fail, particularly when larger packets are involved.

Check your interface MTU:

ip link show wlo1

You can test a common IPv4 packet size with:

ping -4 -M do -s 1472 -c 4 1.1.1.1

This test requires IPv4 connectivity to the destination. If IPv4 is completely unreachable, it will not help identify an MTU problem.

Do not change the MTU unless your test results indicate that it is necessary.

6. Inspect network logs

Check NetworkManager logs:

sudo journalctl -u NetworkManager -b

Check DNS resolver logs:

sudo journalctl -u systemd-resolved -b -n 100

Look for DHCP failures, DNS errors, interface resets, and connection timeouts.

Use the timestamps to match log entries with the time you experienced the connectivity problem.

7. Use MTR for further investigation

MTR combines ping and traceroute information. It can help you investigate packet loss and latency along a network path.

Install it:

sudo apt install mtr-tiny

Test IPv4:

mtr -4 -rw 1.1.1.1

Test IPv6:

mtr -6 -rw google.com

Check whether packet loss continues towards the destination. Do not assume that an intermediate router is faulty just because it does not respond. Some routers limit diagnostic traffic while continuing to forward normal traffic.

Final Internet Connection Troubleshooting Checklist

Follow this order whenever you investigate an internet connectivity problem on Linux:

  1. Check whether the network interface is active.
  2. Confirm that the system has received a valid IP address.
  3. Check the default gateway.
  4. Ping the router.
  5. Inspect DNS configuration.
  6. Test domain name resolution.
  7. Test IPv4 and IPv6 separately.
  8. Ping a public IP address.
  9. Test HTTPS connections using curl.
  10. Verify the routing table.
  11. Trace the network path.
  12. Flush DNS only if you suspect a DNS cache problem.
  13. Test another device on the same network.
  14. Restart the router.
  15. Check firewall, proxy, DHCP, MTU, and system logs if necessary.
  16. Contact the ISP when the evidence points to an upstream network problem.

Conclusion

When you troubleshoot internet connectivity, do not change several network settings at once. Go one by one and test each layer separately and record the results.

Start with the network interface and work your way outwards: IP address, gateway, DNS, IPv4, IPv6, routing, and finally the ISP connection.

In my case, the computer could reach the router, resolve domain names, and browse over IPv6. However, IPv4 connections failed on both the Debian system and another device connected to the same Wi-Fi network.

These tests helped narrow the issue down to the ISP side, and the connection was later restored with the help from the customer support executive.

Follow the same method on your Linux system. It will help you identify where connectivity breaks down, avoid unnecessary configuration changes, and provide useful evidence when you need support from your network administrator or ISP.

Good luck!

Recommended Read:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More