Linux Networking - 2

Linux Networking - 2

Task - 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.

So, here we have to set up rules for 3 computers A, B, and C. Our objective is to allow A to communicate with B and C. At the same time, B and C can only communicate with A and not with each other.

To check the IP addresses of these computers we use:-

ifconfig enp0s3

Computer A:-

a.jpg IP=192.168.43.219, netmask=255.255.255.0

Computer B:-

b.jpg IP=192.168.43.211, netmask=255.255.255.0

Computer C:-

c.jpg IP=192.168.43.179, netmask=255.255.255.0

All 3 computers A, B and C belong to the same subnet.

There are many ways to prevent B and C from pinging each other, but here I'm gonna use the simplest option which is to use the reject option with the route add -host command.

By adding the reject option, we are preventing the tracking of a route to the mentioned host. The command is as shown below.

route add -host <IP> reject

The above command will prevent the tracking of a route to the mentioned host, and the two computers can't connect to each other.

Now run this command in Computer B and try to ping Computer C :-

b to c.jpg

In the above figure, you can see the alterations in the routing table and when we try to ping Computer C it can't ping, but it can ping to Computer A .

Now we move to the Computer C and try to ping Computer B .

c to b.jpg

You can see it is trying to ping Computer B but can't reach the host but it can ping to Computer A .

Now we move to the Computer A and try to ping Computer B and Computer C from it.

a to b and c.jpg

Now you can see Computer A can successfully ping both Computer B and Computer C . So, our task is now completed.

Thank you