how to connect to Guest windows from Host windows ?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
kentzhou
Posts: 6
Joined: 3. Feb 2010, 04:30
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: windows XP, windows 7, windows 2008

how to connect to Guest windows from Host windows ?

Post by kentzhou »

Host is windows 7. Virtual box guest is windows xp/windows 2008.
I can ping host from virtual box guest, but I can ping guest from host.
Network is NAT.

How to resolve this issue?
MarkCranness
Volunteer
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: how to connect to Guest windows from Host windows ?

Post by MarkCranness »

Pinging a guest does not work when using VirtualBox NAT networking.

You CAN still connect to services (File and Printer Sharing for example) running on the guest when using NAT if you setup port forwarding. See section 6.3.1 of the user manual or ask here if you have trouble with a specific service (let us know what the guest service is and what ports it uses).

Or you can set the guest to use Bridged networking (requires a router on your lan). The guest will have its own IP address on your lan, assigned using by DHCP on your lan, or static. You could then ping the guest, as well as connect to TCP services.

Note: By default the Windows XP firewall blocks incoming pings. See here for how to enable it: http://www.sysprobs.com/enable-ping-in-xp
kentzhou
Posts: 6
Joined: 3. Feb 2010, 04:30
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: windows XP, windows 7, windows 2008

Re: how to connect to Guest windows from Host windows ?

Post by kentzhou »

Thank you. I have a SQL server 2008 installed in VM windows XP(firewall turned off). I want to connect to SQL server from Host Windows 7. Following the guide you mentioned, I run following 3 commands:
VBoxManage setextradata "XP" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "XP" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 1433
VBoxManage setextradata "XP" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 1433

Then try to connect SQL Server by ODBC from windows 7 Host, but still failed.

Help please.
kentzhou
Posts: 6
Joined: 3. Feb 2010, 04:30
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: windows XP, windows 7, windows 2008

Re: how to connect to Guest windows from Host windows ?

Post by kentzhou »

thanks. When change the network mode to Bridge, it works fine.
MarkCranness
Volunteer
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: how to connect to Guest windows from Host windows ?

Post by MarkCranness »

It could be many things:
Try these:
  • Can you connect to SQL Server using ODBC FROM the guest, ON the guest?
  • Have you enabled TCP/IP as a protocol for SQL Server? (On SQL Server 2005 Express, you use: (from the Start menu: ... Configuration Tools>SQL Server Configuration Manager>SQL Server Network Configuration>Protocols for (database)>TCP/IP>(double-click to change)).
    On Windows 7 and SQL Server 2008 I'm not sure of how to get to the configuration tool.
  • Is the guest listening on port 1433? In the guest, run this command:

    Code: Select all

    netstat -a -n
    ... one of the lines should show 'Local Address' ending in ':1433' and 'State' = 'LISTENING
  • Is the host listening on port 1433? Do the same command above, but run it on the host.
  • You must reboot the guest to get the setextradata commands to be applied. Did you reboot the guest, or apply those commands while the guest was powered down?
  • Is the guest using one of the PCnet virtual network cards? (Settings>Network>Advanced), or one of the Intel or other?
  • Which address or host are you configuring ODBC to use? Use the host's IP address, or '(local)' in the 'Which SQL Server do you want to connect to? dropdown.
  • You may need other ports forwarded than just 1433 for admin connections and the like: See here: http://msdn.microsoft.com/en-us/library/cc646023.aspx
  • What is the failure error message when you try and connect?
Post Reply