There are 4 ways to connect the VirtualBox in the network:
A. NAT Network address translation mode (network addressing translation)
B. Bridged Adapter bridge mode
C. Internal Internal network model
D. host-only Adapter host Mode
VMware has three kinds, in fact, he and VMware network connectivity is the same concept, but more than VMware internal way.
The way to make yourself (or someone else) understand deeply is to do comparisons and metaphors, to compare differences and similarities, and to use familiar things as metaphors. First come to a picture, it is easy to see the difference between the 4 ways by this picture:
One or four modes of introduction
1, NAT
Nat:network address translation, network addresses translation
Nat mode is the simplest way to implement a virtual machine, you can understand this:
Guest access to the network all data are provided by the host, guest does not really exist in the network, the host and any machine on the network can not view and access to the presence of guest.
Guest can access all the networks that the host can access, but for hosts and other machines on the host network, guest is invisible and even the host cannot access guest.
Virtual machine and host relationship: Only one-way access, the virtual machine can be accessed through the network to the host, the host is unable to access the virtual machine over the network.
The relationship between virtual machines and other hosts on the network: only one-way access, virtual machines can access other hosts on the network, and other hosts cannot access virtual machines over the network.
Virtual machine and virtual machine relationship: Mutual access, virtual machines and virtual machines are completely independent of each other can not access each other through the network. ip:10.0.2.15 Gateway: 10.0.2.2 dns:10.0.2.3 Multiple network cards of a virtual machine can be set up using NAT, the first network card is connected to the private network 10.0.2.0, the second network card is connected to the private networks 10.0.3.0, and so on. The default client IP address is 10.0.2.15, the gateway is 10.0.2.2, and the domain name server (DNS) is 10.0.2.3, which can be manually referenced for modification. NAT Scheme pros and Cons: When the Notebook is plugged in: the virtual machine can access the host, the virtual machine can access the Internet, after the port mapping (and finally the instructions), the host can access the services on the virtual machine (such as the database).
Notebook is not plugged in: the host "local connection" has a red fork, the virtual machine can access the host, the virtual machine can not access the Internet, after the port mapping, the host can access the services on the virtual machine (such as database)
2, bridged Adapter (Network bridge mode)
Network Bridge mode, you can understand this:
It is through the host network card, erected a bridge, directly connected to the network. Therefore, it allows the virtual function to be assigned to a single network of independent IP, all network functions are completely the same as the real machine in the network.
Network Bridge mode of virtual machine, you think it is the real computer on the line.
Virtual machine and host relationship: You can access each other, because the virtual machine in the real network segment has a separate IP, the host and the virtual machine in the same network segment, each other through their respective IP access to each other.
The relationship of virtual machines to other hosts on the network: they can access each other, also because the virtual machine has a separate IP in the real network segment, the virtual machine is in the same network segment as all other hosts of the network, and each other can access each other through their respective IP.
Virtual machine and virtual machine relationship: can access each other, for the same reason. IP: DHCP is generally allocated, and the host's "Local Connection" IP is the same network segment. The virtual machine can communicate with the host. When the notebook is plugged in: (If there is a DHCP server in the network) the host and the virtual opportunity through DHCP to get an IP, the two IP in the same network segment. The host and the virtual machine can ping, the virtual machine can be on the Internet. The laptop is not plugged in: the host and the virtual machine cannot communicate. The host's "Local Area Connection" has a red fork, so you cannot specify IP manually. The virtual machine also cannot obtain the IP address through the DHCP, after manually specifies the IP, also cannot communicate with the host, because the host does not have the IP. At this time the host VirtualBox host-only network network card is IP, 192.168.56.1. Virtual machine Even if the manual specified IP 192.168.56.*, also ping can not host.
3, Internal (intranet mode)
Intranet mode, as the name implies is the internal network mode:
The virtual machine is completely disconnected from the extranet, and only the internal network mode between the virtual machine and the virtual machine is implemented.
The relationship between virtual machines and hosts: They can't access each other, they don't belong to the same network, they can't access each other.
The relationship between virtual machines and other hosts in the network: No access to each other, for the same reason.
The relationship between virtual machines and virtual machines: You can access each other, provided that two virtual machines set the same network name when you set up your network. As in the configuration diagram above, the name is intnet. Ip:virtualbox's DHCP server assigns IP to it, typically 192.168.56.101, because it is from 101, or you can specify 192.168.56.* manually. When the notebook is plugged in the network cable: the virtual machine can be virtualbox with the host Host-only Network network card communication This scheme is not subject to host local connection (network card) has the Red Fork influence.
4, Host-only Adapter (host mode)
Host mode, this is a more complex mode, need to have a more solid network basic knowledge to play the turn. It can be said that the previous several modes of implementation of the function, in this mode, through the virtual machine and network card settings can be implemented.
We can understand that the guest in the host to simulate a virtual machine to use the network card, all virtual machines are connected to the network card, we can set up this card to achieve the Internet and many other functions, such as (network card sharing, network card bridge, etc.).
Virtual machine and host relationship: The default is not mutual access, the two sides do not belong to the same IP segment, the HOST-ONLY network card default IP field 192.168.56.X subnet mask is 255.255 255.0, the following virtual machines are assigned to this network segment. Through the network card sharing, network card bridge and so on, you can realize the virtual machine in the host mutual access.
Virtual machine and Network host relationship: Default can not access each other, the reason above, through the settings, you can achieve mutual access.
Virtual machine and virtual machine relationship: The default can access each other, are in the same network segment. Virtual machine Access host, with the host of the VirtualBox host-only Network network card ip:192.168.56.1, regardless of host "local connection" there is no red fork, forever pass. Host access to the virtual machine, with the virtual machine's network card 3 ip:192.168.56.101, regardless of host "local connection" there is no red fork, forever pass. Virtual machine access to the Internet, with its own network card 2, when the host to be able to through the "local connection" wired Internet, (wireless network card does not work)
Add:
I just installed the VirtualBox when all the network connection methods have been tried, but the virtual machine and the virtual machine is not access to each other, ping is not a ping, I was wondering if VirtualBox's network settings are so complex, and later thought is not windows XP firewall problem, shut down, everything is normal.
Second, flexible application (analog out of a host, monitoring a local area network Internet environment)
Through the understanding of the above several network modes, we can use flexibly, simulate to build out any kind of network environment that we want. First I opened two virtual machines vhost1 and Vhost2, of course, if the hardware allowed, I can also add vhost3, Vhost4 ... All the vhost I have set into Internat intranet mode, the network name is intnal, the gateway is 192.168.56.100, which means to access the Internet through the 192.168.56.100 network card.
One of the vhost1 I set for the dual network card, one for the intranet mode (192.168.56.100), one for the bridge mode (192.168.1.101).
Two network cards to set up dual network card sharing, virtual machines for the LAN, which has a virtual machine vhost1 through the network, all the virtual machines in the local area network through the VHOST1 to achieve the external network.
This allows Vhost1 to monitor the entire virtual machine LAN access.
NAT Set port mappings You can set up a service for a virtual machine (such as a WEB service) by using the command-line tool to vboxmanage the proxy. You need to know which port the service of the virtual machine uses, and then decide which port to use on the host (usually but not always want the virtual machines and hosts to use the same port). Providing a service on the host requires a port, and you can use any port on the host that is not ready to provide the service. How to set up a new NAT example to connect to an SSH server on a virtual machine requires the following three commands:
Vboxmanage setextradata ' Linux Guest ' vboxinternal/devices/pcnet/0/lun#0/config/guestssh/protocol ' TCP
Vboxmanage setextradata ' Linux Guest ' Vboxinternal/devices/pcnet/0/lun#0/config/guestssh/guestport '
Vboxmanage setextradata ' Linux Guest ' vboxinternal/devices/pcnet/0/lun#0/config/guestssh/hostport ' 2222
Description: Vboxmanage is a command-line program, please check your VirtualBox installation directory, ' Linux Guest ' is the virtual host name. Guestssh is a custom name, and you can set the three commands above to forward the 22 ports of the virtual machine to the 2222 port of the host. For example, I installed the APACHE2 server on the virtual machine Debian, using port 80 to map to 80 ports on the host. Use the following command.
' C:/Program Files/innotek virtualbox/vboxmanage.exe ' setextradata ' Debian ' vboxinternal/devices/pcnet/0/lun#0/ Config/huzhangsheng/protocol ' TCP
' c:/program files/innotek virtualbox/vboxmanage.exe ' setextradata ' Debian ' Vboxinternal/devices/pcnet/0/lun#0/config/huzhangsheng/guestport '
c:/program ' Files/innotek VirtualBox/ VBoxManage.exe ' setextradata ' Debian ' vboxinternal/devices/pcnet/0/lun#0/config/huzhangsheng/hostport ' 80
Note: For the setting to take effect, please turn off VirtualBox and run the virtual machine, I install VirtualBox on WinXP, install Debian 4.02r in the virtual machine, the virtual machine name is Debian, and install apache2 php5 mysql-serv Er, on the host with IE browsing http://localhost, successfully forwarded to the virtual machine Debian apache2 Web server. Iv. Illustrations
Nat
In this way, the network card of the virtual machine is connected to the host's VMnet8. At this time, the system's VMWare NAT service serves as a router, responsible for sending the virtual machine to the VMNET8 packet for address translation to the actual network, and then the actual network returned packets after the address translation through the VMNET8 sent to the virtual machine. The VMWare DHCP service is responsible for providing DHCP services for virtual machines.
Bridged
In this way, the virtual machine, like a real computer, connects directly to the actual network and has no connection to the host.
Host-only
In this way, the network card of the virtual machine is connected to the host's VMnet1, but the system does not provide any routing services for the virtual machine, so the virtual machine can only communicate with the host and not the actual network.
Replicate physical network connection state option explains:
Select if the virtual machine uses a bridged network connection and if you have the virtual machine on a laptop or other mo Bile device. As you move from one wired or wireless network to another, the IP address is automatically renewed.
Single-machine multiple network card or notebook and mobile devices using virtual machine, when the cable network and wireless network switching, the replicate physical network connection state, the virtual computer network card IP address will automatically update, do not need to reset. Five, VirtualBox configure dual network card, to achieve internal and external network access environment: host operating system Windows XP SP3 virtual machine software