👩‍💻 Imagine pinging google but not to facebook at same time ?🤔 👩‍💻

Priyanka Hajare
4 min readMar 12, 2021

(ARTH_Task 13)

Let’s understand …

💻 what is routing table ?🤔

A routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables.

A basic routing table includes the following information:

  • Destination: The IP address of the packet’s final destination
  • Next hop: The IP address to which the packet is forwarded
  • Interface: The outgoing network interface the device should use when forwarding the packet to the next hop or final destination
  • Metric: Assigns a cost to each available route so that the most cost-effective path can be chosen
  • Routes: Includes directly-attached subnets, indirect subnets that are not attached to the device but can be accessed through one or more hops, and default routes to use for certain types of traffic or when information is lacking.

🔰 Now let’s start with demonstration to complete our desired task

TASK :

Create a setup so that you can ping to google but not able to ping to facebook from same system.

🔷 Let’s check routing table

Command to check routing table is route -n

Now here we can see that routing table has default rule i.e destination 0.0.0.0 it means we this system can connect to anyone on the internet.

And here in my case network card name is enp0s3

🔷 Now let’s check whether we (i.e our system ) are able to ping to google or not ?

To check connectivity with google use following command

ping www.google.com

🔷Now let’s check whether we (i.e our system )are able to ping to facebook or not ?

command to check connectivity of system with facebook is

ping www.facebook.com

yes.. there is network connectivity with fakebook.

🔷 Now let’s check IP of google

To check IP address of google use command 👉 nslookup www.google.com

we can see address as I have highlighted i.e IP of google

🔷 Now delete the default routing rule

By using command 👉route del -net 0.0.0.0 I deleted default routing rule

And then again I verified that destination 0.0.0.0 has deleted or not. and as we can see in below picture now default rule has deleted.

🔷 Let’s check , can we able to ping to google or facebook now from our system ?

Now we can see here we are not able to connect to either google or facebook because we have deleted default routing rule that’s why now we don’t have any network connectivity.

🔷 Now add the IP address to the routing table

Command to add rule in routing table :

Write Google Ip in Destination and gateway will be localhost and write netmask 255.255.255.0

172.217.174.68 is the IP address of google but we have to add network name i.e. 172.217.174.0 of google in routing table

now IP address of google has added to routing table.

let’s check check the route table again to verify whether rule is added to the table.

🔷 Now again let’s check whether we have network connectivity with google as well as facebook .

  • First let’s ping to google

yes.. we have network connectivity with google from my system..🤩

  • Now let’s try to ping to facebook

No.. we are not able to connect to facebook . Because we didn’t added IP of facebook to routing table and previously we deleted the default routing rule so now we can’t connect to faceboook in this case.

Now we have verified also that we are able to ping to google i.e able to connect to google but unable to connect to facebook.

Finally our Task is completed successfully !!!!🤩

Thank you for reading …!

--

--