Three kinds of examples to explain a virtual machine network model (bridge, nat, Host-only)

Foreword

When a lot of people install virtual machines, often encounter problems not access the Internet, while vmware three network mode, for beginners is also more chaotic chat vertigo, today I come to a virtual machine based on three kinds of network models, we help popularize under background virtual machine access to the Internet. (Bowen original self 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. Bridge

2.NAT

3.Host-Only

There are three beginners see the virtual machine network, estimated to panic, the author is. Which network is suitable for their own virtual machine do?

bridging

    Bridge network means local physical and virtual network adapter card through a virtual switch VMnet0 bridge the physical and virtual network adapter card in the same position in the topology, the physical and virtual network adapter card is equivalent to the same network segment, the virtual switch is equivalent to a real switches in the network, so the IP addresses of the two network cards have the same network segment.

   So when we want to use virtual machines in a local area network, local area network to provide services to other pc, such as providing ftp, providing ssh, http provide services, then they would choose bridge mode.

   For example there is a router college dorm, dorm four people connected to the router, the router wanip do not care, this is a dynamic ip get, and lanip default is 192.168.1.1, subnet mask is 255.255.255.0. The other four are automatically obtain ip, ip is assumed that four people:

   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

   Ip ip address then the virtual machine may be provided 192.168.1.2-192.168.1.99,192.168.1.104-192.168.1.254 (except for the network address of all zeroes and all, and then removing four ABCD ip address)

  Then the ip address of the virtual machine can be set to 192.168.1.98/255.255.255.0, set this ip address, ABCD four individuals can access virtual machines through 192.168.1.98, if required on a virtual machine outside the network, you need to configure the routing address of the virtual machine is 192.168.1.1, so the virtual machine can be more than external networks, however, we generally through the Internet domain name to access the Internet, so we also need to configure a dns server as a virtual machine, we you can simply point, the dns server address is configured to google dns servers: 8.8.8.8, this virtual machine can be online.

NAT

NAT mode, is to make the virtual machine by means of NAT (network address translation) function to access the public network via a network host machine is located.

   NAT mode, the card and a physical network card of the virtual machine, not in the same network, the network card of the virtual machine, a virtual network is provided in vmware.

   NAT and bridging of comparison:

   (1) NAT mode and bridge mode virtual machines can be more external networks.

   (2) Due to a virtual network NAT network in vmware provided inside, so the LAN other hosts can not access the virtual machine and the host can access the virtual machine, the virtual machine can access all host LAN, because the real local area network with respect to NAT virtual network is a virtual network of NAT's external network, people do not understand can look up the relevant knowledge of NAT.

   (3) bridge mode, among a plurality of virtual machines can access each other; NAT mode, among the plurality of virtual machines can access each other.

   If you build a virtual machine, just for yourself, do not need other people to use local area network, you can choose NAT, after all, the virtual system in NAT mode TCP / IP configuration information is provided by the DHCP server VMnet8 (NAT) virtual network as long as the network configuration of the virtual machine is DHCP, then you do not need any other configuration, only the host machine can access the Internet can be, you can make a virtual machine networking.

  For example, you want to build multiple virtual machine clusters, used as a test, and the host may be a notebook, ip is not fixed. This scenario, we need to adopt nat mode, but we have to consider a question, between virtual machines is needed visits, defaults to dhcp, each time you restart the virtual machine ip, ip is not fixed, so we the need to manually set the virtual machine ip address.

  But we have information on the virtual network where the virtual machine NIC also know nothing about, such as virtual machine network routing address, subnet mask, so we need to check under the nat virtual information network.

  After using VMware, configure the virtual network information Edit-> Virtual Network Editor seen in the figure, note VMnet8, VMnet8 this route is equivalent to a machine, the virtual machine to access the Internet is provided through the NAT after this route, Check its network address, routing address, subnet mask.

  Select VMnet8-> NAT settings, you can see the display ip subnet is 192.168.233.0, the subnet mask is 255.255.255.0, the routing address that does, in fact, is the gateway IP, it's all the same thing, here is 192.168.233.2 .

  Then easier to handle, good ip in the corresponding virtual machine settings, subnet mask and router address can be more than external networks, as dns can be set to 8.8.8.8.

Host-Only

 In Host-Only mode, the virtual network is a closed network, it is the only way to access the host. In fact, Host-Only Network and NAT network is very similar, difference is that there is no NAT Host-Only Network Service, so the virtual network can not connect to the Internet. Communication between the host and the virtual machine is achieved by VMware Network Adepter VMnet1 virtual network adapter.

  Host-Only's aim is to establish a network of internal isolated from the outside world, to increase security within the network. This feature may not mean much to the average user, but the large service Chamber of Commerce often take advantage of this feature. If you want to provide for the VMnet1 network routing function, it would need to use RRAS, and you can not use XP or 2000 ICS, ICS because the IP address within the network will change 192.168.0.1, but the virtual machine is not going to virtual VMnet1 NIC assigned this address, you can not communicate between the host and the virtual machines.

Overview

  In network mode 3, the VMware, NAT is the simplest mode, configure an IP address and other parameters substantially no manual. As for bridge mode will require additional IP addresses, if the intranet environment is very easy, if it is more trouble ADSL broadband, ISP do not normally provide a more generous public IP.

Guess you like

Origin www.cnblogs.com/zeug/p/11349838.html