Home > Hyper-V > Setting up file sharing between guest and host OS in Hyper-V using an Internal network

Setting up file sharing between guest and host OS in Hyper-V using an Internal network

This post talks about making the network configuration settings made on a Hyper-V virtual machine in order to allow file sharing between the virtual machine and host OS. There are 3 types of Hyper-V networks that the virtual machine could be using – Private, Internal and External. Private does not allow any communication except between virtual machines using the same Hyper-V virtual switch. So in order to enable file sharing either an "Internal" or an "External" virtual switch is required.

To learn how to set up an Internal or External virtual switch and the nuances of each, refer here. This post assumes that the VM in question has been configured to use an "Internal" connection type.

On the VM, chose "Network and Sharing Center" > "Change Adapter Settings" to show that we have simple virtual adapter with no connection to any physical network.

clip_image001

Doing an ipconfig on the machine through command prompt shows the adapter is assigned a 169.254.X.X IP which shows it is a limited connection right now. This is because we are using an "Internal" virtual switch type on Hyper-V and are not connected through the physical adapter on the host machine.

clip_image002

So in order to get this virtual machine to be able to communicate with the host, I went about assigning it a static IP address. First, bring up the properties of the adapter from the right click menu.

clip_image003

From the "Ethernet Properties" dialog, selected the "Internet Protocol Version 4 (TCP/IPv4)" option and clicked on the "Properties" button.

clip_image004

When on the IPv4 properties dialog, I need to set a static IP on the adapter that is on the same subnet as the host machine. What this will enable is the ability for the Virtual Switch to route communication between the host and guest operating systems. I chose the IP address shown below because my host machine runs with a 192.168.1.X IP. Set the subnet mask to 255.255.255.0 as shown to ensure same subnet and clicked "OK" to finish.

Now I could have made other settings such as the gateway (which shouldn’t have mattered since there is no physical network connection and Preferred DNS Server which I will eventually have to come back to when I set up the DNS service on this machine. But I am doing the bare minimum here to get the communication working.

clip_image005

On the "Ethernet Properties" dialog, clicked "Close" to apply the settings and move along.

clip_image006

Confirmed that the settings were applied.

clip_image007

Created a new folder called "Transfer" to serve as a go-between for file transfers between the guest and host OS and selected to share it with "Specific people…"

clip_image008

Clicked on "Share" to begin sharing the folder.

clip_image009

The "Network discovery and file sharing" dialog shows up. Selected "No, make the network that I am connected to a private network". It wouldn’t matter greatly because the machine is on an internal network anyway but it is the right choice to make.

clip_image010

Once that is done, the shared folder should be accessible at the path indicated in the screen below. Clicked on "Done" to close out of this.

clip_image011

So let’s try accessing this folder from the host. Opened a file explorer window and type the path shown above in the address bar. The first time connection will require username and password to be typed in. We get away with not using domain specification here because the virtual machine has not been added to a domain yet. If we did, we may have had to use a valid domain user login.

clip_image012

In any case, once authentication is through you are able to view the contents of the folder on the host operating system. Added a file here to complete the test.

clip_image013

And here’s the file on the guest. Besides testing the ability to transfer data, this has also verified the working of the virtual switch.

image

And that’s all there is to that.

About these ads
Categories: Hyper-V Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: