Creating a Network Topology such that you can ping Google, but not Facebook from the same system.
Step 1: The route -n command lists the routing table
- A default route is a route that takes effect when no other route is available for an IP destination address.
- It gives a route to a router to forward all incoming packets whose destination network addresses are not available in the routing table.
- 0.0. 0.0 usually means the default route, i.e. the route which leads to ‘the rest of the Internet instead of somewhere on the local network.
Step 2: ping facebook.com and www.google.com
As you can see ping facebook.com and ping google.com is working and we are able to send and receive packets successfully.
Step 3: Now we will use nslookup command to look up the IP Address of Google and Facebook
Step 4: Now, Delete the default routing rule using command → route del -net 0.0.0.0
Let’s check, If we can ping google and facebook from our system
As expected, we are not able to ping either of them.
Step 5: But we have to create a setup where we could ping to google but not to facebook. So, we need to modify the routing table using the following command.
Basically, we can achieve this if we add all the IP Address ranges in the Network Netmask of google in the routing table
[As we found earlier using nslookup command the IP address of google is 220.127.116.11, So the lets create a rule that allows the Network range of 18.104.22.168/255.255.0.0]
Step 6: Check again if now we are able to ping facebook.com and google.com
As you can clearly see that ping facebook.com is still not working. But ping google.com is working as expected.
So the setup where we could ping to google and not to facebook is successfully created!