Applicable situation
(1) No network, no network cable
(2) Host direct connection broadband (no router)
Scene:
Host Windows 7
Virtual Machine Windows XP
The virtual machine has SQLServer2005 installed, and the host wants to connect to the database using the virtual machine
References: http://blog.csdn.net/w_ww_w/article/details/7348328
Implementation steps:
1. Run Virutalbox (VirtualBox.exe), do not run the virtual machine;
2. Open the "Network Connections" page of the host, and note the network settings for the "VirtualBox host-only network" (my default setting is (after installing VirtualBox, the network connection is automatically VirtualBox host-only Network): IP address is 192.168.56.1, Mask is 255.255.255.0);
3. Start the virtual machine and set the network for the virtual machine as follows:
IP Address: 192.168.56.2
Mask: 255.255.255.0
Gateway: 192.168.56.1
(My experiment found that there is no need to set DNS);
4. Try the host and the virtual machine to ping each other
If you find that the ping is blocked, the main reason is that the firewall intercepts
When you ping, you can shut down the firewalls of 2 computers before you turn on the firewall after each ping succeeds
5. My goal is that the host connection uses the virtual machine's database service, and the default port for SQL Server is: 1433,
Therefore, setting the exception port for the virtual machine Windows XP firewall allows the host to connect to the virtual machine.
Set the following for virtual machine Windows XP:
Start--> Control Panel-->windows firewall--> Click on the "Exceptions" tab--> click the "Add Port" button
An easy to remember name, Port is: 1433, radio button: TCP, point OK.
Host test is able to connect:
In Windows 7
Win+r-->cmd-->telnet 192.168.68.2 1433
A new command window appears, and the caption for the command window, "Telnet 192.168.68.2," proves successful.
If I tell you that Telnet is not an internal command,
Turn on "start" → "Control Panel" → "Turn on or off Windows features", and in the open window, look for and check the Telnet client, then click OK. After the smooth installation, then enter this command on the run under the OK.
The host computer communicates with the virtual machine by Host-only, at which point the virtual machine cannot access the extranet.
The easiest way to solve this problem is to set up a network card for the virtual machine and connect to NAT
In addition, if there is a router, the bridge can be used to communicate with each other and the Internet, because the host and virtual machines are two equal computers on the LAN.