I like windows but I love Linux OS. If we have both in one place, which will be great for doing many things. Fortunately, we have window 10 with Hyper-V. Having this combination of both OS in a single place is a great option for developer/Solution Architects. Of course I used Windows here. But there are many flavours of macOS software for Virtualisation.
More than that, I would love to connect same Linux instance using ssh remotely (but locally within the same laptop) as if I connected remotely to one Linux machine hosted in Data centre or cloud service providers without any internet connection or external dependent configuration.
This setup is very handy most of the time to showcase some demo with the customer when the demo needs to be functional in different OS.
Here host machine is Windows-10 , the guest machine is Hyper-V VM Ubuntu 18.4 LTS.
I am not going to explain how to install Hyper-V and Linux VM here. You can refer windowscentral website for details. Once you have done installation of Hyper-V and Ubuntu (I used 18.04 LTS). In order to access the guest machine through ssh through putty , execute following comments guest ubuntu machine terminal
To update overall package
sudo apt update
To install and update network tools
sudo apt install net-tools
Next step to install open-ssh server
sudo apt install openssh-server
You should see “active (running) from command.
Now update the firewall rule to allow ssh daemon.
That’s it, you have own ssh server installed.
Now run “ifconfig
| grep inet ” -> find out IP address of the machine, here eth1 network adaptor used.
Now enter IP address ( here 192.168.0.19) into putty, the first time you need to allow first ssh key by typing “yes”
Bang!! Now you will able login in Ubuntu Linux machine running in same window host machine through remote ssh. You start your Ubuntu VM in headless mode, ssh with that machine remotely if you know IP address.