Linux tasks

Vibhanshusharma
4 min readMar 28, 2021

Linux Network Modification

Create a 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.

Basic command used too check-

ifconfig enp0s3

NETWORK TOPOLOGY

Network topology refers to how various nodes, devices, and connections on your network are physically or logically arranged in relation to each other. Think of your network as a city, and the topology as the road map. Just as there are many ways to arrange and maintain a city — such as making sure the avenues and boulevards can facilitate passage between the parts of town getting the most traffic — there are several ways to arrange a network. Each has advantages and disadvantages and depending on the needs of your company, certain arrangements can give you a greater degree of connectivity and security.

Task to do!

Create a 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.

Basic command used too check-

ifconfig enp0s3

Now change its IP to 172.20.10.1 and route del -net to remove 0.0.0.0

A

Here we will change the route table as in above photo using

route add -net

B

Similarly we will change the route table of other network card as above

Then try to ping an IP

As you can see it is unable to ping 172.20.10.10 due to the changes we made in its Route Table.

C

Now we will change the route table and try to ping as in above case

Here you can see that it also can only ping 172.20.0.1 and no other IP.

Hence here Both B and C can ping only A but no other IP, while A can ping both B and C.

Ansible Playbook

Task to do!

Create an ansible playbook that will fetch new container_IP and update it in the inventory, so that it can be used for further configuration of Web-server.

So the Ansible playbook you need to write is

Ansible Playbook
docker ip.txt

Running the playbook

No error!

Now time to check

Task Completed Successfully

Ansible Playbook 2

Create an Ansible Playbook which will dynamically load the variable file named same as OS_name and just by using the variable names we can Configure our target node.

So the playbook i have written to perform the task is below

Here p is the variable and i have made 2 files namely redhat.yml and ubuntu.yml as below.

Now test your playbook by running it.

Task completed successfully

THANK-YOU

--

--