If you will have a look upon my earlier blog on the same topic, I assume you very well know how to run the command into the remote host, how to use SSH protocol. Likewise, here we’ll see performing same things through VM’s.
Suppose, we have 2 laptops, A (base laptop) and B, we have to connect there O.S. with each other. We’ll enable hotspot from our phone which acts as a wireless acquiring point. The base laptop A should be connected to the point. Subsequently, enable the Bridging to connect A network card with B network card. Instinctively, you will get the IP addresses and just ping the systems with each other. For ping command to work you should have end to end connection between those 2 systems.
If you have to ping both O.S with each other then they should have a wire connected in between namely, Virtual Wire. In both the O.S, put the network cards in ‘Host only mode’ and then ping the same. Only provocation is O.S in host only mode will lose the internet connectivity, it’ll have connection but they can’t access to internet. As a solution we can use Bridging which needs some outside wireless hub, so as usual we have the hotspot.
Note that you can also connect more than 2 laptops with the same process. Or you can connect multiple laptops to your mobile phones. We also have a notion of Virtualisation where if you don’t have multiple laptops then you can install many VM’s. Base O.S is the host O.S and the guest O.S are the 2 VM’s.
Now, as both the systems are connected, we’ll start running the commands. Suppose I have to run the command in B from A,
$ ssh 192.168.0.--- (command)
The command will be execute it from the given IP address through SSH protocol. For security reasons, enter the password of B and you’ll get the output.
# If you have to store any data, you’ll need a file. If I have a program in A, I can run it on the same system as it is the part of hard disk. For executing it in B, you should have the same program saved in B, for this-
$ pwd/foldername $ scp (file name) 192.168.0.---- (folder name)
#this will store the local file in folder name of B. For confirming run this command in B,
And finally, for executing a program in B-
$ ssh 192.168.0.----- (program file name)
Your program will run successfully.