Setup system for pinging to only google not facebook

Dhiraj Kumar
3 min readJan 14, 2021

Networking is the process by which IT resources are connected for transfer data among each other frequently without getting any error .

Basics requirements of networking between two systems:

  1. There should be physical connection between two computers
  2. There should be network card in both computers and allocated IP address
  3. If both computers are in same network then switch is required , but when both computers are in different network then router is required for networking .
  4. For setup connection between two computers ,Routing table is necessary . it allows to create packet for transfer data .

For setup connection between two computers , it is necessary to create net packet, in net packets two sections are available , header and payloads . In header information of data is mentioned , source IP and destination IP is also mentioned ,data is available in payload.

In this task , i have configured a system as system can ping to google only , can’t ping to facebook using routing table .

In networking, routing table has important role for setup connection between two systems . When all requirements are full filled for setup connection but there is no any rule created in routing table then net packets will not be created and without net packets two systems can’t ping to each other .

I have a system which IP address is 192.168.43.101 This system can ping to google and facebook both due to existence of default gateway rule in routing table.

Default gateway is a routing rule which allow system to connect with public world . For check routing rule run below command

route -n

In this system default gateway is available in routing table. For creating default gateway routing rule in this system , run below command

route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.43.1 enp0s3 

For check the connectivity with google , first of all run below command and check the server IP and try to ping

nslookup www.google.com

By runnnig above command i got the IP address of google is 172.217.167.228 and i have checked the connectivity with below command and got to know that system is pinging with google.

ping 172.217.167.228

For check the connectivity with facebook, first of all run below command and check the server IP and try to ping

nslookup www.facebook.com

By runnnig above command i got the IP address of facebook is 69.171.250.35 and i have checked the connectivity with below command and got to know that system is pinging with facebook.

ping 69.171.250.35

Now setup system as system can ping to google only but can’t ping to facebook , for this first of all delete default gateway using below command

route del -net 0.0.0.0

Now run below command to add routing rule for ping to google only . I got the IP address of google is 172.217.167.228

route add -net 172.217.167.228 netmask 255.255.255.255 gw 192.168.43.1 enp0s3 

Now check the connection using ping command , and got that system is pinging to google but can’t ping to facebook .

ping 172.217.167.228ping 69.171.250.35

--

--

Dhiraj Kumar

Expertise on Cloud Computing who has helped many startups to reduce cloud cost upto 40% based on business need. Focused to optimize development process.