How to create a setup so that our machine would connect with some specific sites only?

Utkarsh Srivastava
3 min readMar 14, 2021


In this task, I will be going to show how to create a setup so that our machine would ping to GOOGLE but not FACEBOOK in any case.


  1. Knowledge of Gateway.
  2. We would need connectivity.
  3. Routing table

Routing Table:

In the computer language, the Routing table is a set of rules, often viewed in table form 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 routing table contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination. When a packet is received, a network device examines the packet and matches it to the routing table entry providing the best match for its destination.


A gateway is a hardware device that acts as a “gate” between two networks. It may be a router, firewall, server, or another device that enables traffic to flow in and out of the network.

While a gateway protects the nodes within the network, it also a node itself. The gateway node is considered to be on the “edge” of the network as all data must flow through it before coming in or going out of the network. It may also translate data received from outside networks into a format or protocol recognized by devices within the internal network.

A router is a common type of gateway used in home networks. It allows computers within the local network to send and receive data over the Internet.



First, ensure that whether we have connectivity with both of the sites(GOOGLE & FACEBOOK) or not.

Hence, we have connectivity with and Since VM is pinging them. We use the command → [ ping ]


Restrict the local machine from internet connectivity.

So, Delete the route which is responsible for connecting the local machine to the internet.


Allow your local machine to connect with google server, but not with Facebook.

In this case, we are allowing our machine to connect with only, and restricting it from connecting with allows our local machine to connect with any host in the world.

Hence our local machine is pinging GOOGLE but not FACEBOOK.

This is how we can create a network setup in a system that can block network access to a particular website.