Unable to Ping 8.8.8.8 on ubuntu server

If you are unable to ping 8.8.8.8 on your Ubuntu server, it could be due to several reasons, including network misconfiguration, firewall rules, or issues with your ISP.

Unable to Ping 8.8.8.8 on ubuntu server, Step-by-Step Guide

If your Ubuntu server is unable to ping 8.8.8.8 on ubuntu server, it usually indicates a network or firewall issue. Follow these steps to diagnose and fix the problem:

1 . Verify Active Interfaces

      ip a       OR       ifconfig

Show your primary network interfaces (e.g., eth0, ens33, wlan0) has an IP address assigned.

Restart Network Service

  For Ubuntu 20.04+ (using systemd-networkd or Netplan):

        sudo systemctl restart systemd-networkd

        sudo netplan apply

2 . Verify Default Gateway :

      Check routing table:

           ip route

Expected output should include:

default via 192.168.1.1 dev eth0

If missing, add a default route manually:

sudo ip route add default via 192.168.1.1 dev eth0

3 . Test Basic Connectivity :

Ping Local Gateway :

ping -c 4 192.168.1.1

If this fails, check if your router is up.

Show your network interface is correctly configured.

4 . Ping External IP :

             ping -c 4 1.1.1.1

         If this works but 8.8.8.8 fails, Google’s DNS might be blocked.

5 . Check Firewall (iptables & UFW)

      Check iptables Rules

        sudo iptables -L -v -n

     If ICMP is blocked, allow it:

         sudo iptables -A INPUT -p icmp –icmp-type echo-request -j ACCEPT

         sudo iptables -A OUTPUT -p icmp –icmp-type echo-reply -j ACCEPT

Save the new rules:

sudo iptables-save | sudo tee /etc/iptables/rules.v4

Check UFW Rules

  sudo ufw status

If active, allow ICMP:

sudo ufw allow out proto icmp

sudo ufw reload

6 . Verify DNS Configuration:

        Check /etc/resolv.conf

     cat /etc/resolv.conf

Show it contains:

 nameserver 8.8.8.8

 nameserver 1.1.1.1

If missing, modify:

sudo nano /etc/systemd/resolved.conf

Set:

DNS=8.8.8.8 1.1.1.1

Restart service:

sudo systemctl restart systemd-resolved

7 . Verify Network Interface Status :

ip link show

If the primary interface is down, bring it up:

sudo ip link set eth0 up

Open Terminal and Ping to Google :

ping -c 4 8.8.8.8

Get Free Website Hosting Migration & Enjoy 65% Off on Our Yearly Hosting Plans

For more info Contact to sales team

Scroll to Top