Creating Customized Network by the manuplation of the Routing Table

Gaurav Tank
3 min readDec 28, 2020

What is Routing Table?

A Router is a networking device that forwards data packets between computer network. This device is usually connected to two or more different networks. When a data packet comes to a router port, the router reads address information in packet to determine out which port the packet will be sent.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.

To see he routing table of a linux system we use this command:

Routing Table
route -n

Here we can see the route of 0.0.0.0. This means with the internet connectivity we can go to any system in the world. Now, we can see that we are able to ping both google and facebook.

ping -4 www.google.com

We have to use the -4 option to command the OS to also print the IP address of the destination in IPv4 format.

pinging google and facebook

Here we can see that the our OS is pinging to google via IP address: 216.58.221.36 and facebook via 69.171.250.35.

But we have to change the settings so that we can only be able to ping google but not facebook or any other site. For that we have to

Deleting the entry

For this, first we have to delete the entry and do the following entry to achieve this.

route del -net 0.0.0.0 enp0s3

Here, make sure to mention the correct network card name. Because sometimes it is possible to have more than one network card in a system. So it is preffered to always write the network card name with any networking cmd.

Second step is to manually add the subnet of the Proxy of google. From above we can observe that the IP of google is 216.58.221.36. So we will add a route of 216.58.0.0/16.

route add -net 216.58.0.0 netmask 255.255.0.0 gw 192.168.29.1 enp0s3

Now we are able to ping google but not facebook.

pinging google.com
unable to ping facebook

Conclusion

We can customize our network only by manuplating the routing table. We do not have to uptdate the Security Groups(SG) for that.

Thank you!!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response