Creating a setup reachable to Google but not Facebook

shreyash kotgire
3 min readMar 14, 2021

--

In this article I am gonna show u how to create a setup for custom access to sites with the help of basic networking principle’s such as routing table, route rules.

I am performing this practical in Red Hat Enterprise Linux 8.

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.
route -n 

with this command u can access routing table in Linux

as u can see there’s 3 routing rules in system in first rule destination is 0.0.0.0 and genmask i.e netmask is 0.0.0.0 this means my system can reach to any IP address in world.

so we need to delete this rule to provide custom connectivity use following command to delete the rule

route del -net 0.0.0.

so we have deleted rule and u can see we are not able to reach google as well as facebook. if your routing table has the rule for network then only u can reach to that network.

now we will add a routing rule to reach google, in the start when we ping to google we found that 172.217.27.196 is the one of the IP address so we can conclude that 172.217.27.0 this range belongs to google.

for creating rule we need 4 things destination IP, netmask , gateway IP , network card.

route add -net 172.217.27.0 netmask 255.255.255.0 gw 192.168.43.1 enp0s3

So we finally established a setup in which we are to reach Google but not Facebook with the simple networking concept. If want to block a specific site we can do the same with that no extra tools, firewall needed.

Thank you for reading …!

--

--

shreyash kotgire
shreyash kotgire

Written by shreyash kotgire

student at VIIT, Trainee at ARTH

No responses yet