Network to Google but Not Facebook
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:
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.
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.
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:
- Network ID:
The network ID or destination corresponding to the route.
- Net Mask:
It is the ID that helps to know the network name.
We will implement the setup in some following steps:
Step 1: Open the Routing table and check the rules available.
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:
Step 2: Check the network name for Google and Facebook.
To check their network name , we use the “nslookup domain_name” command:
Step 3: Check connection to these networks.
We can check the connection using ping command.
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 18.104.22.168 netmask 255.255.255.0 gw 192.168.29.1 enp0s3” command:
Step 4: Check the connectivity to google network.
Again we use the ping command here:
Step 5: Check the connectivity 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💫