Solved

acccessing a database on a virtual machine

Posted on 2008-10-07
26
512 Views
Last Modified: 2013-11-23
Hi Folks,

I am trying to access a database on  a virtual machine  (virtual pc 2005) using my host pc. Can this be done?

I am doing this to setup a test environment of my sql server database using a ODBC connection on the host machine. I am doing a bit of testing and it seems I can access the host from the VM but not the other way around. If I can do this pointer to documentation would help.
0
Comment
Question by:david_32
  • 13
  • 13
26 Comments
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
Hello david_32,

Can you ping the Virtual PC?
Isn't the firewall blocking the connection?

Regards,

Jupiler78
0
 

Author Comment

by:david_32
Comment Utility
No I can't.. when I choose one of NICs in my VM network setting and set the NIC up in the VM to access a DHCP server I have limited connection which obviously will not ping.

When I choose shared networking (NAT) in VM network setting and set the NIC up in the  VM to access a DHCP server I do get a IP which I can ping from the VM but not the host machine (they are different class of IP anyway one is 192.168.131.0 other is 172.30.0.0)


Firewall is turned off. I am using a PC (I don't know why this is categorised under apple).

which network setting should I choose to achieve my goal
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
david_32,

If you stay on NAT and then put the TCP/IP-settings manual, so that it is in the same range as the host.
Can you ping both ways then?

Jupiler78
0
 

Author Comment

by:david_32
Comment Utility
no.. will not ping either way then.

I disabled a NIC on my host (I had 2) to get an IP address to use on the VM. I hope that was ok.
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
david_32,

I have added a second network adapter in my virtual pc, as type the wireless adapter i'm using to connect to my network.
That gives me an network-address in the same range as the host.
Then I tried to ping from the virtual pc to the host, that worked, also to my router.
Backwards, it didn't work.
Then I switched my firewall on the virtual pc off and after that I could pint my virtual pc from my host.
So I could connect in all ways.

Jupiler78
0
 

Author Comment

by:david_32
Comment Utility
>>Then I switched my firewall on the virtual pc off and after that I could pint my virtual pc from my host.


not sure what you are trying to say here. Can you say it another way?

Doe your VM NIC have a different IP than the IPs of your host NICs?
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
My Virtual Machine has 2 ip's right now:
- 192.168.131.65 from the nic 1 (configured as "Shared Networking (NAT)")
- 192.168.1.26 from nic2 (configured as "adapter PRO / wireless ...")

My Host has as IP: 192.168.1.10

When I only had the Shared Networking nic, I could get to the internet, but could not ping my host. But with this configuration I can ping the VM and host from each other. I just had to turn off the windows firewall from the VM, as otherwise I wouldn't get a response from the ping I sent from my host to the VM.

Is this more clear now?

Jupiler78
0
 

Author Comment

by:david_32
Comment Utility
Yes thank you.. another question - did you have to Add the NIC through Add Hardware in windows on the VM or did you just set it up on the setting of the VM in virtual pc and it configured itself?
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
It did it in the setting screen of the VM, where you can choose the number of nics. And choose for each nic then what you want it to be configured like.
0
 

Author Comment

by:david_32
Comment Utility
do you have to use 192.168.0.0  addressing or can you use 10.0.0.0
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
You can use any addressing. You don't have to configre the addressing, it finds it on its own.
0
 

Author Comment

by:david_32
Comment Utility
thats interesting because when I chose shared NAT it did give me an IP address in 192.168 range but my host had 10.0.0.0 range so I'm guessing thats why it didn't ping. Are you sure any addressing is ok?

0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
As you can see, when I choose Shared NAT I also get a completely different IP-range, so I couldnt' ping.
When I added the second nic with as adapter the networkcard I'm using, then I get a second IP-adres that is in range with my host.
You can see them all at that point with: ipconfig /all
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:david_32
Comment Utility
sorry that doesn't make sense to me please rephrase (I'm not trying to be painful - sorry!)
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
I have added 3 screenshots.
Host= the ip of the host, retrieved by ipconfig /all
IPs = both the ips of the VM, retreived by ipconfig /all
Settings = the configuration screen of my VM

Does it make more sense now?
host.jpg
IPs.JPG
settings.JPG
0
 

Author Comment

by:david_32
Comment Utility
so what you are saying is that the VM needs 2 NICs for the connection to work.. which means effectively the host needs 3 network connections accessible - is that right?
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
david_32,

Sorry, that it took some time for me to answer.
For me the VM indeed needs the adapters to work.

What do you mean by the host needs 3?
The virtual machine uses the same as it uses them virtually.

Jupiler78
0
 

Author Comment

by:david_32
Comment Utility
thats ok Juliper,

3 NICs or virtual NIC as I understand it.

So is it the case that the VM and host use the same NICs at the same time.
 
What I mean is that I believe you have 3 NIC on your host. Two of those NIC are used by your VM and the other one is used by your host. But you said
'The virtual machine uses the same as it uses them virtually.'

which would indicate to me that 2 NICs would work because the network connection between the host and VM is a physical NIC and a virtual NIC which is the same as the physical NIC
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
Yes, it uses them virtually.
So in fact 1 physival NIC would be enough.
Because the VM uses it the other times virtually.
I don't know how Virtual PC does it, but it works.
I always am only on my wireless, so 1 nic in use.
But as you can see in my screenshots, with all nic count togehter, physical and virtual, I have 3 nics.
0
 

Author Comment

by:david_32
Comment Utility
doesn't seems to work for me. I have the IPs using same class (172.30 - VM statically configured) and the firewall is turned off both sides. I am using NAT and it won't ping either way.
0
 

Author Comment

by:david_32
Comment Utility
I tried NAT but instead of using static IP I used DHCP. Can ping from VM but it replies with VM IP rather than the one I pinged (host IP). Cannot ping from host to VM
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
What are the ip-address right now?
0
 

Author Comment

by:david_32
Comment Utility
on the VM ip is 192.168.131.65. On the host ip is 172.30.230.64. When you ping the host (172.168.131.65) from VM 192.168.131.65 it replies with the VM IP address (192.168.131.65)
0
 
LVL 8

Accepted Solution

by:
Jupiler78 earned 500 total points
Comment Utility
The VM should have 2 IP-adresses right now?
0
 

Author Closing Comment

by:david_32
Comment Utility
thanks Juliper.. it seemed to work all of a sudden - I only used 1 NIC with a static IP - you were very patient
0
 
LVL 8

Expert Comment

by:Jupiler78
Comment Utility
Ok, thank you for the points & grade.
Good luck in the future. :)

But perhaps you should ask a community person to move this to the Windows zone, as it is easier for others to find it.

regards

Jupiler78
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Are you looking to clear some space on your phone for the latest iOS 8 update? Did you switch to Spotify so you no longer need to keep music native on your phone? Run out of space for taking photos while in the middle of vacation? Sometimes the quic…
A lot of new and distinct gadgets are making their appearance every other day. The latest gadget that has wooed the attention of all gadget lovers and non gadget lovers alike is the Smartwatch. This tiny gadget is capable of offering live access to …
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
Users will learn how to set proper sequence settings, scale images, paste attributes, add transitions, fades, and music. Open up Final Cut Pro 7 and Create a new Project: Set the Sequence Settings. a) Click File > Easy Setup > Format > Apple ProRe…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now