Objective
Many people install the virtual machine, often encountered the problem of Internet access, and VMware has three network mode, for beginners are also more giddy, today I will be based on virtual Machine 3 network mode, to help everyone to popularize the background knowledge of virtual machine online. (blog post original from http://www.cnblogs.com/ggjucheng/archive/2012/08/19/2646007.html)
Virtual Machine Network mode
Whether it is vmware,virtual box,virtual pc and other virtual machine software, in general, the virtual machine has three network modes:
1. Bridging
2.NAT
3.host-only
The beginner sees the virtual machine has three kinds of network, the estimate is panic, the author also. What kind of network is suitable for its own virtual machine?
Bridge connection
Bridge network refers to the local physical network card and virtual network card through the VMnet0 Virtual Switch Bridge, physical network card and virtual network card in the topology map on the same status, then the physical network card and virtual network card is equivalent to the same network segment, Virtual switch is equivalent to a real network switch, Therefore, the IP address of the two network card should also be set to the same network segment.
So when we want to use a virtual machine on the LAN , to provide services to other local area network PCs, such as FTP, provide SSH, provide HTTP services, then choose the Bridge mode.
For example, there is a router in the university dormitory, the dormitory four people connect this router, the router's Wanip ignore, this IP is dynamically obtained, and Lanip default is 192.168.1.1, subnet mask is 255.255.255.0. While the other four people are automatically acquiring IP, assume that the IP of four people is:
a:192.168.1.100/255.255.255.0, b:192.168.1.101/255.255.255.0, c:192.168.1.102/255.255.255.0, D:192.168.1.103/ 255.255.255.0
Then the IP address of the virtual machine can be set 192.168.1.2-192.168.1.99,192.168.1.104-192.168.1.254 (except for the network address of all 0 and all 1, and then the IP address of ABCD four person)
Then the IP address of the virtual machine can be set to 192.168.1.98/255.255.255.0, set the IP address, ABCD These four people can access the virtual machine through the 192.168.1.98, if the virtual machine needs Sisu Network, then also need to configure the virtual machine routing address, is 192.168.1.1, so that the virtual machine can sisu network, but, the internet we generally go through the domain name to access the external network, so we also need to set up a virtual machine Set up a DNS server, we can simply point to the DNS server address configured as Google's DNS server: 8.8.8.8, the virtual machine will be able to surf the Internet.
Nat
In NAT mode, the virtual machine is allowed to access the public network by means of a NAT (network address translation) function, which is located on the network hosting the machine.
In NAT mode, the network of the virtual machine's NIC and the physical NIC, not the same network, the virtual machine's NIC, is a virtual network provided in VMware.
Comparison of Nat and bridging:
(1) Nat mode and bridge mode virtual machine can be Sisu network.
(2) because the NAT network in a virtual network provided by VMware, so the other host network is unable to access the virtual machine, and the host can access the virtual machine, the virtual machine can access all the hosts of the local area network, because the real LAN relative to the NAT virtual network, is the network of NAT virtual network, People who don't understand can check the knowledge of NAT.
(3) In bridge mode, multiple virtual machines can access each other, and in NAT mode, multiple virtual machines can also access each other.
If you build a virtual machine, just give yourself to use, do not need to give other people to the LAN, then you can choose NAT, after all, the NAT mode of the virtual system's TCP/IP configuration information is provided by the VMNET8 (NAT) virtual network DHCP server, as long as the network configuration of the virtual machine is DHCP, Then you do not need to do any other configuration, only the host machine can access the Internet, you can let the virtual machine network.
For example, if you want to build multiple virtual machine clusters for testing purposes, the host may be a notebook and IP is not fixed. This scenario, we need to adopt the NAT mode, but we have to consider a problem, the virtual machine is required to exchange visits, the default DHCP, the virtual machine IP each reboot, IP is not fixed, so we need to manually set the IP address of the virtual machine.
But we don't know anything about the virtual network where the virtual machine card is located, such as the routing address and subnet mask of the virtual machine network, so we need to check the information of the NAT virtual network first.
Using VMware, as shown in the Edit->virtual network editor after configuring the virtual networking information, note that VMNET8,VMNET8 is equivalent to a router in this machine, and the virtual machine sets up the NAT to go online via this route. You can view its network address, routing address, and subnet mask.
Select Vmnet8->nat settings, you can see the subnet IP display as 192.168.233.0, the subnet mask is 255.255.255.0, that route address, is actually the gateway IP, are the same thing, here is 192.168.233.2.
Next is good to do, in the corresponding virtual machine set IP, subnet mask, routing address can be Sisu network, as for DNS can be set to 8.8.8.8.
Host-only
In host-only mode, the virtual network is a fully enclosed network, and the only access to it is the host. In fact, Host-only Network and NAT network is very similar, the difference is that the Host-only network does not have NAT service, so the virtual network can not connect to the Internet. Communication between the host and the virtual machine is achieved through the VMware Network adepter VMnet1 virtual network card.
Host-only's aim is to create an internal network that is isolated from the outside world to improve the security of the intranet. This feature may not make much sense to ordinary users, but large service chambers often take advantage of this feature. If you want to provide routing for the VMnet1 network segment, you need to use RRAS instead of XP or 2000 ICS, Because ICS will change the IP address of the intranet to 192.168.0.1, but the virtual machine will not assign this address to the VMNET1 virtual network card, then the host and the virtual machine will not be able to communicate.
Overview
In the VMware 3 network mode, the NAT mode is the simplest, basically do not need to manually configure the IP address and other related parameters. As for the bridge mode requires an additional IP address, if it is in the intranet environment is still very easy, if ADSL broadband is more troublesome, ISP is generally not generous to provide a public network IP.
03--examples of virtual machines 3 network modes (bridging, NAT, Host-only)