Setup ping google but not able to ping Facebook from same system

Suman Sourav
4 min readMar 14, 2021

What is ping?

Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.

Ping measures the round-trip time for messages sent from the originating host to a destination computer that are echoed back to the source. The name comes from active sonar terminology that sends a pulse of sound and listens for the echo to detect objects under water.

Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP echo reply. The program reports errors, packet loss, and a statistical summary of the results, typically including the minimum, maximum, the mean round-trip times, and standard deviation of the mean.

The command-line options of the ping utility and its output vary between the numerous implementations. Options may include the size of the payload, count of tests, limits for the number of network hops (TTL) that probes traverse, interval between the requests and time to wait for a response. Many systems provide a companion utility ping 6, for testing on Internet Protocol version 6 (IPv6) networks, which implement ICMPv6.

What is Routing Table?

In computer networking a routing table, or routing information base (RIB), is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes. The routing table contains information about the topology of the network immediately around it.

The construction of routing tables is the primary goal of routing protocols. Static routes are entries made in a routing table by non-automatic means and which are fixed rather than being the result of routing protocols and associated network topology discovery procedures.

What does a netmask ?

A Netmask is a 32-bit “mask” used to divide an IP address into subnets and specify the network’s available hosts. In a netmask, two bits are always automatically assigned.

For example, in 255.255. 225.0, “0” is the assigned network address.

What is default gateway?

The default gateway is the path used to pass information when the device doesn’t know where the destination is. More directly, a default gateway is a router that connects your host to remote network segments.

It’s the exit point for all the packets in your network that have destinations outside your network.

What is the use of the Route command in Linux?

route command in Linux is used when you want to work with the IP/kernel routing table. It is mainly used to set up static routes to specific hosts or networks via an interface.

It is used for showing or update the IP/kernel routing table.

What is IP address?

An IP address is a string of numbers separated by periods. IP addresses are expressed as a set of four numbers — an example address might be

192.158. 1.38.

Each number in the set can range from 0 to 255.

Lets now start with the implementation part

Step 1: Print the routing table of the system using command

route -n

Step 2: Delete the internet default gateway of 0.0.0.0 using command

sudo route del -net 0.0.0.0

Step 3: add the IP address of the google in the routing table, (we can check the IP adress of the google using the ping command)

To get the IPv4 address of the google

ping www.google.com

sudo route add -net 142.250.194.0/24 gw 192.168.43.156 wlo1

here 142.250.194.0 is the network name of the google, 192.168.43.156 is IP address of my internet device and wlo1 is the name of the NIC.

Step 4: Try checking pinging www.google.com and www.facebook.com

DONE :) you can check the facebook is not reachab;e but still we can ping google an reach out to it.

--

--