Setting up the Network Topology So that System A can ping System B and System C but System B and System C can’t ping each other
Using Routing Table

Introduction :
Routing table :
Routing table is a data table and contains rules which determines whether to create a network packet to a particular destination. If the rule is there in the routing table that you can send packets, you can send. The routing table present in all devices. We can create routing table accordingly to whom we have to create and for whom we don’t have to create. After creating routing table, the OS can identify the rules. So, accordingly it will create.
Network Name :
Network Name is actually an IP and the first address of the Network which actually tells about the Network range with respect to Netmask. It is the reserved IP of the Network. We can able to send a packet within the Network name or Network range which we create in routing table. It is also called as Network ID.
Netmask :
Netmask actually tells the range of IPs in the network starting from Network name. Netmask can also be called as Subnet mask or Genmask (But there is a little difference betweeen Netmask and Subentmask but logic wise both are same). The Network name with Netmask is called as Subnet ID. The Subnet ID is represented as Network_name/Netmask. For ex: The IP address of the system is 192.43.56.180 . In this, the network name can be 192.43.56.0 and netmask is 255.255.255.0 and whole can be represented as 192.43.56.0/255.255.255.0 or 192.43.56.0/24 (24 is prefix) and this is called Subnet ID. The last ocatate which occupies in the Network range is called Host ID. In the example the 180 is called host ID of 192.43.56.0/24 network.
Internet Gateway :
Internet Gateway is a router which can connects your network to Internet. It may be Physical device or Virtual device.
Now, Let’s go to our task
Task
We want a network topolology in such a way System A can ping System B and System C but both these systems should not ping each other.
Sytem’s IP addresses are as follows :
- Sytem A — 192.168.43.57
- System B — 192.168.43.42
- System C — 192.168.43.24
We can check routing table with route -n



All the routing table rules are by default and I can go to Internet and ping any system through Internet Gateway 192.168.43.1



Now, to make our setup we have to make changes in routing tables of System B and System C.
Step-1 :
Let’s delete all the rules in routing tables of System B and System C. After deleting you can see in (vii) and (viii) that system B and System C are not able to create packets. So that, Iam not able to ping any system.
//In system B
route del -net 0.0.0.0
route del -net 192.168.43.0 netmask 255.255.255.0 enp0s3

//In system C
route del -net 0.0.0.0
route del -net 192.168.43.0 netmask 255.255.255.0 enp0s8

Step-2 :
Add rule in routing tables of both System B and System C so that they can ping only System A but not any system. So it satisfies our requirement that System B and System C should not ping each other.



So like this you can make Network topology as you like.
Different Method
Here in this setup System B and System C are not able to connect any other system except System A. Suppose if you want to connect Internet like any site for suppose google.com, you can’t connect from System B and System C.
So we have another method to make like this setup but also can connect to Internet like google.com .
In this setup System B and System C can’t ping each other but can ping any other system.
// In System B
route add -host 192.168.43.42 reject

// In System C
route add -host 192.168.43.24 reject

You can also see from System A, we can ping both System B and System C

You can also delete this rule if you don’t want
route del -host <IPV4> reject
So you can choose whatever the method you want depend on your use case
Thankyou…
Keep learning…
Keep sharing…