Network to Google but Not Facebook

Network Setup

Suppose we have a requirement that we can connect to google, but can’t connect to Facebook. For this we need to configure some routing rules for our system router. So lets come to some terms regarding networking:

Router

A device in a network that handles message transfers between computers. A device that forwards data from one network to another. A router receives and sends data on computer networks.

Router connection to multiple systems

Network

A network is a collection of computers, servers, mainframes, network devices, peripherals, or other devices connected to one another to allow the sharing of data. An example of a network is the Internet, which connects millions of people all over the world.

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.

Entries of an IP Routing Table:
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. Routing Table provides the device with instructions for sending the packet to the next hop on its route across the network.

Each entry in the routing table consists of the following entries:

  1. Network ID:
    The network ID or destination corresponding to the route.
  2. Net Mask:
    It is the ID that helps to know the network name.

Implementation

We will implement the setup in some following steps:

Step 1: Open the Routing table and check the rules available.

Rule to go anywhere

For now we have a rule to go anywhere over Internet. So to fulfill our requirements we need to remove this rule. To remove this rule, we use “route del -net 0.0.0.0” command:

Successfully deleted rule for everywhere

Step 2: Check the network name for Google and Facebook.

To check their network name , we use the “nslookup domain_name” command:

network name for google
network name for facebook

Step 3: Check connection to these networks.

We can check the connection using ping command.

Unable to reach to google
Unable to reach to facebook

Step 4: Configure a rule so that we can connect to google.

To create a routing table rule for google network, we will use “route add -net 216.58.203.0 netmask 255.255.255.0 gw 192.168.29.1 enp0s3” command:

Successfully added the rule for google

Step 4: Check the connectivity to google network.

Again we use the ping command here:

Able to reach to google network

Step 5: Check the connectivity to Facebook network.

Unable to reach to facebook network

Hence, we have achieved our customized network setup. Now we have an ability that we can connect to google but not to facebook, although the Facebook server is not down!!!

This is pure network setup! Just like this we can achieve any type of customized network setup.

💫Keep Learning, Keep Sharing💫

I am a tech enthusiast, researcher and work for integrations. I love to explore and learn about the new technologies and their right concepts from its core.