Reprinted/Linux Network Settings in VMware Workstation Environment/Applicable to Wireless Network

First, let's introduce the network connection method of VMware. Our host is usually connected to the local area network and the Internet through a physical network card, and since the virtual machine has been called a virtual computer, the virtual network card must also exist, and if we want the virtual computer to be connected to the local area network or the Internet, it must be Let the virtual NIC work with the real physical NIC of the host. VMware provides three ways to bind virtual network cards and physical network cards, namely bridge (Bridge) mode, network address translation (Network Address Transformation, NAT) mode and host (Host Only) mode.
In short:
Bridge mode directly adds the virtual machine to the LAN, making the virtual machine look like a real computer in the network. There is no nominal affiliation between the virtual network card and the host physical network card, so it needs to have a The redundant IP address can be provided to the virtual machine network card. If a fixed IP is strictly assigned to each computer in the local area network, this Bridge mode will basically fail. For example, if we want to hang the network file system, but we are installing the Linux system on the VM virtual machine under Windows, we can use this method! In Bridge mode, the virtual machine can either access the Internet or communicate with other real computers in the local area network; in

NAT mode, the host's physical network card acts as a router or switch. At this time, VMware will provide many Subsets based on the host's real IP. IP is used by virtual machines, so that all virtual machines access the Internet through the host's network port, but it seems that these virtual machines have legitimate access to the local area network or the Internet, because their IP addresses appear after NAT technology. is legal.

In Host Only mode, virtual machines can communicate with each other, but virtual machines cannot communicate directly with other real computers in the local area network. However, in this mode, it is still possible to access the Internet through the host.

                                                     The picture above is Bridge mode


                              The picture above is Network Address Translation (NAT) mode

                       The picture above is Host Only mode
The virtual network card of the VM can be set to the above three network connection modes. By default, VMnet0 is set In Bridge mode, VMnet1 is set to Host Only mode, and the default connection mode of VMnet8 is NAT mode. The seven virtual network cards VMnet2-VMnet7 and VMnet9 can be customized by users, but only one of the virtual network cards can be set to NAT mode, and the default is VMnet8. Users can view this information in VMware workstation->Edit->Virtual Network Editor.

After understanding how the virtual network card connects to the network, it is necessary to actually connect the network. Select the simpler Internet connection mode, namely NAT mode, first set the "Network Connection" mode to NAT mode in "Virtual Machine Settings" (see Figure 1). Open Win7's "Network and Sharing Center" and select "Change Adapter Settings". If VMware workstation is installed correctly, you should see two virtual network cards, VMnet1 and VMnet8. Check the properties of the "Local Area Connection" connected with broadband, and by the way, check the VMware Bridge Protocol in "This connection uses the following items" under the "Network" tab, so that this protocol can be used when the Bridge mode is selected in the future. Under the "Sharing" tab, select "Allow other network users to connect through this computer's Internet connection (N)" in "Internet Connection Sharing" and select VMnet8 in "Home Network Connection (H)". After this setting, the network access rights of the host computer have been shared with VMnet8.

                             It can be seen in the network connection that VMnet1 and VMnet8
              
                             set up network
sharing . Next, you need to configure the IP address and mask of VMnet8. First, check the network properties of VMnet8, and also check the VMware Bridge Protocol in "This connection uses the following items" under the "Network" tab, so that it can be used in Bridge mode in the future. Looking at the properties of TCP/IPv4, you can see that the IP address has been automatically changed to a fixed 192.168.137.1, and the subnet mask is already 255.255.255.0, so let it be set like this and leave it alone.

Next, you need to configure the IP properties of VMnet8 in the VM. As shown in Figure 5, open VMware workstation->Edit->VMware Network Editor, select VMnet8, check Connect a host virtual network adapter to this network and Use local DHCP service to distribute IP address to VMs. The Subset IP needs to be in the same address segment as the IP of the host VMnet8, you can fill in 192.168.137.0, and the Subset Mask should be the same as the subnet mask of VMnet8, that is, fill in 255.255.255.0. Open DHCP Settings, fill in 192.168.137.0 for Start IP address, and 192.168.137.255 for End IP address, which can be automatically assigned to the virtual computer IP address in this IP segment. In NAT Settings, set the Getway IP to the IP of VMnet8 in the host computer, that is, 192.168.137.1.
      To sum up the above settings, the physical network card of the host computer is shared with VMnet8, VMnet8 acts as a router, and the virtual computer in the VM automatically obtains an IP address in a certain IP segment through DHCP, and these virtual machines are connected through the router (VMnet8) The IP is connected to the Internet on the physical network card.
      After setting these up, start CentOS in VMware. If it is normal, you should be able to ping the network. Open the browser in Xwindow and you should be able to start surfing. If you still can't connect to the Internet, you can log in to CentOS as the root user (other users do not have permission to modify the configuration file), and check whether the bootproto in the file system->etc->sysconfig->network-scripts->ifcfg-eth0 is dhcp , if not, modify it to dhcp, and then use the command service network restart to restart the network connection, and you can connect to the network.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326646826&siteId=291194637