This is one of the most common problem for all beginners who tries connect guest os in virtualbox internally. So this post will help you connect guest OS with each other Easily.
Here to explain you, I have setup two Virtual Machines, one is Kali Linux and second is Redhat.
Let’s start our Process without any further delay.
1). First open Virtual Box.
2). In Menu Bar, Click on Preferences.
3).Now go to Network Tab and in Nat Networks, click on add Symbol.
4). Click Ok, That’s all you need to do.
Now, In Virtual Box go through Kali Linux >> Setting >> Network, then in “Adapter 1” select “NAT Network” in drop down.
Now, In Virtual Box fallow the same steps i.e. Redhat >> Setting >> Network, then in “Adapter 1” select “NAT Network“.
Now, Open your Virtual Machines(Guest OS) and check for IP allotted to them. In my case i have 2 machines (Redhat and Kali Linux).
On Kali Linux, open terminal and type “ifconfig“. You will see that you have been given IP(like 10.0.2.2 or 10.0.2.3 or other) from the Virtual Box.
Now in Redhat, Open terminal and type command “ifconfig“. Sometimes network adapter is not active, so it dose not show IPv4. As it happened in my case.
In that case you can use “nmcli con show“.
You will get to know that your Network adapter is not connected to device(Selected portion in above image) and to fix that you can use command “nmcli con up enp0s3“(enp0s3 is network adapter name which can vary in your case). To fix this issue permanently for future, so that you may not face the issue when restarting your system or network, you need to use command “nmcli con modify enp0s3 connection.autoconnect yes“.
Now you can check for your Redhat system IP by using “ifconfig“.
To check if both of your Virtual Machines are able to connect or not. Just ping other System IP. Like if kali has 10.2.0.3 and Redhat has 10.2.0.4 . Then from Red Hat System use “Ping 10.2.0.3” and vice versa.
This completes Guest OS Internal connection.
With Above settings, Your Virtual Machine will be able to access Internet from your Host System
Hope this Post was Helpful.