Customized networking by manipulating the routing table

In this article, We will Create a network Topology Setup in such
a way so that System A can ping to two Systems
System B and System C but both these systems should
not be pinging each other without using any security rule
e.g firewall etc.

Every time you connect a computer to a network, you are dealing with the issue of routing. is a means of sending an IP packet from one point to another. For instance, when you send an e-mail message to your friend in another country or even across the street, you are transmitting a series of IP packets, or datagrams, from your computer to your friend’s computer. So how does this information get there?

Well, your system sends the packets that consist of your e-mail message to your specified gateway. The gateway then forwards the packets to another gateway, or router. The process continues until the packet arrives at your friend’s system and he or she reads the message. This is true for all Internet protocols, whether it is FTP, HTTP, IRC, and so on.

If you have a single computer, you typically do not need to worry about routing. You simply tell your computer to use the IP address of the gateway supplied by your ISP and off you go. If, however, you run a network of computers, this can become a little bit more of an issue. If you place a firewall in front of your network, you need to configure things further. With this setup, you are actually dealing with two networks: your local network and the Internet. Packets coming from one to the other need to be forwarded in special ways so they arrive at their appropriate destinations.

On Linux and UNIX systems, information on how packets are to be forwarded is stored in a kernel structure called a routing table. You need to manipulate this table when configuring your computer to talk to other computers across a network. The routing table can be used for both static and dynamic routing. Dynamic routing consists of the kernel making decisions as to which route, out of multiple present routes, a packet should take. Since dedicated routers and ISPs generally deal more with dynamic routing.

Let’s now directly move into the practicals for clear understanding :

Cmd to see system’s IP

ifconfig enp0s3

We can even add our customized IP using the above cmd IP of System A

/24 is the netmask IP of System B IP of System C

Let’s first delete all the existing rules in the routing table, we can delete using the cmd:

route del -net <ip>/<netmask> enp0s3

Now Let’s add the rule in Sys A, using the cmd:

route add -net

this will have the netmask of, and the range of IPs belong to this are to i.e., SysA, SysB and Sys C along belong to this range.

For this we provide a netmask of, only 2 ips come in this range those are ips and i.e., SysC doesn’t come in this.

For this also we provide a netmask of, only 2 ips come in this range those are ips and i.e., SysB doesn’t come in this.

Now as System A Range From Ips 0 to 3 we can connect with both SysB and SysC.

Sys A pinging to both Sys B and Sys C

System B route table has the range from only 0 to 1, it means we can connect to SysA but not to SysC

Similarly, System Croute table has the range from only 0 to 1, it means we can connect to SysA but not to SysB

As you can see, routing doesn’t necessarily need to be a complicated matter. Static routes are the easiest to deal with and create. With a few simple commands, you can tell your computer how to deal with the different networks available to you.

Thankyou! keep learning! keep growing! keep sharing!

Krithika Sharma
If you enjoyed this, follow me on Medium for more
Let’s connect on LinkedIn



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store