š° Create a Setup so that you can ping google but not able to ping Facebook from the same system
VirtualMachine should be able to ping to google but not to FB.
Solution: give the range in RT which has google IP in it but not of FB IP.Pinging to google.com
Command: ping google.com

Working fine because 0.0.0.0 is by default added in Routing Table
Letās first delete this rule otherwise, the system can ping any IP i.e will create the packets.
Command: route del -net 0.0.0.0
checking the table now:
Command: route -n

Letās use one of the Google IP i.e 172.217.166.0 ā one can get all the IP by ns-lookup command eg. nslookup www.google.com
Give the netmask and proving the range
Command: route add -net 172.217.166.0 netmask 255.255.2555.0 gw 192.168.0.1

Now the range has been given to create the packet. Ok
And go the gateway via nic and ping successful
Command: ping 172.217.166.68

Letās take one the FB IP: 157.240.198.35
Command: ping 157.240.198.35

Itās unreachable: as the rule for this IP range is not added.
Practical completedā¦ā¦ā¦ā¦.
ADDITIONAL KNOWLEDGE
HOWEVER,
If we want to provide this range too, let's see how to do it.
Adding the new range
Command: route add -net 157.240.198.0 netmask 255.255.255.0 gw 192.168.0.1 enps3

Worksā¦ā¦..
So, adding always range would we very hectic
Add the gateway 192.168.0.1 for any IP in the world.
And the first IP is 0.0.0.0 and the last IP is 255.255.255.255 ā all possible IP range
And the first IP is known as the network name of the range. So 0.0.0.0 means any IP. => 2³² hosts are possible. So here netmask is what /0.
0.0.0.0/0.0.0.0 => all the IP in the world. And Network name with netmask is called subnet id.
route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.0.1

Now the system can ping any IP in the world.
Letās ping to twitter.com

Yes, it's workingā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦
Linkedin: https://www.linkedin.com/in/akshay-anil-26672a172/