⚜ Create a Setup so that you can ping google but not able to ping Facebook from same system

Manojnagabairu
3 min readSep 7, 2022

Hi everyone

Today We are going to play with networking a little bit by using routing table and I hope you will enjoy the whole content.

Okay let us start from the beginning…

💠 Routing Table

▷ For a network route to know where to send packets of data it receives, it uses a routing table. The routing table contains a list of specific routing destinations. When the router receives a packet of data, it references the routing table to know where to send that data. The routing table may also contain information on how far each destination is from the router. In essence, a routing table is a map for the router.

💠Netmask

▷ A netmask is a 32-bit binary mask used to divide an IP address into subnets and specify the network’s available hosts.

In a netmask, two of the possible addresses, represented as the final byte, are always pre-assigned and unavailable for custom assignment. For example, in 255.255.225.0, “0” is the assigned network address. In 255.255.255.255, the final “255” is the assigned broadcast address. These two values cannot be used for IP address assignment.

💠 Gateway

▷ A gateway is a data communication device that provides a remote network with connectivity to a host network.

A gateway device provides communication to a remote network or an autonomous system that is out of bounds for the host network nodes. Gateways serve as the entry and exit point of a network; all data routed inward or outward must first pass through and communicate with the gateway in order to use routing paths. Generally, a router is configured to work as a gateway device in computer networks.

▸Now when we try to do this set-up we are changing the rules in the routing table for allowing google IP address and not allowing Facebook IP to reach out.

※ First let us see the routing table with command “route -n”

routing table

※ Now we can see the ipv4 of google server using nslookup command and try to ping the www.google.com using the ipv4 address.

pinging to google server

※ Now do the same to Facebook site and ping to www.facebook.com

pinging to fb server

※ Now delete the universal rule from the routing table which allows us to connect to every IP by using “route del -net 0.0.0.0” . After that u can see the routing table without the universal rule

deleting the rules in routing table

※ Here we can see that both google and Facebook servers are not reachable .

pinging to go and fb servers

※ Now add a rule in routing table so that system can connect to only google server. Here we use the network of google instead of it’s exact IPv4 and the netmask of the entered network and with the gateway of your ethernet card.

adding the rule to routing table

※ Now we can ping to the google server but not Facebook

pinging to google and fb server

Thank you visiting my page😊

--

--