Below is the implementation
Let’s start and move ahead to the implementation part:
Step 1: Check the rules available in the routing table.
route -n
To check the rules present in the routing table, we use the command route -n. Here we have a rule in the very first row 0.0.0.0 that allows us to access or ping any site, so to restrict the connectivity to Facebook we will delete this rule with the command route del -net 0.0.0.0\
route del -net 0.0.0.0
Step 2: Check the network name for Google and Facebook
So now to check the network name we use the command:
nslookup domain_name
Step 3: Check connectivity to the network
To check the connectivity we will ping the address which we get from the last step.
Step 4: Add a rule to connect to Google
To add a rule to connect to Google we will use the command route add -net 216.58.196.0 netmask 255.255.255.0 gw 192.168.43.1 enp0s8
Step 5: Check the connectivity to Google
We use the ping command here and check the connectivity.
Step 6: Check the connectivity to Facebook
Not connected to Facebook. Hence we achieved our setup. Just like this, we can achieve any type of customized network setup by adding specific rules in the routing table and restrict them.
How to disable ping to a website using Linux?
In this article we are going to create a customized network setup, to restrict accessing specific sites.
Suppose we want to access Google and don’t want to access Facebook, for this we need to create a customized network setup by configuring some routing rules for our system router. So let’s come to some terms regarding networking: