Linux |
|||||||||
Setting a Network Interface between Host and Guest
In default configuration of Virtual Box, the network on Host PC (Windows 10 in my case) and the network in Virtual PC (Ubuntu in my case) does not belong to the same network. It means that there is no network connection between the host PC and Virtual PC. This caused a lot of trouble to transfer files between the Host and Virtual PC. At first, I setup a shared folder between the host and virtual PC as described here. But I hoped I have IP connection between the Host PC and Virtual PC and use FTP based application (like WinSCP) to exchange files. This is why I decided to investigate on this and write a note about it.
NOTE : Virtual box version that I used for this tutorial is v5.2.6. If you use the different version of Virtual Box, you would see a little bit different screenshot from what you see in this tutorial, but you would see the general idea from this tutorial even if you are using a different version.
Check up before Setting the Interface
Take a look at the network configuration of your Host PC. Following is the configuration on my PC before setting the interface. Of course, this is just for your reference. This will be different from what you see on your PC.
Following is the network configuration I get on my Virtual PC (Ubuntu in Virtual Box). This would be different from what you see in your PC.
Except the local loopback interface lo, you see there are two network interface named epn0s3 and epn0s8. These two interface configuration can be seen in Vitural Box Network Setting as shown below.
Following shows the interface setting for enp0s3. You would know this is for enp0s3 by comparing MAC address with HWaddr shown above.
Following shows the interface setting for enp0s3. You would know this is for enp0s8 by comparing MAC address with HWaddr shown above.
Now let's setup a Network Interface between the Host PC and Virtual PC. Click on [Settings] button as shown below.
As shown in previous section, Adapter 1 and Adapter 2 are used for the default Network Interface for my PC. So I will configure Adapter 3 for the new interface between Host PC and Virtual PC. Default setting for Adapter 3 is as follows.
Configure the settings for Adapter 3 as shown below and click [OK].
NOTE : In some case, you may not see the item [Host-only Adapter] in 'Attached to' drop down box in the above configuration. In this case, check the network adapter settings in the host PC (Windows 10 PC in my case) and make it sure you find 'VirtualBox Host-Only Network' and it is 'Enabled' as shown below.
Check up after Setting the Interface
Now let's check if the new interface is successfully set. First, check the ipconfig on the host PC (Windows 10 PC in my case). I can find a new interface is added as shown below.
Then check ifconfig on the Virtual PC (Ubuntu in VirtualBox in my case). I can see a new interface are created as shown below.
As a final check, let's try ping between the Host PC and Virtual PC. Following is the result of ping from Host PC to Virtual PC.
Following is the result of ping from Host PC to Virtual PC.
After I completed this step, I installed open-ssh server on my virtual PC (Ubuntu) and then establish SFTP connection between the host PC (Windows PC) and Virtual PC using WinSCP. Then I was able to transfer files back and forth very easily.
|
|||||||||